diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
commit | 815f1ed417bd26fbe2abbdf20ac5d3423b30796c (patch) | |
tree | 923c9a9e2834ccab60f5caecfb8f0ac410c1dd9e /Source/WebCore | |
parent | b4ad5d9d2b96baacd0180ead50de5195ca78af2d (diff) | |
download | qtwebkit-815f1ed417bd26fbe2abbdf20ac5d3423b30796c.tar.gz |
Imported WebKit commit e65cbc5b6ac32627c797e7fc7f46eb7794410c92 (http://svn.webkit.org/repository/webkit/trunk@123308)
New snapshot with better configure tests
Diffstat (limited to 'Source/WebCore')
462 files changed, 11028 insertions, 6148 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 953676684..89d450281 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1,12 +1,17 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}" + "${WEBCORE_DIR}/Modules/battery" "${WEBCORE_DIR}/Modules/filesystem" + "${WEBCORE_DIR}/Modules/gamepad" "${WEBCORE_DIR}/Modules/geolocation" "${WEBCORE_DIR}/Modules/indexeddb" "${WEBCORE_DIR}/Modules/intents" + "${WEBCORE_DIR}/Modules/mediastream" + "${WEBCORE_DIR}/Modules/networkinfo" "${WEBCORE_DIR}/Modules/notifications" "${WEBCORE_DIR}/Modules/protocolhandler" "${WEBCORE_DIR}/Modules/quota" + "${WEBCORE_DIR}/Modules/vibration" "${WEBCORE_DIR}/Modules/webaudio" "${WEBCORE_DIR}/Modules/webdatabase" "${WEBCORE_DIR}/Modules/websockets" @@ -52,6 +57,7 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/image-decoders/png" "${WEBCORE_DIR}/platform/image-decoders/webp" "${WEBCORE_DIR}/platform/leveldb" + "${WEBCORE_DIR}/platform/mediastream" "${WEBCORE_DIR}/platform/mock" "${WEBCORE_DIR}/platform/network" "${WEBCORE_DIR}/platform/sql" @@ -121,6 +127,38 @@ SET(WebCore_IDL_INCLUDES ) SET(WebCore_IDL_FILES + Modules/battery/BatteryManager.idl + Modules/battery/NavigatorBattery.idl + + Modules/filesystem/DirectoryEntry.idl + Modules/filesystem/DirectoryEntrySync.idl + Modules/filesystem/DirectoryReader.idl + Modules/filesystem/DirectoryReaderSync.idl + Modules/filesystem/DOMFileSystem.idl + Modules/filesystem/DOMFileSystemSync.idl + Modules/filesystem/DOMWindowFileSystem.idl + Modules/filesystem/EntriesCallback.idl + Modules/filesystem/Entry.idl + Modules/filesystem/EntrySync.idl + Modules/filesystem/EntryArray.idl + Modules/filesystem/EntryArraySync.idl + Modules/filesystem/EntryCallback.idl + Modules/filesystem/ErrorCallback.idl + Modules/filesystem/FileCallback.idl + Modules/filesystem/FileEntry.idl + Modules/filesystem/FileEntrySync.idl + Modules/filesystem/FileSystemCallback.idl + Modules/filesystem/FileWriterCallback.idl + Modules/filesystem/FileWriter.idl + Modules/filesystem/FileWriterSync.idl + Modules/filesystem/Metadata.idl + Modules/filesystem/MetadataCallback.idl + Modules/filesystem/WorkerContextFileSystem.idl + + Modules/gamepad/Gamepad.idl + Modules/gamepad/GamepadList.idl + Modules/gamepad/NavigatorGamepad.idl + Modules/geolocation/Geolocation.idl Modules/geolocation/Geoposition.idl Modules/geolocation/NavigatorGeolocation.idl @@ -128,7 +166,66 @@ SET(WebCore_IDL_FILES Modules/geolocation/PositionError.idl Modules/geolocation/PositionErrorCallback.idl + Modules/indexeddb/DOMWindowIndexedDatabase.idl + Modules/indexeddb/IDBAny.idl + Modules/indexeddb/IDBCursor.idl + Modules/indexeddb/IDBCursorWithValue.idl + Modules/indexeddb/IDBDatabase.idl + Modules/indexeddb/IDBDatabaseException.idl + Modules/indexeddb/IDBFactory.idl + Modules/indexeddb/IDBIndex.idl + Modules/indexeddb/IDBKey.idl + Modules/indexeddb/IDBKeyRange.idl + Modules/indexeddb/IDBObjectStore.idl + Modules/indexeddb/IDBRequest.idl + Modules/indexeddb/IDBTransaction.idl + Modules/indexeddb/IDBVersionChangeEvent.idl + Modules/indexeddb/IDBVersionChangeRequest.idl + Modules/indexeddb/WorkerContextIndexedDatabase.idl + + Modules/intents/DeliveredIntent.idl + Modules/intents/DOMWindowIntents.idl + Modules/intents/Intent.idl + Modules/intents/IntentResultCallback.idl + Modules/intents/NavigatorIntents.idl + + Modules/mediastream/DeprecatedPeerConnection.idl + Modules/mediastream/DOMWindowMediaStream.idl + Modules/mediastream/IceCallback.idl + Modules/mediastream/IceCandidate.idl + Modules/mediastream/LocalMediaStream.idl + Modules/mediastream/MediaStream.idl + Modules/mediastream/MediaStreamEvent.idl + Modules/mediastream/MediaStreamList.idl + Modules/mediastream/MediaStreamTrack.idl + Modules/mediastream/MediaStreamTrackEvent.idl + Modules/mediastream/MediaStreamTrackList.idl + Modules/mediastream/NavigatorMediaStream.idl + Modules/mediastream/NavigatorUserMediaError.idl + Modules/mediastream/NavigatorUserMediaErrorCallback.idl + Modules/mediastream/NavigatorUserMediaSuccessCallback.idl + Modules/mediastream/PeerConnection00.idl + Modules/mediastream/SessionDescription.idl + Modules/mediastream/SignalingCallback.idl + + Modules/networkinfo/NavigatorNetworkInfoConnection.idl + Modules/networkinfo/NetworkInfoConnection.idl + + Modules/notifications/DOMWindowNotifications.idl + Modules/notifications/Notification.idl + Modules/notifications/NotificationCenter.idl + Modules/notifications/NotificationPermissionCallback.idl + Modules/notifications/WorkerContextNotifications.idl + Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl + + Modules/quota/DOMWindowQuota.idl + Modules/quota/StorageInfo.idl + Modules/quota/StorageInfoErrorCallback.idl + Modules/quota/StorageInfoQuotaCallback.idl + Modules/quota/StorageInfoUsageCallback.idl + + Modules/vibration/NavigatorVibration.idl Modules/webaudio/AudioBuffer.idl Modules/webaudio/AudioBufferCallback.idl @@ -158,8 +255,25 @@ SET(WebCore_IDL_FILES Modules/webaudio/WaveShaperNode.idl Modules/webaudio/WaveTable.idl + Modules/webdatabase/Database.idl + Modules/webdatabase/DatabaseCallback.idl + Modules/webdatabase/DatabaseSync.idl + Modules/webdatabase/DOMWindowWebDatabase.idl + Modules/webdatabase/SQLError.idl + Modules/webdatabase/SQLException.idl + Modules/webdatabase/SQLResultSet.idl + Modules/webdatabase/SQLResultSetRowList.idl + Modules/webdatabase/SQLStatementCallback.idl + Modules/webdatabase/SQLStatementErrorCallback.idl + Modules/webdatabase/SQLTransaction.idl + Modules/webdatabase/SQLTransactionCallback.idl + Modules/webdatabase/SQLTransactionErrorCallback.idl + Modules/webdatabase/SQLTransactionSync.idl + Modules/webdatabase/SQLTransactionSyncCallback.idl + Modules/websockets/CloseEvent.idl Modules/websockets/DOMWindowWebSocket.idl + Modules/websockets/WebSocket.idl Modules/websockets/WorkerContextWebSocket.idl css/Counter.idl @@ -178,8 +292,8 @@ SET(WebCore_IDL_FILES css/CSSValueList.idl css/MediaList.idl css/MediaQueryList.idl - css/Rect.idl css/RGBColor.idl + css/Rect.idl css/StyleMedia.idl css/StyleSheet.idl css/StyleSheetList.idl @@ -200,17 +314,18 @@ SET(WebCore_IDL_FILES dom/Comment.idl dom/CompositionEvent.idl dom/CustomEvent.idl + dom/DataTransferItem.idl dom/DataTransferItemList.idl dom/DeviceMotionEvent.idl dom/DeviceOrientationEvent.idl - dom/DocumentFragment.idl - dom/Document.idl - dom/DocumentType.idl dom/DOMCoreException.idl dom/DOMError.idl dom/DOMImplementation.idl dom/DOMStringList.idl dom/DOMStringMap.idl + dom/DocumentFragment.idl + dom/Document.idl + dom/DocumentType.idl dom/Element.idl dom/Entity.idl dom/EntityReference.idl @@ -241,7 +356,9 @@ SET(WebCore_IDL_FILES dom/ProgressEvent.idl dom/RangeException.idl dom/Range.idl + dom/RequestAnimationFrameCallback.idl dom/ShadowRoot.idl + dom/StringCallback.idl dom/TextEvent.idl dom/Text.idl dom/TouchEvent.idl @@ -257,10 +374,12 @@ SET(WebCore_IDL_FILES editing/UndoManager.idl fileapi/Blob.idl - fileapi/FileError.idl fileapi/File.idl + fileapi/FileError.idl + fileapi/FileException.idl fileapi/FileList.idl fileapi/FileReader.idl + fileapi/FileReaderSync.idl fileapi/WebKitBlobBuilder.idl html/DOMFormData.idl @@ -358,15 +477,37 @@ SET(WebCore_IDL_FILES html/canvas/CanvasRenderingContext2D.idl html/canvas/CanvasRenderingContext.idl html/canvas/DataView.idl + html/canvas/EXTTextureFilterAnisotropic.idl html/canvas/Float32Array.idl html/canvas/Float64Array.idl html/canvas/Int16Array.idl html/canvas/Int32Array.idl html/canvas/Int8Array.idl + html/canvas/OESStandardDerivatives.idl + html/canvas/OESTextureFloat.idl + html/canvas/OESVertexArrayObject.idl html/canvas/Uint16Array.idl html/canvas/Uint32Array.idl html/canvas/Uint8Array.idl html/canvas/Uint8ClampedArray.idl + html/canvas/WebGLActiveInfo.idl + html/canvas/WebGLBuffer.idl + html/canvas/WebGLCompressedTextureS3TC.idl + html/canvas/WebGLContextAttributes.idl + html/canvas/WebGLContextEvent.idl + html/canvas/WebGLDebugRendererInfo.idl + html/canvas/WebGLDebugShaders.idl + html/canvas/WebGLDepthTexture.idl + html/canvas/WebGLFramebuffer.idl + html/canvas/WebGLLoseContext.idl + html/canvas/WebGLProgram.idl + html/canvas/WebGLRenderbuffer.idl + html/canvas/WebGLRenderingContext.idl + html/canvas/WebGLShader.idl + html/canvas/WebGLShaderPrecisionFormat.idl + html/canvas/WebGLTexture.idl + html/canvas/WebGLUniformLocation.idl + html/canvas/WebGLVertexArrayObjectOES.idl html/shadow/HTMLContentElement.idl html/shadow/HTMLShadowElement.idl @@ -409,6 +550,7 @@ SET(WebCore_IDL_FILES page/WebKitAnimation.idl page/WebKitAnimationList.idl page/WebKitPoint.idl + page/WorkerNavigator.idl plugins/DOMMimeType.idl plugins/DOMMimeTypeArray.idl @@ -418,6 +560,14 @@ SET(WebCore_IDL_FILES storage/Storage.idl storage/StorageEvent.idl + workers/AbstractWorker.idl + workers/DedicatedWorkerContext.idl + workers/SharedWorker.idl + workers/SharedWorkerContext.idl + workers/Worker.idl + workers/WorkerContext.idl + workers/WorkerLocation.idl + xml/DOMParser.idl xml/XMLHttpRequest.idl xml/XMLHttpRequestException.idl @@ -432,13 +582,346 @@ SET(WebCore_IDL_FILES xml/XSLTProcessor.idl ) +# FIXME: The BlackBerry port doesn't support generating DOM bindings from the SVG IDL files. +# For now, we explicitly demarcate the SVG IDL files so that the BlackBerry port can skip them +# during DOM binding generation. See <https://bugs.webkit.org/show_bug.cgi?id=72773>. +SET(WebCore_SVG_IDL_FILES + svg/SVGAElement.idl + svg/SVGAltGlyphDefElement.idl + svg/SVGAltGlyphElement.idl + svg/SVGAltGlyphItemElement.idl + svg/SVGAngle.idl + svg/SVGAnimateColorElement.idl + svg/SVGAnimateMotionElement.idl + svg/SVGAnimateElement.idl + svg/SVGAnimateTransformElement.idl + svg/SVGAnimatedAngle.idl + svg/SVGAnimatedBoolean.idl + svg/SVGAnimatedEnumeration.idl + svg/SVGAnimatedInteger.idl + svg/SVGAnimatedLength.idl + svg/SVGAnimatedLengthList.idl + svg/SVGAnimatedNumber.idl + svg/SVGAnimatedNumberList.idl + svg/SVGAnimatedPreserveAspectRatio.idl + svg/SVGAnimatedRect.idl + svg/SVGAnimatedString.idl + svg/SVGAnimatedTransformList.idl + svg/SVGAnimationElement.idl + svg/SVGCircleElement.idl + svg/SVGClipPathElement.idl + svg/SVGColor.idl + svg/SVGComponentTransferFunctionElement.idl + svg/SVGCursorElement.idl + svg/SVGDefsElement.idl + svg/SVGDescElement.idl + svg/SVGDocument.idl + svg/SVGElement.idl + svg/SVGElementInstance.idl + svg/SVGElementInstanceList.idl + svg/SVGEllipseElement.idl + svg/SVGException.idl + svg/SVGFEBlendElement.idl + svg/SVGFEColorMatrixElement.idl + svg/SVGFEComponentTransferElement.idl + svg/SVGFECompositeElement.idl + svg/SVGFEConvolveMatrixElement.idl + svg/SVGFEDiffuseLightingElement.idl + svg/SVGFEDisplacementMapElement.idl + svg/SVGFEDistantLightElement.idl + svg/SVGFEDropShadowElement.idl + svg/SVGFEFloodElement.idl + svg/SVGFEFuncAElement.idl + svg/SVGFEFuncBElement.idl + svg/SVGFEFuncGElement.idl + svg/SVGFEFuncRElement.idl + svg/SVGFEGaussianBlurElement.idl + svg/SVGFEImageElement.idl + svg/SVGFEMergeElement.idl + svg/SVGFEMergeNodeElement.idl + svg/SVGFEMorphologyElement.idl + svg/SVGFEOffsetElement.idl + svg/SVGFEPointLightElement.idl + svg/SVGFESpecularLightingElement.idl + svg/SVGFESpotLightElement.idl + svg/SVGFETileElement.idl + svg/SVGFETurbulenceElement.idl + svg/SVGFilterElement.idl + svg/SVGFontElement.idl + svg/SVGFontFaceElement.idl + svg/SVGFontFaceFormatElement.idl + svg/SVGFontFaceNameElement.idl + svg/SVGFontFaceSrcElement.idl + svg/SVGFontFaceUriElement.idl + svg/SVGForeignObjectElement.idl + svg/SVGGElement.idl + svg/SVGGlyphElement.idl + svg/SVGGlyphRefElement.idl + svg/SVGGradientElement.idl + svg/SVGHKernElement.idl + svg/SVGImageElement.idl + svg/SVGLength.idl + svg/SVGLengthList.idl + svg/SVGLineElement.idl + svg/SVGLinearGradientElement.idl + svg/SVGMarkerElement.idl + svg/SVGMaskElement.idl + svg/SVGMatrix.idl + svg/SVGMetadataElement.idl + svg/SVGMissingGlyphElement.idl + svg/SVGMPathElement.idl + svg/SVGNumber.idl + svg/SVGNumberList.idl + svg/SVGPaint.idl + svg/SVGPathElement.idl + svg/SVGPathSeg.idl + svg/SVGPathSegArcAbs.idl + svg/SVGPathSegArcRel.idl + svg/SVGPathSegClosePath.idl + svg/SVGPathSegCurvetoCubicAbs.idl + svg/SVGPathSegCurvetoCubicRel.idl + svg/SVGPathSegCurvetoCubicSmoothAbs.idl + svg/SVGPathSegCurvetoCubicSmoothRel.idl + svg/SVGPathSegCurvetoQuadraticAbs.idl + svg/SVGPathSegCurvetoQuadraticRel.idl + svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl + svg/SVGPathSegCurvetoQuadraticSmoothRel.idl + svg/SVGPathSegLinetoAbs.idl + svg/SVGPathSegLinetoHorizontalAbs.idl + svg/SVGPathSegLinetoHorizontalRel.idl + svg/SVGPathSegLinetoRel.idl + svg/SVGPathSegLinetoVerticalAbs.idl + svg/SVGPathSegLinetoVerticalRel.idl + svg/SVGPathSegList.idl + svg/SVGPathSegMovetoAbs.idl + svg/SVGPathSegMovetoRel.idl + svg/SVGPatternElement.idl + svg/SVGPoint.idl + svg/SVGPointList.idl + svg/SVGPolygonElement.idl + svg/SVGPolylineElement.idl + svg/SVGPreserveAspectRatio.idl + svg/SVGRadialGradientElement.idl + svg/SVGRect.idl + svg/SVGRectElement.idl + svg/SVGRenderingIntent.idl + svg/SVGSVGElement.idl + svg/SVGScriptElement.idl + svg/SVGSetElement.idl + svg/SVGStopElement.idl + svg/SVGStringList.idl + svg/SVGStyleElement.idl + svg/SVGSwitchElement.idl + svg/SVGSymbolElement.idl + svg/SVGTRefElement.idl + svg/SVGTSpanElement.idl + svg/SVGTextContentElement.idl + svg/SVGTextElement.idl + svg/SVGTextPathElement.idl + svg/SVGTextPositioningElement.idl + svg/SVGTitleElement.idl + svg/SVGTransform.idl + svg/SVGTransformList.idl + svg/SVGUnitTypes.idl + svg/SVGUseElement.idl + svg/SVGViewElement.idl + svg/SVGViewSpec.idl + svg/SVGVKernElement.idl + svg/SVGZoomAndPan.idl + svg/SVGZoomEvent.idl +) + +LIST(APPEND WebCore_IDL_FILES + ${WebCore_SVG_IDL_FILES} +) + SET(WebCore_SOURCES + Modules/battery/BatteryController.cpp + Modules/battery/BatteryManager.cpp + Modules/battery/BatteryStatus.cpp + Modules/battery/NavigatorBattery.cpp + + Modules/filesystem/DOMFilePath.cpp + Modules/filesystem/DOMFileSystem.cpp + Modules/filesystem/DOMFileSystemBase.cpp + Modules/filesystem/DOMFileSystemSync.cpp + Modules/filesystem/DOMWindowFileSystem.cpp + Modules/filesystem/DirectoryEntry.cpp + Modules/filesystem/DirectoryEntrySync.cpp + Modules/filesystem/DirectoryReader.cpp + Modules/filesystem/DirectoryReaderSync.cpp + Modules/filesystem/Entry.cpp + Modules/filesystem/EntryArray.cpp + Modules/filesystem/EntryArraySync.cpp + Modules/filesystem/EntryBase.cpp + Modules/filesystem/EntrySync.cpp + Modules/filesystem/FileEntry.cpp + Modules/filesystem/FileEntrySync.cpp + Modules/filesystem/FileSystemCallbacks.cpp + Modules/filesystem/FileWriter.cpp + Modules/filesystem/FileWriterBase.cpp + Modules/filesystem/FileWriterSync.cpp + Modules/filesystem/LocalFileSystem.cpp + Modules/filesystem/WorkerContextFileSystem.cpp + + Modules/gamepad/Gamepad.cpp + Modules/gamepad/GamepadList.cpp + Modules/gamepad/NavigatorGamepad.cpp + Modules/geolocation/Geolocation.cpp Modules/geolocation/GeolocationController.cpp Modules/geolocation/NavigatorGeolocation.cpp + + Modules/indexeddb/DOMWindowIndexedDatabase.cpp + Modules/indexeddb/IDBAny.cpp + Modules/indexeddb/IDBCursor.cpp + Modules/indexeddb/IDBCursorBackendImpl.cpp + Modules/indexeddb/IDBCursorWithValue.cpp + Modules/indexeddb/IDBDatabase.cpp + Modules/indexeddb/IDBDatabaseBackendImpl.cpp + Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp + Modules/indexeddb/IDBDatabaseException.cpp + Modules/indexeddb/IDBEventDispatcher.cpp + Modules/indexeddb/IDBFactory.cpp + Modules/indexeddb/IDBFactoryBackendImpl.cpp + Modules/indexeddb/IDBFactoryBackendInterface.cpp + Modules/indexeddb/IDBIndex.cpp + Modules/indexeddb/IDBIndexBackendImpl.cpp + Modules/indexeddb/IDBKey.cpp + Modules/indexeddb/IDBKeyRange.cpp + Modules/indexeddb/IDBKeyPath.cpp + Modules/indexeddb/IDBKeyPathBackendImpl.cpp + Modules/indexeddb/IDBLevelDBBackingStore.cpp + Modules/indexeddb/IDBLevelDBCoding.cpp + Modules/indexeddb/IDBObjectStore.cpp + Modules/indexeddb/IDBObjectStoreBackendImpl.cpp + Modules/indexeddb/IDBPendingTransactionMonitor.cpp + Modules/indexeddb/IDBRequest.cpp + Modules/indexeddb/IDBTransaction.cpp + Modules/indexeddb/IDBTransactionBackendImpl.cpp + Modules/indexeddb/IDBTransactionCoordinator.cpp + Modules/indexeddb/IDBVersionChangeEvent.cpp + Modules/indexeddb/IDBVersionChangeRequest.cpp + Modules/indexeddb/PageGroupIndexedDatabase.cpp + Modules/indexeddb/WorkerContextIndexedDatabase.cpp + + Modules/intents/DOMWindowIntents.cpp + Modules/intents/DeliveredIntent.cpp + Modules/intents/Intent.cpp + Modules/intents/IntentRequest.cpp + Modules/intents/NavigatorIntents.cpp + + Modules/mediastream/DeprecatedPeerConnection.cpp + Modules/mediastream/IceCandidate.cpp + Modules/mediastream/LocalMediaStream.cpp + Modules/mediastream/MediaStream.cpp + Modules/mediastream/MediaStreamEvent.cpp + Modules/mediastream/MediaStreamList.cpp + Modules/mediastream/MediaStreamRegistry.cpp + Modules/mediastream/MediaStreamTrack.cpp + Modules/mediastream/MediaStreamTrackEvent.cpp + Modules/mediastream/MediaStreamTrackList.cpp + Modules/mediastream/NavigatorMediaStream.cpp + Modules/mediastream/PeerConnection00.cpp + Modules/mediastream/SessionDescription.cpp + Modules/mediastream/UserMediaController.cpp + Modules/mediastream/UserMediaRequest.cpp + + Modules/networkinfo/NavigatorNetworkInfoConnection.cpp + Modules/networkinfo/NetworkInfo.cpp + Modules/networkinfo/NetworkInfoConnection.cpp + Modules/networkinfo/NetworkInfoController.cpp + + Modules/notifications/DOMWindowNotifications.cpp + Modules/notifications/NotificationCenter.cpp + Modules/notifications/NotificationController.cpp + Modules/notifications/Notification.cpp + Modules/notifications/WorkerContextNotifications.cpp Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp + Modules/quota/DOMWindowQuota.cpp + Modules/quota/StorageInfo.cpp + + Modules/vibration/NavigatorVibration.cpp + Modules/vibration/Vibration.cpp + + Modules/webaudio/AsyncAudioDecoder.cpp + Modules/webaudio/AudioBasicInspectorNode.cpp + Modules/webaudio/AudioBasicProcessorNode.cpp + Modules/webaudio/AudioBuffer.cpp + Modules/webaudio/AudioBufferSourceNode.cpp + Modules/webaudio/AudioChannelMerger.cpp + Modules/webaudio/AudioChannelSplitter.cpp + Modules/webaudio/AudioContext.cpp + Modules/webaudio/AudioDestinationNode.cpp + Modules/webaudio/AudioGainNode.cpp + Modules/webaudio/AudioListener.cpp + Modules/webaudio/AudioNode.cpp + Modules/webaudio/AudioNodeInput.cpp + Modules/webaudio/AudioNodeOutput.cpp + Modules/webaudio/AudioPannerNode.cpp + Modules/webaudio/AudioParam.cpp + Modules/webaudio/AudioParamTimeline.cpp + Modules/webaudio/AudioProcessingEvent.cpp + Modules/webaudio/AudioScheduledSourceNode.cpp + Modules/webaudio/AudioSummingJunction.cpp + Modules/webaudio/BiquadDSPKernel.cpp + Modules/webaudio/BiquadFilterNode.cpp + Modules/webaudio/BiquadProcessor.cpp + Modules/webaudio/ConvolverNode.cpp + Modules/webaudio/DefaultAudioDestinationNode.cpp + Modules/webaudio/DelayDSPKernel.cpp + Modules/webaudio/DelayNode.cpp + Modules/webaudio/DelayProcessor.cpp + Modules/webaudio/DynamicsCompressorNode.cpp + Modules/webaudio/JavaScriptAudioNode.cpp + Modules/webaudio/MediaElementAudioSourceNode.cpp + Modules/webaudio/OfflineAudioCompletionEvent.cpp + Modules/webaudio/OfflineAudioDestinationNode.cpp + Modules/webaudio/Oscillator.cpp + Modules/webaudio/RealtimeAnalyser.cpp + Modules/webaudio/RealtimeAnalyserNode.cpp + Modules/webaudio/WaveShaperDSPKernel.cpp + Modules/webaudio/WaveShaperNode.cpp + Modules/webaudio/WaveShaperProcessor.cpp + Modules/webaudio/WaveTable.cpp + + Modules/webdatabase/AbstractDatabase.cpp + Modules/webdatabase/ChangeVersionWrapper.cpp + Modules/webdatabase/DOMWindowWebDatabase.cpp + Modules/webdatabase/Database.cpp + Modules/webdatabase/DatabaseAuthorizer.cpp + Modules/webdatabase/DatabaseContext.cpp + Modules/webdatabase/DatabaseSync.cpp + Modules/webdatabase/DatabaseTask.cpp + Modules/webdatabase/DatabaseThread.cpp + Modules/webdatabase/DatabaseTracker.cpp + Modules/webdatabase/OriginQuotaManager.cpp + Modules/webdatabase/OriginUsageRecord.cpp + Modules/webdatabase/SQLException.cpp + Modules/webdatabase/SQLResultSet.cpp + Modules/webdatabase/SQLResultSetRowList.cpp + Modules/webdatabase/SQLStatement.cpp + Modules/webdatabase/SQLStatementSync.cpp + Modules/webdatabase/SQLTransaction.cpp + Modules/webdatabase/SQLTransactionClient.cpp + Modules/webdatabase/SQLTransactionCoordinator.cpp + Modules/webdatabase/SQLTransactionSync.cpp + + Modules/websockets/ThreadableWebSocketChannel.cpp + Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp + Modules/websockets/WebSocket.cpp + Modules/websockets/WebSocketChannel.cpp + Modules/websockets/WebSocketDeflater.cpp + Modules/websockets/WebSocketDeflateFramer.cpp + Modules/websockets/WebSocketExtensionDispatcher.cpp + Modules/websockets/WebSocketFrame.cpp + Modules/websockets/WebSocketHandshake.cpp + Modules/websockets/WebSocketHandshakeRequest.cpp + Modules/websockets/WebSocketHandshakeResponse.cpp + Modules/websockets/WorkerThreadableWebSocketChannel.cpp + accessibility/AXObjectCache.cpp accessibility/AccessibilityARIAGrid.cpp accessibility/AccessibilityARIAGridCell.cpp @@ -453,6 +936,7 @@ SET(WebCore_SOURCES accessibility/AccessibilityMenuListPopup.cpp accessibility/AccessibilityMockObject.cpp accessibility/AccessibilityObject.cpp + accessibility/AccessibilityProgressIndicator.cpp accessibility/AccessibilityRenderObject.cpp accessibility/AccessibilityScrollbar.cpp accessibility/AccessibilityScrollView.cpp @@ -540,6 +1024,9 @@ SET(WebCore_SOURCES css/StyleSheet.cpp css/StyleSheetContents.cpp css/StyleSheetList.cpp + css/SVGCSSComputedStyleDeclaration.cpp + css/SVGCSSParser.cpp + css/SVGCSSStyleSelector.cpp css/WebKitCSSFilterValue.cpp css/WebKitCSSKeyframeRule.cpp css/WebKitCSSKeyframesRule.cpp @@ -572,6 +1059,7 @@ SET(WebCore_SOURCES dom/ContextFeatures.cpp dom/CustomEvent.cpp dom/DatasetDOMStringMap.cpp + dom/DataTransferItem.cpp dom/DecodedDataDocumentParser.cpp dom/DeviceMotionController.cpp dom/DeviceMotionData.cpp @@ -579,6 +1067,11 @@ SET(WebCore_SOURCES dom/DeviceOrientationController.cpp dom/DeviceOrientationData.cpp dom/DeviceOrientationEvent.cpp + dom/DOMCoreException.cpp + dom/DOMError.cpp + dom/DOMImplementation.cpp + dom/DOMStringList.cpp + dom/DOMStringMap.cpp dom/Document.cpp dom/DocumentMarkerController.cpp dom/DocumentMarker.cpp @@ -587,11 +1080,6 @@ SET(WebCore_SOURCES dom/DocumentParser.cpp dom/DocumentOrderedMap.cpp dom/DocumentType.cpp - dom/DOMCoreException.cpp - dom/DOMError.cpp - dom/DOMImplementation.cpp - dom/DOMStringList.cpp - dom/DOMStringMap.cpp dom/DynamicNodeList.cpp dom/EditingText.cpp dom/Element.cpp @@ -647,6 +1135,7 @@ SET(WebCore_SOURCES dom/RangeException.cpp dom/RegisteredEventListener.cpp dom/ScopedEventQueue.cpp + dom/ScriptedAnimationController.cpp dom/ScriptableDocumentParser.cpp dom/ScriptElement.cpp dom/ScriptExecutionContext.cpp @@ -657,6 +1146,7 @@ SET(WebCore_SOURCES dom/SpaceSplitString.cpp dom/StaticHashSetNodeList.cpp dom/StaticNodeList.cpp + dom/StringCallback.cpp dom/StyledElement.cpp dom/StyleElement.cpp dom/TagNodeList.cpp @@ -744,11 +1234,16 @@ SET(WebCore_SOURCES editing/markup.cpp editing/visible_units.cpp + fileapi/AsyncFileStream.cpp fileapi/Blob.cpp fileapi/BlobURL.cpp fileapi/File.cpp fileapi/FileException.cpp fileapi/FileList.cpp + fileapi/FileReader.cpp + fileapi/FileReaderLoader.cpp + fileapi/FileReaderSync.cpp + fileapi/FileThread.cpp fileapi/ThreadableBlobRegistry.cpp fileapi/WebKitBlobBuilder.cpp @@ -785,6 +1280,7 @@ SET(WebCore_SOURCES html/HTMLAnchorElement.cpp html/HTMLAppletElement.cpp html/HTMLAreaElement.cpp + html/HTMLAudioElement.cpp html/HTMLBRElement.cpp html/HTMLBaseElement.cpp html/HTMLBaseFontElement.cpp @@ -827,6 +1323,7 @@ SET(WebCore_SOURCES html/HTMLLinkElement.cpp html/HTMLMapElement.cpp html/HTMLMarqueeElement.cpp + html/HTMLMediaElement.cpp html/HTMLMenuElement.cpp html/HTMLMetaElement.cpp html/HTMLMeterElement.cpp @@ -849,6 +1346,7 @@ SET(WebCore_SOURCES html/HTMLQuoteElement.cpp html/HTMLScriptElement.cpp html/HTMLSelectElement.cpp + html/HTMLSourceElement.cpp html/HTMLSpanElement.cpp html/HTMLStyleElement.cpp html/HTMLSummaryElement.cpp @@ -863,7 +1361,9 @@ SET(WebCore_SOURCES html/HTMLTextAreaElement.cpp html/HTMLTextFormControlElement.cpp html/HTMLTitleElement.cpp + html/HTMLTrackElement.cpp html/HTMLUListElement.cpp + html/HTMLVideoElement.cpp html/HTMLViewSourceDocument.cpp html/HiddenInputType.cpp html/ImageData.cpp @@ -875,6 +1375,7 @@ SET(WebCore_SOURCES html/LinkRelAttribute.cpp html/MediaController.cpp html/MediaDocument.cpp + html/MediaFragmentURIParser.cpp html/MicroDataItemValue.cpp html/MonthInputType.cpp html/NumberInputType.cpp @@ -892,6 +1393,7 @@ SET(WebCore_SOURCES html/TextFieldInputType.cpp html/TextInputType.cpp html/TimeInputType.cpp + html/TimeRanges.cpp html/URLInputType.cpp html/ValidationMessage.cpp html/ValidityState.cpp @@ -904,6 +1406,33 @@ SET(WebCore_SOURCES html/canvas/CanvasRenderingContext2D.cpp html/canvas/CanvasStyle.cpp html/canvas/DataView.cpp + html/canvas/EXTTextureFilterAnisotropic.cpp + html/canvas/OESStandardDerivatives.cpp + html/canvas/OESTextureFloat.cpp + html/canvas/OESVertexArrayObject.cpp + html/canvas/WebGLBuffer.cpp + html/canvas/WebGLCompressedTextureS3TC.cpp + html/canvas/WebGLContextAttributes.cpp + html/canvas/WebGLContextEvent.cpp + html/canvas/WebGLContextGroup.cpp + html/canvas/WebGLContextObject.cpp + html/canvas/WebGLDebugRendererInfo.cpp + html/canvas/WebGLDebugShaders.cpp + html/canvas/WebGLDepthTexture.cpp + html/canvas/WebGLExtension.cpp + html/canvas/WebGLFramebuffer.cpp + html/canvas/WebGLGetInfo.cpp + html/canvas/WebGLLoseContext.cpp + html/canvas/WebGLObject.cpp + html/canvas/WebGLProgram.cpp + html/canvas/WebGLRenderbuffer.cpp + html/canvas/WebGLRenderingContext.cpp + html/canvas/WebGLShader.cpp + html/canvas/WebGLShaderPrecisionFormat.cpp + html/canvas/WebGLSharedObject.cpp + html/canvas/WebGLTexture.cpp + html/canvas/WebGLUniformLocation.cpp + html/canvas/WebGLVertexArrayObjectOES.cpp html/parser/CSSPreloadScanner.cpp html/parser/HTMLConstructionSite.cpp @@ -933,12 +1462,23 @@ SET(WebCore_SOURCES html/shadow/ImageInnerElement.cpp html/shadow/InsertionPoint.cpp html/shadow/MediaControls.cpp + html/shadow/MediaControlElements.cpp html/shadow/MediaControlRootElement.cpp html/shadow/MeterShadowElement.cpp html/shadow/ProgressShadowElement.cpp html/shadow/SliderThumbElement.cpp html/shadow/TextControlInnerElements.cpp + html/track/LoadableTextTrack.cpp + html/track/TextTrack.cpp + html/track/TextTrackCue.cpp + html/track/TextTrackCueList.cpp + html/track/TextTrackList.cpp + html/track/TrackBase.cpp + html/track/TrackEvent.cpp + html/track/WebVTTParser.cpp + html/track/WebVTTTokenizer.cpp + inspector/ConsoleMessage.cpp inspector/ContentSearchUtils.cpp inspector/DOMEditor.cpp @@ -1029,7 +1569,9 @@ SET(WebCore_SOURCES loader/SubframeLoader.cpp loader/SubresourceLoader.cpp loader/TextResourceDecoder.cpp + loader/TextTrackLoader.cpp loader/ThreadableLoader.cpp + loader/WorkerThreadableLoader.cpp loader/appcache/ApplicationCache.cpp loader/appcache/ApplicationCacheGroup.cpp @@ -1044,6 +1586,9 @@ SET(WebCore_SOURCES loader/archive/ArchiveResource.cpp loader/archive/ArchiveResourceCollection.cpp + loader/archive/mhtml/MHTMLArchive.cpp + loader/archive/mhtml/MHTMLParser.cpp + loader/cache/CachedCSSStyleSheet.cpp loader/cache/CachedFont.cpp loader/cache/CachedImage.cpp @@ -1053,6 +1598,7 @@ SET(WebCore_SOURCES loader/cache/CachedResourceLoader.cpp loader/cache/CachedScript.cpp loader/cache/CachedSVGDocument.cpp + loader/cache/CachedTextTrack.cpp loader/cache/CachedXSLStyleSheet.cpp loader/cache/MemoryCache.cpp @@ -1063,6 +1609,11 @@ SET(WebCore_SOURCES loader/icon/IconRecord.cpp loader/icon/PageURLRecord.cpp + mathml/MathMLElement.cpp + mathml/MathMLInlineContainerElement.cpp + mathml/MathMLMathElement.cpp + mathml/MathMLTextElement.cpp + page/BarInfo.cpp page/Chrome.cpp page/Console.cpp @@ -1115,6 +1666,7 @@ SET(WebCore_SOURCES page/WebKitAnimationList.cpp page/WindowFeatures.cpp page/WindowFocusAllowedIndicator.cpp + page/WorkerNavigator.cpp page/animation/AnimationBase.cpp page/animation/AnimationController.cpp @@ -1127,6 +1679,7 @@ SET(WebCore_SOURCES page/scrolling/ScrollingCoordinatorNone.cpp platform/Arena.cpp + platform/AsyncFileSystem.cpp platform/CalculationValue.cpp platform/Clock.cpp platform/ContextMenu.cpp @@ -1140,6 +1693,7 @@ SET(WebCore_SOURCES platform/EventTracer.cpp platform/FileChooser.cpp platform/FileIconLoader.cpp + platform/FileStream.cpp platform/FileSystem.cpp platform/ClockGeneric.cpp platform/HistogramSupport.cpp @@ -1176,6 +1730,40 @@ SET(WebCore_SOURCES platform/animation/Animation.cpp platform/animation/AnimationList.cpp + platform/audio/AudioBus.cpp + platform/audio/AudioChannel.cpp + platform/audio/AudioDSPKernelProcessor.cpp + platform/audio/AudioFIFO.cpp + platform/audio/AudioPullFIFO.cpp + platform/audio/AudioResampler.cpp + platform/audio/AudioResamplerKernel.cpp + platform/audio/AudioUtilities.cpp + platform/audio/Biquad.cpp + platform/audio/Cone.cpp + platform/audio/DirectConvolver.cpp + platform/audio/Distance.cpp + platform/audio/DynamicsCompressor.cpp + platform/audio/DynamicsCompressorKernel.cpp + platform/audio/EqualPowerPanner.cpp + platform/audio/FFTConvolver.cpp + platform/audio/FFTFrame.cpp + platform/audio/FFTFrameStub.cpp + platform/audio/HRTFDatabase.cpp + platform/audio/HRTFDatabaseLoader.cpp + platform/audio/HRTFElevation.cpp + platform/audio/HRTFKernel.cpp + platform/audio/HRTFPanner.cpp + platform/audio/MultiChannelResampler.cpp + platform/audio/Panner.cpp + platform/audio/Reverb.cpp + platform/audio/ReverbAccumulationBuffer.cpp + platform/audio/ReverbConvolver.cpp + platform/audio/ReverbConvolverStage.cpp + platform/audio/ReverbInputBuffer.cpp + platform/audio/SincResampler.cpp + platform/audio/VectorMath.cpp + platform/audio/ZeroPole.cpp + platform/graphics/BitmapImage.cpp platform/graphics/Color.cpp platform/graphics/CrossfadeGeneratedImage.cpp @@ -1204,6 +1792,7 @@ SET(WebCore_SOURCES platform/graphics/ImageBuffer.cpp platform/graphics/ImageOrientation.cpp platform/graphics/IntRect.cpp + platform/graphics/MediaPlayer.cpp platform/graphics/Path.cpp platform/graphics/PathTraversalState.cpp platform/graphics/Pattern.cpp @@ -1214,6 +1803,7 @@ SET(WebCore_SOURCES platform/graphics/SimpleFontData.cpp platform/graphics/StringTruncator.cpp platform/graphics/SurrogatePairAwareTextIterator.cpp + platform/graphics/SVGGlyph.cpp platform/graphics/TextRun.cpp platform/graphics/WidthIterator.cpp @@ -1268,6 +1858,17 @@ SET(WebCore_SOURCES platform/graphics/transforms/TransformState.cpp platform/graphics/transforms/TranslateTransformOperation.cpp + platform/leveldb/LevelDBDatabase.cpp + platform/leveldb/LevelDBTransaction.cpp + platform/leveldb/LevelDBWriteBatch.cpp + + platform/mediastream/IceCandidateDescriptor.cpp + platform/mediastream/IceOptions.cpp + platform/mediastream/MediaHints.cpp + platform/mediastream/MediaStreamCenter.cpp + platform/mediastream/PeerConnection00Handler.cpp + platform/mediastream/SessionDescriptionDescriptor.cpp + platform/mock/DeviceMotionClientMock.cpp platform/mock/DeviceOrientationClientMock.cpp platform/mock/GeolocationClientMock.cpp @@ -1351,6 +1952,7 @@ SET(WebCore_SOURCES rendering/InlineTextBox.cpp rendering/LayoutState.cpp rendering/LayoutRepainter.cpp + rendering/PointerEventsHitRules.cpp rendering/RenderApplet.cpp rendering/RenderArena.cpp rendering/RenderBR.cpp @@ -1388,6 +1990,7 @@ SET(WebCore_SOURCES rendering/RenderListItem.cpp rendering/RenderListMarker.cpp rendering/RenderMarquee.cpp + rendering/RenderMedia.cpp rendering/RenderMenuList.cpp rendering/RenderMeter.cpp rendering/RenderMultiColumnBlock.cpp @@ -1425,6 +2028,7 @@ SET(WebCore_SOURCES rendering/RenderTextFragment.cpp rendering/RenderTheme.cpp rendering/RenderTreeAsText.cpp + rendering/RenderVideo.cpp rendering/RenderView.cpp rendering/RenderWidget.cpp rendering/RenderWordBreak.cpp @@ -1432,6 +2036,17 @@ SET(WebCore_SOURCES rendering/ScrollBehavior.cpp rendering/break_lines.cpp + rendering/mathml/RenderMathMLBlock.cpp + rendering/mathml/RenderMathMLFenced.cpp + rendering/mathml/RenderMathMLFraction.cpp + rendering/mathml/RenderMathMLMath.cpp + rendering/mathml/RenderMathMLOperator.cpp + rendering/mathml/RenderMathMLRoot.cpp + rendering/mathml/RenderMathMLRow.cpp + rendering/mathml/RenderMathMLSquareRoot.cpp + rendering/mathml/RenderMathMLSubSup.cpp + rendering/mathml/RenderMathMLUnderOver.cpp + rendering/style/ContentData.cpp rendering/style/CounterDirectives.cpp rendering/style/FillLayer.cpp @@ -1458,6 +2073,61 @@ SET(WebCore_SOURCES rendering/style/StyleSurroundData.cpp rendering/style/StyleTransformData.cpp rendering/style/StyleVisualData.cpp + rendering/style/SVGRenderStyle.cpp + rendering/style/SVGRenderStyleDefs.cpp + + rendering/svg/RenderSVGBlock.cpp + rendering/svg/RenderSVGContainer.cpp + rendering/svg/RenderSVGEllipse.cpp + rendering/svg/RenderSVGGradientStop.cpp + rendering/svg/RenderSVGForeignObject.cpp + rendering/svg/RenderSVGHiddenContainer.cpp + rendering/svg/RenderSVGImage.cpp + rendering/svg/RenderSVGInline.cpp + rendering/svg/RenderSVGInlineText.cpp + rendering/svg/RenderSVGModelObject.cpp + rendering/svg/RenderSVGPath.cpp + rendering/svg/RenderSVGRect.cpp + rendering/svg/RenderSVGResource.cpp + rendering/svg/RenderSVGResourceClipper.cpp + rendering/svg/RenderSVGResourceContainer.cpp + rendering/svg/RenderSVGResourceFilter.cpp + rendering/svg/RenderSVGResourceFilterPrimitive.cpp + rendering/svg/RenderSVGResourceGradient.cpp + rendering/svg/RenderSVGResourceLinearGradient.cpp + rendering/svg/RenderSVGResourceMarker.cpp + rendering/svg/RenderSVGResourceMasker.cpp + rendering/svg/RenderSVGResourcePattern.cpp + rendering/svg/RenderSVGResourceRadialGradient.cpp + rendering/svg/RenderSVGResourceSolidColor.cpp + rendering/svg/RenderSVGRoot.cpp + rendering/svg/RenderSVGShape.cpp + rendering/svg/RenderSVGTSpan.cpp + rendering/svg/RenderSVGText.cpp + rendering/svg/RenderSVGTextPath.cpp + rendering/svg/RenderSVGTransformableContainer.cpp + rendering/svg/RenderSVGViewportContainer.cpp + rendering/svg/SVGInlineFlowBox.cpp + rendering/svg/SVGInlineTextBox.cpp + rendering/svg/SVGPathData.cpp + rendering/svg/SVGRenderSupport.cpp + rendering/svg/SVGRenderTreeAsText.cpp + rendering/svg/SVGRenderingContext.cpp + rendering/svg/SVGResources.cpp + rendering/svg/SVGResourcesCache.cpp + rendering/svg/SVGResourcesCycleSolver.cpp + rendering/svg/SVGRootInlineBox.cpp + rendering/svg/SVGTextChunk.cpp + rendering/svg/SVGTextChunkBuilder.cpp + rendering/svg/SVGTextLayoutAttributes.cpp + rendering/svg/SVGTextLayoutAttributesBuilder.cpp + rendering/svg/SVGTextLayoutEngine.cpp + rendering/svg/SVGTextLayoutEngineBaseline.cpp + rendering/svg/SVGTextLayoutEngineSpacing.cpp + rendering/svg/SVGTextRunRenderingContext.cpp + rendering/svg/SVGTextMetrics.cpp + rendering/svg/SVGTextMetricsBuilder.cpp + rendering/svg/SVGTextQuery.cpp storage/StorageTask.cpp storage/StorageThread.cpp @@ -1472,6 +2142,192 @@ SET(WebCore_SOURCES storage/StorageSyncManager.cpp storage/StorageTracker.cpp + svg/ColorDistance.cpp + svg/SVGAElement.cpp + svg/SVGAltGlyphDefElement.cpp + svg/SVGAltGlyphElement.cpp + svg/SVGAltGlyphItemElement.cpp + svg/SVGAngle.cpp + svg/SVGAnimateColorElement.cpp + svg/SVGAnimatedAngle.cpp + svg/SVGAnimatedBoolean.cpp + svg/SVGAnimatedColor.cpp + svg/SVGAnimatedEnumeration.cpp + svg/SVGAnimatedInteger.cpp + svg/SVGAnimatedIntegerOptionalInteger.cpp + svg/SVGAnimatedLength.cpp + svg/SVGAnimatedLengthList.cpp + svg/SVGAnimatedNumber.cpp + svg/SVGAnimatedNumberList.cpp + svg/SVGAnimatedNumberOptionalNumber.cpp + svg/SVGAnimatedPath.cpp + svg/SVGAnimatedPointList.cpp + svg/SVGAnimatedPreserveAspectRatio.cpp + svg/SVGAnimatedRect.cpp + svg/SVGAnimatedString.cpp + svg/SVGAnimatedTransformList.cpp + svg/SVGAnimatedType.cpp + svg/SVGAnimateElement.cpp + svg/SVGAnimateMotionElement.cpp + svg/SVGAnimateTransformElement.cpp + svg/SVGAnimationElement.cpp + svg/SVGCircleElement.cpp + svg/SVGClipPathElement.cpp + svg/SVGColor.cpp + svg/SVGComponentTransferFunctionElement.cpp + svg/SVGCursorElement.cpp + svg/SVGDefsElement.cpp + svg/SVGDescElement.cpp + svg/SVGDocument.cpp + svg/SVGDocumentExtensions.cpp + svg/SVGElement.cpp + svg/SVGElementInstance.cpp + svg/SVGElementInstanceList.cpp + svg/SVGEllipseElement.cpp + svg/SVGException.cpp + svg/SVGExternalResourcesRequired.cpp + svg/SVGFEBlendElement.cpp + svg/SVGFEColorMatrixElement.cpp + svg/SVGFEComponentTransferElement.cpp + svg/SVGFECompositeElement.cpp + svg/SVGFEConvolveMatrixElement.cpp + svg/SVGFEDiffuseLightingElement.cpp + svg/SVGFEDisplacementMapElement.cpp + svg/SVGFEDistantLightElement.cpp + svg/SVGFEDropShadowElement.cpp + svg/SVGFEFloodElement.cpp + svg/SVGFEFuncAElement.cpp + svg/SVGFEFuncBElement.cpp + svg/SVGFEFuncGElement.cpp + svg/SVGFEFuncRElement.cpp + svg/SVGFEGaussianBlurElement.cpp + svg/SVGFEImageElement.cpp + svg/SVGFELightElement.cpp + svg/SVGFEMergeElement.cpp + svg/SVGFEMergeNodeElement.cpp + svg/SVGFEMorphologyElement.cpp + svg/SVGFEOffsetElement.cpp + svg/SVGFEPointLightElement.cpp + svg/SVGFESpecularLightingElement.cpp + svg/SVGFESpotLightElement.cpp + svg/SVGFETileElement.cpp + svg/SVGFETurbulenceElement.cpp + svg/SVGFilterElement.cpp + svg/SVGFilterPrimitiveStandardAttributes.cpp + svg/SVGFitToViewBox.cpp + svg/SVGFontData.cpp + svg/SVGFontElement.cpp + svg/SVGFontFaceElement.cpp + svg/SVGFontFaceFormatElement.cpp + svg/SVGFontFaceNameElement.cpp + svg/SVGFontFaceSrcElement.cpp + svg/SVGFontFaceUriElement.cpp + svg/SVGForeignObjectElement.cpp + svg/SVGGElement.cpp + svg/SVGGlyphElement.cpp + svg/SVGGlyphRefElement.cpp + svg/SVGGradientElement.cpp + svg/SVGHKernElement.cpp + svg/SVGImageElement.cpp + svg/SVGImageLoader.cpp + svg/SVGLangSpace.cpp + svg/SVGLength.cpp + svg/SVGLengthContext.cpp + svg/SVGLengthList.cpp + svg/SVGLineElement.cpp + svg/SVGLinearGradientElement.cpp + svg/SVGLocatable.cpp + svg/SVGMPathElement.cpp + svg/SVGMarkerElement.cpp + svg/SVGMaskElement.cpp + svg/SVGMetadataElement.cpp + svg/SVGMissingGlyphElement.cpp + svg/SVGNumberList.cpp + svg/SVGPaint.cpp + svg/SVGParserUtilities.cpp + svg/SVGPathBlender.cpp + svg/SVGPathBuilder.cpp + svg/SVGPathByteStreamBuilder.cpp + svg/SVGPathByteStreamSource.cpp + svg/SVGPathElement.cpp + svg/SVGPathParser.cpp + svg/SVGPathSegList.cpp + svg/SVGPathSegListBuilder.cpp + svg/SVGPathSegListSource.cpp + svg/SVGPathStringBuilder.cpp + svg/SVGPathStringSource.cpp + svg/SVGPathTraversalStateBuilder.cpp + svg/SVGPathUtilities.cpp + svg/SVGPatternElement.cpp + svg/SVGPointList.cpp + svg/SVGPolyElement.cpp + svg/SVGPolygonElement.cpp + svg/SVGPolylineElement.cpp + svg/SVGPreserveAspectRatio.cpp + svg/SVGRadialGradientElement.cpp + svg/SVGRectElement.cpp + svg/SVGSVGElement.cpp + svg/SVGScriptElement.cpp + svg/SVGSetElement.cpp + svg/SVGStopElement.cpp + svg/SVGStringList.cpp + svg/SVGStylable.cpp + svg/SVGStyleElement.cpp + svg/SVGStyledElement.cpp + svg/SVGStyledLocatableElement.cpp + svg/SVGStyledTransformableElement.cpp + svg/SVGSwitchElement.cpp + svg/SVGSymbolElement.cpp + svg/SVGTRefElement.cpp + svg/SVGTSpanElement.cpp + svg/SVGTests.cpp + svg/SVGTextContentElement.cpp + svg/SVGTextElement.cpp + svg/SVGTextPathElement.cpp + svg/SVGTextPositioningElement.cpp + svg/SVGTitleElement.cpp + svg/SVGTransform.cpp + svg/SVGTransformDistance.cpp + svg/SVGTransformList.cpp + svg/SVGTransformable.cpp + svg/SVGURIReference.cpp + svg/SVGUseElement.cpp + svg/SVGViewElement.cpp + svg/SVGViewSpec.cpp + svg/SVGVKernElement.cpp + svg/SVGZoomAndPan.cpp + svg/SVGZoomEvent.cpp + + svg/animation/SMILTime.cpp + svg/animation/SMILTimeContainer.cpp + svg/animation/SVGSMILElement.cpp + + svg/graphics/SVGImage.cpp + svg/graphics/SVGImageCache.cpp + + svg/graphics/filters/SVGFEImage.cpp + svg/graphics/filters/SVGFilter.cpp + svg/graphics/filters/SVGFilterBuilder.cpp + + svg/properties/SVGAttributeToPropertyMap.cpp + svg/properties/SVGPathSegListPropertyTearOff.cpp + + workers/AbstractWorker.cpp + workers/DedicatedWorkerContext.cpp + workers/DedicatedWorkerThread.cpp + workers/DefaultSharedWorkerRepository.cpp + workers/SharedWorker.cpp + workers/SharedWorkerContext.cpp + workers/SharedWorkerThread.cpp + workers/Worker.cpp + workers/WorkerContext.cpp + workers/WorkerEventQueue.cpp + workers/WorkerLocation.cpp + workers/WorkerMessagingProxy.cpp + workers/WorkerRunLoop.cpp + workers/WorkerScriptLoader.cpp + workers/WorkerThread.cpp + xml/DOMParser.cpp xml/NativeXPathNSResolver.cpp xml/XMLErrors.cpp @@ -1526,66 +2382,6 @@ SET(WebCore_USER_AGENT_STYLE_SHEETS ${WEBCORE_DIR}/css/view-source.css ) -IF (ENABLE_BLOB) - LIST(APPEND WebCore_SOURCES - fileapi/AsyncFileStream.cpp - fileapi/FileReader.cpp - fileapi/FileReaderLoader.cpp - fileapi/FileReaderSync.cpp - fileapi/FileThread.cpp - platform/FileStream.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - fileapi/FileException.idl - fileapi/FileReaderSync.idl - ) -ENDIF () - -IF (ENABLE_SQL_DATABASE) - LIST(APPEND WebCore_SOURCES - Modules/webdatabase/AbstractDatabase.cpp - Modules/webdatabase/ChangeVersionWrapper.cpp - Modules/webdatabase/DOMWindowWebDatabase.cpp - Modules/webdatabase/Database.cpp - Modules/webdatabase/DatabaseAuthorizer.cpp - Modules/webdatabase/DatabaseContext.cpp - Modules/webdatabase/DatabaseSync.cpp - Modules/webdatabase/DatabaseTask.cpp - Modules/webdatabase/DatabaseThread.cpp - Modules/webdatabase/DatabaseTracker.cpp - Modules/webdatabase/OriginQuotaManager.cpp - Modules/webdatabase/OriginUsageRecord.cpp - Modules/webdatabase/SQLException.cpp - Modules/webdatabase/SQLResultSet.cpp - Modules/webdatabase/SQLResultSetRowList.cpp - Modules/webdatabase/SQLStatement.cpp - Modules/webdatabase/SQLStatementSync.cpp - Modules/webdatabase/SQLTransaction.cpp - Modules/webdatabase/SQLTransactionClient.cpp - Modules/webdatabase/SQLTransactionCoordinator.cpp - Modules/webdatabase/SQLTransactionSync.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/webdatabase/DOMWindowWebDatabase.idl - Modules/webdatabase/Database.idl - Modules/webdatabase/DatabaseCallback.idl - Modules/webdatabase/DatabaseSync.idl - Modules/webdatabase/SQLError.idl - Modules/webdatabase/SQLException.idl - Modules/webdatabase/SQLResultSet.idl - Modules/webdatabase/SQLResultSetRowList.idl - Modules/webdatabase/SQLStatementCallback.idl - Modules/webdatabase/SQLStatementErrorCallback.idl - Modules/webdatabase/SQLTransaction.idl - Modules/webdatabase/SQLTransactionCallback.idl - Modules/webdatabase/SQLTransactionErrorCallback.idl - Modules/webdatabase/SQLTransactionSync.idl - Modules/webdatabase/SQLTransactionSyncCallback.idl - ) -ENDIF () - IF (ENABLE_SQL_DATABASE AND ENABLE_WORKERS) LIST(APPEND WebCore_SOURCES Modules/webdatabase/WorkerContextWebDatabase.cpp @@ -1596,108 +2392,6 @@ IF (ENABLE_SQL_DATABASE AND ENABLE_WORKERS) ) ENDIF () -IF (ENABLE_DATA_TRANSFER_ITEMS) - LIST(APPEND WebCore_IDL_FILES - dom/DataTransferItem.idl - dom/StringCallback.idl - ) - LIST(APPEND WebCore_SOURCES - dom/DataTransferItem.cpp - dom/StringCallback.cpp - ) -ENDIF () - -IF (ENABLE_INDEXED_DATABASE) - LIST(APPEND WebCore_SOURCES - Modules/indexeddb/DOMWindowIndexedDatabase.cpp - Modules/indexeddb/IDBAny.cpp - Modules/indexeddb/IDBCursor.cpp - Modules/indexeddb/IDBCursorBackendImpl.cpp - Modules/indexeddb/IDBCursorWithValue.cpp - Modules/indexeddb/IDBDatabase.cpp - Modules/indexeddb/IDBDatabaseBackendImpl.cpp - Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp - Modules/indexeddb/IDBDatabaseException.cpp - Modules/indexeddb/IDBEventDispatcher.cpp - Modules/indexeddb/IDBFactory.cpp - Modules/indexeddb/IDBFactoryBackendImpl.cpp - Modules/indexeddb/IDBFactoryBackendInterface.cpp - Modules/indexeddb/IDBIndex.cpp - Modules/indexeddb/IDBIndexBackendImpl.cpp - Modules/indexeddb/IDBKey.cpp - Modules/indexeddb/IDBKeyRange.cpp - Modules/indexeddb/IDBKeyPath.cpp - Modules/indexeddb/IDBKeyPathBackendImpl.cpp - Modules/indexeddb/IDBObjectStore.cpp - Modules/indexeddb/IDBObjectStoreBackendImpl.cpp - Modules/indexeddb/IDBPendingTransactionMonitor.cpp - Modules/indexeddb/IDBRequest.cpp - Modules/indexeddb/IDBTransaction.cpp - Modules/indexeddb/IDBTransactionBackendImpl.cpp - Modules/indexeddb/IDBTransactionCoordinator.cpp - Modules/indexeddb/IDBVersionChangeEvent.cpp - Modules/indexeddb/IDBVersionChangeRequest.cpp - Modules/indexeddb/PageGroupIndexedDatabase.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/indexeddb/DOMWindowIndexedDatabase.idl - Modules/indexeddb/IDBAny.idl - Modules/indexeddb/IDBCursor.idl - Modules/indexeddb/IDBCursorWithValue.idl - Modules/indexeddb/IDBDatabase.idl - Modules/indexeddb/IDBDatabaseException.idl - Modules/indexeddb/IDBFactory.idl - Modules/indexeddb/IDBIndex.idl - Modules/indexeddb/IDBKey.idl - Modules/indexeddb/IDBKeyRange.idl - Modules/indexeddb/IDBObjectStore.idl - Modules/indexeddb/IDBRequest.idl - Modules/indexeddb/IDBTransaction.idl - Modules/indexeddb/IDBVersionChangeEvent.idl - Modules/indexeddb/IDBVersionChangeRequest.idl - ) -ENDIF () - -IF (ENABLE_INDEXED_DATABASE AND ENABLE_WORKERS) - LIST(APPEND WebCore_SOURCES - Modules/indexeddb/WorkerContextIndexedDatabase.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/indexeddb/WorkerContextIndexedDatabase.idl - ) -ENDIF () - -IF (WTF_USE_LEVELDB) - LIST(APPEND WebCore_SOURCES - Modules/indexeddb/IDBLevelDBBackingStore.cpp - Modules/indexeddb/IDBLevelDBCoding.cpp - platform/leveldb/LevelDBDatabase.cpp - platform/leveldb/LevelDBTransaction.cpp - platform/leveldb/LevelDBWriteBatch.cpp - ) -ENDIF () - -IF (ENABLE_MATHML) - LIST(APPEND WebCore_SOURCES - mathml/MathMLElement.cpp - mathml/MathMLInlineContainerElement.cpp - mathml/MathMLMathElement.cpp - mathml/MathMLTextElement.cpp - rendering/mathml/RenderMathMLBlock.cpp - rendering/mathml/RenderMathMLFenced.cpp - rendering/mathml/RenderMathMLFraction.cpp - rendering/mathml/RenderMathMLMath.cpp - rendering/mathml/RenderMathMLOperator.cpp - rendering/mathml/RenderMathMLRoot.cpp - rendering/mathml/RenderMathMLRow.cpp - rendering/mathml/RenderMathMLSquareRoot.cpp - rendering/mathml/RenderMathMLSubSup.cpp - rendering/mathml/RenderMathMLUnderOver.cpp - ) -ENDIF () - IF (ENABLE_NETSCAPE_PLUGIN_API) LIST(APPEND WebCore_SOURCES plugins/PluginDebug.cpp @@ -1706,521 +2400,15 @@ IF (ENABLE_NETSCAPE_PLUGIN_API) ) ENDIF () -IF (ENABLE_NETWORK_INFO) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - ${WEBCORE_DIR}/Modules/networkinfo - ) - - LIST(APPEND WebCore_SOURCES - Modules/networkinfo/NavigatorNetworkInfoConnection.cpp - Modules/networkinfo/NetworkInfo.cpp - Modules/networkinfo/NetworkInfoConnection.cpp - Modules/networkinfo/NetworkInfoController.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/networkinfo/NavigatorNetworkInfoConnection.idl - Modules/networkinfo/NetworkInfoConnection.idl - ) -ENDIF () - -IF (ENABLE_NOTIFICATIONS) - LIST(APPEND WebCore_SOURCES - Modules/notifications/DOMWindowNotifications.cpp - Modules/notifications/NotificationCenter.cpp - Modules/notifications/NotificationController.cpp - Modules/notifications/Notification.cpp - Modules/notifications/WorkerContextNotifications.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/notifications/DOMWindowNotifications.idl - Modules/notifications/Notification.idl - Modules/notifications/NotificationCenter.idl - Modules/notifications/NotificationPermissionCallback.idl - Modules/notifications/WorkerContextNotifications.idl - ) -ENDIF () - -if (ENABLE_FILE_SYSTEM) - LIST(APPEND WebCore_SOURCES - Modules/filesystem/DOMFilePath.cpp - Modules/filesystem/DOMFileSystem.cpp - Modules/filesystem/DOMFileSystemBase.cpp - Modules/filesystem/DOMFileSystemSync.cpp - Modules/filesystem/DOMWindowFileSystem.cpp - Modules/filesystem/DirectoryEntry.cpp - Modules/filesystem/DirectoryEntrySync.cpp - Modules/filesystem/DirectoryReader.cpp - Modules/filesystem/DirectoryReaderSync.cpp - Modules/filesystem/Entry.cpp - Modules/filesystem/EntryArray.cpp - Modules/filesystem/EntryArraySync.cpp - Modules/filesystem/EntryBase.cpp - Modules/filesystem/EntrySync.cpp - Modules/filesystem/FileEntry.cpp - Modules/filesystem/FileEntrySync.cpp - Modules/filesystem/FileSystemCallbacks.cpp - Modules/filesystem/FileWriter.cpp - Modules/filesystem/FileWriterBase.cpp - Modules/filesystem/FileWriterSync.cpp - Modules/filesystem/LocalFileSystem.cpp - Modules/filesystem/WorkerContextFileSystem.cpp - platform/AsyncFileSystem.cpp - ) - LIST(APPEND WebCore_IDL_FILES - Modules/filesystem/DOMWindowFileSystem.idl - Modules/filesystem/DirectoryEntry.idl - Modules/filesystem/DirectoryEntrySync.idl - Modules/filesystem/DirectoryReader.idl - Modules/filesystem/DirectoryReaderSync.idl - Modules/filesystem/DOMFileSystem.idl - Modules/filesystem/DOMFileSystemSync.idl - Modules/filesystem/EntriesCallback.idl - Modules/filesystem/Entry.idl - Modules/filesystem/EntrySync.idl - Modules/filesystem/EntryArray.idl - Modules/filesystem/EntryArraySync.idl - Modules/filesystem/EntryCallback.idl - Modules/filesystem/ErrorCallback.idl - Modules/filesystem/FileCallback.idl - Modules/filesystem/FileEntry.idl - Modules/filesystem/FileEntrySync.idl - Modules/filesystem/FileSystemCallback.idl - Modules/filesystem/FileWriterCallback.idl - Modules/filesystem/FileWriter.idl - Modules/filesystem/FileWriterSync.idl - Modules/filesystem/Metadata.idl - Modules/filesystem/MetadataCallback.idl - Modules/filesystem/WorkerContextFileSystem.idl - ) -ENDIF () - IF (ENABLE_SVG) - LIST(APPEND WebCore_SOURCES - css/SVGCSSComputedStyleDeclaration.cpp - css/SVGCSSParser.cpp - css/SVGCSSStyleSelector.cpp - platform/graphics/SVGGlyph.cpp - rendering/PointerEventsHitRules.cpp - rendering/style/SVGRenderStyle.cpp - rendering/style/SVGRenderStyleDefs.cpp - rendering/svg/RenderSVGBlock.cpp - rendering/svg/RenderSVGContainer.cpp - rendering/svg/RenderSVGEllipse.cpp - rendering/svg/RenderSVGGradientStop.cpp - rendering/svg/RenderSVGForeignObject.cpp - rendering/svg/RenderSVGHiddenContainer.cpp - rendering/svg/RenderSVGImage.cpp - rendering/svg/RenderSVGInline.cpp - rendering/svg/RenderSVGInlineText.cpp - rendering/svg/RenderSVGModelObject.cpp - rendering/svg/RenderSVGPath.cpp - rendering/svg/RenderSVGRect.cpp - rendering/svg/RenderSVGResource.cpp - rendering/svg/RenderSVGResourceClipper.cpp - rendering/svg/RenderSVGResourceContainer.cpp - rendering/svg/RenderSVGResourceFilter.cpp - rendering/svg/RenderSVGResourceFilterPrimitive.cpp - rendering/svg/RenderSVGResourceGradient.cpp - rendering/svg/RenderSVGResourceLinearGradient.cpp - rendering/svg/RenderSVGResourceMarker.cpp - rendering/svg/RenderSVGResourceMasker.cpp - rendering/svg/RenderSVGResourcePattern.cpp - rendering/svg/RenderSVGResourceRadialGradient.cpp - rendering/svg/RenderSVGResourceSolidColor.cpp - rendering/svg/RenderSVGRoot.cpp - rendering/svg/RenderSVGShape.cpp - rendering/svg/RenderSVGTSpan.cpp - rendering/svg/RenderSVGText.cpp - rendering/svg/RenderSVGTextPath.cpp - rendering/svg/RenderSVGTransformableContainer.cpp - rendering/svg/RenderSVGViewportContainer.cpp - rendering/svg/SVGInlineFlowBox.cpp - rendering/svg/SVGInlineTextBox.cpp - rendering/svg/SVGPathData.cpp - rendering/svg/SVGRenderSupport.cpp - rendering/svg/SVGRenderTreeAsText.cpp - rendering/svg/SVGRenderingContext.cpp - rendering/svg/SVGResources.cpp - rendering/svg/SVGResourcesCache.cpp - rendering/svg/SVGResourcesCycleSolver.cpp - rendering/svg/SVGRootInlineBox.cpp - rendering/svg/SVGTextChunk.cpp - rendering/svg/SVGTextChunkBuilder.cpp - rendering/svg/SVGTextLayoutAttributes.cpp - rendering/svg/SVGTextLayoutAttributesBuilder.cpp - rendering/svg/SVGTextLayoutEngine.cpp - rendering/svg/SVGTextLayoutEngineBaseline.cpp - rendering/svg/SVGTextLayoutEngineSpacing.cpp - rendering/svg/SVGTextRunRenderingContext.cpp - rendering/svg/SVGTextMetrics.cpp - rendering/svg/SVGTextMetricsBuilder.cpp - rendering/svg/SVGTextQuery.cpp - svg/ColorDistance.cpp - svg/SVGAElement.cpp - svg/SVGAltGlyphDefElement.cpp - svg/SVGAltGlyphElement.cpp - svg/SVGAltGlyphItemElement.cpp - svg/SVGAngle.cpp - svg/SVGAnimateColorElement.cpp - svg/SVGAnimatedAngle.cpp - svg/SVGAnimatedBoolean.cpp - svg/SVGAnimatedColor.cpp - svg/SVGAnimatedEnumeration.cpp - svg/SVGAnimatedInteger.cpp - svg/SVGAnimatedIntegerOptionalInteger.cpp - svg/SVGAnimatedLength.cpp - svg/SVGAnimatedLengthList.cpp - svg/SVGAnimatedNumber.cpp - svg/SVGAnimatedNumberList.cpp - svg/SVGAnimatedNumberOptionalNumber.cpp - svg/SVGAnimatedPath.cpp - svg/SVGAnimatedPointList.cpp - svg/SVGAnimatedPreserveAspectRatio.cpp - svg/SVGAnimatedRect.cpp - svg/SVGAnimatedString.cpp - svg/SVGAnimatedTransformList.cpp - svg/SVGAnimatedType.cpp - svg/SVGAnimateElement.cpp - svg/SVGAnimateMotionElement.cpp - svg/SVGAnimateTransformElement.cpp - svg/SVGAnimationElement.cpp - svg/SVGCircleElement.cpp - svg/SVGClipPathElement.cpp - svg/SVGColor.cpp - svg/SVGComponentTransferFunctionElement.cpp - svg/SVGCursorElement.cpp - svg/SVGDefsElement.cpp - svg/SVGDescElement.cpp - svg/SVGDocument.cpp - svg/SVGDocumentExtensions.cpp - svg/SVGElement.cpp - svg/SVGElementInstance.cpp - svg/SVGElementInstanceList.cpp - svg/SVGEllipseElement.cpp - svg/SVGException.cpp - svg/SVGExternalResourcesRequired.cpp - svg/SVGFEBlendElement.cpp - svg/SVGFEColorMatrixElement.cpp - svg/SVGFEComponentTransferElement.cpp - svg/SVGFECompositeElement.cpp - svg/SVGFEConvolveMatrixElement.cpp - svg/SVGFEDiffuseLightingElement.cpp - svg/SVGFEDisplacementMapElement.cpp - svg/SVGFEDistantLightElement.cpp - svg/SVGFEDropShadowElement.cpp - svg/SVGFEFloodElement.cpp - svg/SVGFEFuncAElement.cpp - svg/SVGFEFuncBElement.cpp - svg/SVGFEFuncGElement.cpp - svg/SVGFEFuncRElement.cpp - svg/SVGFEGaussianBlurElement.cpp - svg/SVGFEImageElement.cpp - svg/SVGFELightElement.cpp - svg/SVGFEMergeElement.cpp - svg/SVGFEMergeNodeElement.cpp - svg/SVGFEMorphologyElement.cpp - svg/SVGFEOffsetElement.cpp - svg/SVGFEPointLightElement.cpp - svg/SVGFESpecularLightingElement.cpp - svg/SVGFESpotLightElement.cpp - svg/SVGFETileElement.cpp - svg/SVGFETurbulenceElement.cpp - svg/SVGFilterElement.cpp - svg/SVGFilterPrimitiveStandardAttributes.cpp - svg/SVGFitToViewBox.cpp - svg/SVGFontData.cpp - svg/SVGFontElement.cpp - svg/SVGFontFaceElement.cpp - svg/SVGFontFaceFormatElement.cpp - svg/SVGFontFaceNameElement.cpp - svg/SVGFontFaceSrcElement.cpp - svg/SVGFontFaceUriElement.cpp - svg/SVGForeignObjectElement.cpp - svg/SVGGElement.cpp - svg/SVGGlyphElement.cpp - svg/SVGGlyphRefElement.cpp - svg/SVGGradientElement.cpp - svg/SVGHKernElement.cpp - svg/SVGImageElement.cpp - svg/SVGImageLoader.cpp - svg/SVGLangSpace.cpp - svg/SVGLength.cpp - svg/SVGLengthContext.cpp - svg/SVGLengthList.cpp - svg/SVGLineElement.cpp - svg/SVGLinearGradientElement.cpp - svg/SVGLocatable.cpp - svg/SVGMPathElement.cpp - svg/SVGMarkerElement.cpp - svg/SVGMaskElement.cpp - svg/SVGMetadataElement.cpp - svg/SVGMissingGlyphElement.cpp - svg/SVGNumberList.cpp - svg/SVGPaint.cpp - svg/SVGParserUtilities.cpp - svg/SVGPathBlender.cpp - svg/SVGPathBuilder.cpp - svg/SVGPathByteStreamBuilder.cpp - svg/SVGPathByteStreamSource.cpp - svg/SVGPathElement.cpp - svg/SVGPathParser.cpp - svg/SVGPathSegList.cpp - svg/SVGPathSegListBuilder.cpp - svg/SVGPathSegListSource.cpp - svg/SVGPathStringBuilder.cpp - svg/SVGPathStringSource.cpp - svg/SVGPathTraversalStateBuilder.cpp - svg/SVGPathUtilities.cpp - svg/SVGPatternElement.cpp - svg/SVGPointList.cpp - svg/SVGPolyElement.cpp - svg/SVGPolygonElement.cpp - svg/SVGPolylineElement.cpp - svg/SVGPreserveAspectRatio.cpp - svg/SVGRadialGradientElement.cpp - svg/SVGRectElement.cpp - svg/SVGSVGElement.cpp - svg/SVGScriptElement.cpp - svg/SVGSetElement.cpp - svg/SVGStopElement.cpp - svg/SVGStringList.cpp - svg/SVGStylable.cpp - svg/SVGStyleElement.cpp - svg/SVGStyledElement.cpp - svg/SVGStyledLocatableElement.cpp - svg/SVGStyledTransformableElement.cpp - svg/SVGSwitchElement.cpp - svg/SVGSymbolElement.cpp - svg/SVGTRefElement.cpp - svg/SVGTSpanElement.cpp - svg/SVGTests.cpp - svg/SVGTextContentElement.cpp - svg/SVGTextElement.cpp - svg/SVGTextPathElement.cpp - svg/SVGTextPositioningElement.cpp - svg/SVGTitleElement.cpp - svg/SVGTransform.cpp - svg/SVGTransformDistance.cpp - svg/SVGTransformList.cpp - svg/SVGTransformable.cpp - svg/SVGURIReference.cpp - svg/SVGUseElement.cpp - svg/SVGViewElement.cpp - svg/SVGViewSpec.cpp - svg/SVGVKernElement.cpp - svg/SVGZoomAndPan.cpp - svg/SVGZoomEvent.cpp - svg/animation/SMILTime.cpp - svg/animation/SMILTimeContainer.cpp - svg/animation/SVGSMILElement.cpp - svg/graphics/SVGImage.cpp - svg/graphics/SVGImageCache.cpp - svg/graphics/filters/SVGFEImage.cpp - svg/graphics/filters/SVGFilter.cpp - svg/graphics/filters/SVGFilterBuilder.cpp - svg/properties/SVGAttributeToPropertyMap.cpp - svg/properties/SVGPathSegListPropertyTearOff.cpp - ) - - # FIXME: The BlackBerry port doesn't support generating DOM bindings from the SVG IDL files. - # For now, we explicitly demarcate the SVG IDL files so that the BlackBerry port can skip them - # during DOM binding generation. See <https://bugs.webkit.org/show_bug.cgi?id=72773>. - SET(SVG_IDL_FILES - svg/SVGAElement.idl - svg/SVGAltGlyphDefElement.idl - svg/SVGAltGlyphElement.idl - svg/SVGAltGlyphItemElement.idl - svg/SVGAngle.idl - svg/SVGAnimateColorElement.idl - svg/SVGAnimateMotionElement.idl - svg/SVGAnimateElement.idl - svg/SVGAnimateTransformElement.idl - svg/SVGAnimatedAngle.idl - svg/SVGAnimatedBoolean.idl - svg/SVGAnimatedEnumeration.idl - svg/SVGAnimatedInteger.idl - svg/SVGAnimatedLength.idl - svg/SVGAnimatedLengthList.idl - svg/SVGAnimatedNumber.idl - svg/SVGAnimatedNumberList.idl - svg/SVGAnimatedPreserveAspectRatio.idl - svg/SVGAnimatedRect.idl - svg/SVGAnimatedString.idl - svg/SVGAnimatedTransformList.idl - svg/SVGAnimationElement.idl - svg/SVGCircleElement.idl - svg/SVGClipPathElement.idl - svg/SVGColor.idl - svg/SVGComponentTransferFunctionElement.idl - svg/SVGCursorElement.idl - svg/SVGDefsElement.idl - svg/SVGDescElement.idl - svg/SVGDocument.idl - svg/SVGElement.idl - svg/SVGElementInstance.idl - svg/SVGElementInstanceList.idl - svg/SVGEllipseElement.idl - svg/SVGException.idl - svg/SVGFEBlendElement.idl - svg/SVGFEColorMatrixElement.idl - svg/SVGFEComponentTransferElement.idl - svg/SVGFECompositeElement.idl - svg/SVGFEConvolveMatrixElement.idl - svg/SVGFEDiffuseLightingElement.idl - svg/SVGFEDisplacementMapElement.idl - svg/SVGFEDistantLightElement.idl - svg/SVGFEDropShadowElement.idl - svg/SVGFEFloodElement.idl - svg/SVGFEFuncAElement.idl - svg/SVGFEFuncBElement.idl - svg/SVGFEFuncGElement.idl - svg/SVGFEFuncRElement.idl - svg/SVGFEGaussianBlurElement.idl - svg/SVGFEImageElement.idl - svg/SVGFEMergeElement.idl - svg/SVGFEMergeNodeElement.idl - svg/SVGFEMorphologyElement.idl - svg/SVGFEOffsetElement.idl - svg/SVGFEPointLightElement.idl - svg/SVGFESpecularLightingElement.idl - svg/SVGFESpotLightElement.idl - svg/SVGFETileElement.idl - svg/SVGFETurbulenceElement.idl - svg/SVGFilterElement.idl - svg/SVGFontElement.idl - svg/SVGFontFaceElement.idl - svg/SVGFontFaceFormatElement.idl - svg/SVGFontFaceNameElement.idl - svg/SVGFontFaceSrcElement.idl - svg/SVGFontFaceUriElement.idl - svg/SVGForeignObjectElement.idl - svg/SVGGElement.idl - svg/SVGGlyphElement.idl - svg/SVGGlyphRefElement.idl - svg/SVGGradientElement.idl - svg/SVGHKernElement.idl - svg/SVGImageElement.idl - svg/SVGLength.idl - svg/SVGLengthList.idl - svg/SVGLineElement.idl - svg/SVGLinearGradientElement.idl - svg/SVGMarkerElement.idl - svg/SVGMaskElement.idl - svg/SVGMatrix.idl - svg/SVGMetadataElement.idl - svg/SVGMissingGlyphElement.idl - svg/SVGMPathElement.idl - svg/SVGNumber.idl - svg/SVGNumberList.idl - svg/SVGPaint.idl - svg/SVGPathElement.idl - svg/SVGPathSeg.idl - svg/SVGPathSegArcAbs.idl - svg/SVGPathSegArcRel.idl - svg/SVGPathSegClosePath.idl - svg/SVGPathSegCurvetoCubicAbs.idl - svg/SVGPathSegCurvetoCubicRel.idl - svg/SVGPathSegCurvetoCubicSmoothAbs.idl - svg/SVGPathSegCurvetoCubicSmoothRel.idl - svg/SVGPathSegCurvetoQuadraticAbs.idl - svg/SVGPathSegCurvetoQuadraticRel.idl - svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl - svg/SVGPathSegCurvetoQuadraticSmoothRel.idl - svg/SVGPathSegLinetoAbs.idl - svg/SVGPathSegLinetoHorizontalAbs.idl - svg/SVGPathSegLinetoHorizontalRel.idl - svg/SVGPathSegLinetoRel.idl - svg/SVGPathSegLinetoVerticalAbs.idl - svg/SVGPathSegLinetoVerticalRel.idl - svg/SVGPathSegList.idl - svg/SVGPathSegMovetoAbs.idl - svg/SVGPathSegMovetoRel.idl - svg/SVGPatternElement.idl - svg/SVGPoint.idl - svg/SVGPointList.idl - svg/SVGPolygonElement.idl - svg/SVGPolylineElement.idl - svg/SVGPreserveAspectRatio.idl - svg/SVGRadialGradientElement.idl - svg/SVGRect.idl - svg/SVGRectElement.idl - svg/SVGRenderingIntent.idl - svg/SVGSVGElement.idl - svg/SVGScriptElement.idl - svg/SVGSetElement.idl - svg/SVGStopElement.idl - svg/SVGStringList.idl - svg/SVGStyleElement.idl - svg/SVGSwitchElement.idl - svg/SVGSymbolElement.idl - svg/SVGTRefElement.idl - svg/SVGTSpanElement.idl - svg/SVGTextContentElement.idl - svg/SVGTextElement.idl - svg/SVGTextPathElement.idl - svg/SVGTextPositioningElement.idl - svg/SVGTitleElement.idl - svg/SVGTransform.idl - svg/SVGTransformList.idl - svg/SVGUnitTypes.idl - svg/SVGUseElement.idl - svg/SVGViewElement.idl - svg/SVGViewSpec.idl - svg/SVGVKernElement.idl - svg/SVGZoomAndPan.idl - svg/SVGZoomEvent.idl - ) - - LIST(APPEND WebCore_IDL_FILES - ${SVG_IDL_FILES} - ) - LIST(APPEND WebCore_CSS_PROPERTY_NAMES ${WEBCORE_DIR}/css/SVGCSSPropertyNames.in ) - LIST(APPEND WebCore_CSS_VALUE_KEYWORDS ${WEBCORE_DIR}/css/SVGCSSValueKeywords.in ) ENDIF() -IF (ENABLE_VIDEO) - LIST(APPEND WebCore_SOURCES - html/HTMLAudioElement.cpp - html/HTMLMediaElement.cpp - html/HTMLSourceElement.cpp - html/HTMLVideoElement.cpp - html/MediaFragmentURIParser.cpp - html/TimeRanges.cpp - html/shadow/MediaControlElements.cpp - platform/graphics/MediaPlayer.cpp - rendering/RenderMedia.cpp - rendering/RenderVideo.cpp - ) -ENDIF() - -IF (ENABLE_WEB_SOCKETS) - LIST(APPEND WebCore_SOURCES - Modules/websockets/ThreadableWebSocketChannel.cpp - Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp - Modules/websockets/WebSocket.cpp - Modules/websockets/WebSocketChannel.cpp - Modules/websockets/WebSocketDeflater.cpp - Modules/websockets/WebSocketDeflateFramer.cpp - Modules/websockets/WebSocketExtensionDispatcher.cpp - Modules/websockets/WebSocketFrame.cpp - Modules/websockets/WebSocketHandshake.cpp - Modules/websockets/WebSocketHandshakeRequest.cpp - Modules/websockets/WebSocketHandshakeResponse.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - Modules/websockets/WebSocket.idl - ) -ENDIF () - IF (ENABLE_SMOOTH_SCROLLING) LIST(APPEND WebCore_SOURCES platform/ActivePlatformGestureAnimation.cpp @@ -2229,93 +2417,75 @@ IF (ENABLE_SMOOTH_SCROLLING) ) ENDIF () -IF (ENABLE_WEB_SOCKETS AND ENABLE_WORKERS) - LIST(APPEND WebCore_SOURCES - Modules/websockets/WorkerThreadableWebSocketChannel.cpp - ) -ENDIF () - -IF (ENABLE_WORKERS) - LIST(APPEND WebCore_SOURCES - loader/WorkerThreadableLoader.cpp - - page/WorkerNavigator.cpp - - workers/AbstractWorker.cpp - workers/DedicatedWorkerContext.cpp - workers/DedicatedWorkerThread.cpp - workers/Worker.cpp - workers/WorkerContext.cpp - workers/WorkerEventQueue.cpp - workers/WorkerLocation.cpp - workers/WorkerMessagingProxy.cpp - workers/WorkerRunLoop.cpp - workers/WorkerScriptLoader.cpp - workers/WorkerThread.cpp - ) - - LIST(APPEND WebCore_IDL_FILES - page/WorkerNavigator.idl - - workers/AbstractWorker.idl - workers/DedicatedWorkerContext.idl - workers/Worker.idl - workers/WorkerContext.idl - workers/WorkerLocation.idl - ) -ENDIF () +IF (ENABLE_WEBGL) + SET(WTF_USE_3D_GRAPHICS 1) + ADD_DEFINITIONS(-DWTF_USE_3D_GRAPHICS=1) -IF (ENABLE_SHARED_WORKERS) LIST(APPEND WebCore_SOURCES - workers/DefaultSharedWorkerRepository.cpp - workers/SharedWorker.cpp - workers/SharedWorkerContext.cpp - workers/SharedWorkerThread.cpp + html/canvas/OESStandardDerivatives.cpp + html/canvas/OESTextureFloat.cpp + html/canvas/OESVertexArrayObject.cpp + html/canvas/WebGLBuffer.cpp + html/canvas/WebGLCompressedTextureS3TC.cpp + html/canvas/WebGLContextAttributes.cpp + html/canvas/WebGLContextEvent.cpp + html/canvas/WebGLContextGroup.cpp + html/canvas/WebGLContextObject.cpp + html/canvas/WebGLDebugRendererInfo.cpp + html/canvas/WebGLDebugShaders.cpp + html/canvas/WebGLDepthTexture.cpp + html/canvas/WebGLFramebuffer.cpp + html/canvas/WebGLGetInfo.cpp + html/canvas/WebGLLoseContext.cpp + html/canvas/WebGLObject.cpp + html/canvas/WebGLProgram.cpp + html/canvas/WebGLRenderbuffer.cpp + html/canvas/WebGLRenderingContext.cpp + html/canvas/WebGLShader.cpp + html/canvas/WebGLShaderPrecisionFormat.cpp + html/canvas/WebGLSharedObject.cpp + html/canvas/WebGLTexture.cpp + html/canvas/WebGLUniformLocation.cpp + html/canvas/WebGLVertexArrayObjectOES.cpp + html/canvas/WebGLExtension.cpp + html/canvas/EXTTextureFilterAnisotropic.cpp + html/canvas/OESStandardDerivatives.cpp + html/canvas/OESTextureFloat.cpp + html/canvas/OESVertexArrayObject.cpp ) - LIST(APPEND WebCore_IDL_FILES - workers/SharedWorker.idl - workers/SharedWorkerContext.idl - ) -ENDIF () - -IF (ENABLE_VIDEO_TRACK) - LIST(APPEND WebCore_SOURCES - html/HTMLTrackElement.cpp - html/track/LoadableTextTrack.cpp - html/track/TextTrack.cpp - html/track/TextTrackCue.cpp - html/track/TextTrackCueList.cpp - html/track/TextTrackList.cpp - html/track/TrackBase.cpp - html/track/TrackEvent.cpp - html/track/WebVTTParser.cpp - html/track/WebVTTTokenizer.cpp - loader/TextTrackLoader.cpp - loader/cache/CachedTextTrack.cpp - ) -ENDIF() - -IF (ENABLE_PROGRESS_TAG) - LIST(APPEND WebCore_SOURCES - accessibility/AccessibilityProgressIndicator.cpp + html/canvas/EXTTextureFilterAnisotropic.idl + html/canvas/OESStandardDerivatives.idl + html/canvas/OESTextureFloat.idl + html/canvas/OESVertexArrayObject.idl + html/canvas/WebGLActiveInfo.idl + html/canvas/WebGLBuffer.idl + html/canvas/WebGLCompressedTextureS3TC.idl + html/canvas/WebGLContextAttributes.idl + html/canvas/WebGLContextEvent.idl + html/canvas/WebGLDebugRendererInfo.idl + html/canvas/WebGLDebugShaders.idl + html/canvas/WebGLDepthTexture.idl + html/canvas/WebGLFramebuffer.idl + html/canvas/WebGLLoseContext.idl + html/canvas/WebGLProgram.idl + html/canvas/WebGLRenderbuffer.idl + html/canvas/WebGLRenderingContext.idl + html/canvas/WebGLShader.idl + html/canvas/WebGLShaderPrecisionFormat.idl + html/canvas/WebGLTexture.idl + html/canvas/WebGLUniformLocation.idl + html/canvas/WebGLVertexArrayObjectOES.idl ) ENDIF () -IF (ENABLE_MHTML) - LIST(APPEND WebCore_SOURCES - loader/archive/mhtml/MHTMLArchive.cpp - loader/archive/mhtml/MHTMLParser.cpp - ) -ENDIF () - -IF (ENABLE_WEBGL) - #ANGLE +IF (WTF_USE_3D_GRAPHICS) LIST(APPEND WebCore_INCLUDE_DIRECTORIES ${OPENGL_INCLUDE_DIR} - ${THIRDPARTY_DIR}/ANGLE/src - #${THIRDPARTY_DIR}/ANGLE/include #Defined as SYSTEM include in order to have less priority than actual system headers - ${THIRDPARTY_DIR}/ANGLE/include/GLSLANG + "${THIRDPARTY_DIR}/ANGLE/src" + "${THIRDPARTY_DIR}/ANGLE/include" + "${THIRDPARTY_DIR}/ANGLE/include/GLSLANG" + "${WEBCORE_DIR}/platform/graphics/gpu" ) LIST(APPEND WebCore_LIBRARIES ${OPENGL_gl_LIBRARY} @@ -2413,64 +2583,10 @@ IF (ENABLE_WEBGL) ) LIST(APPEND WebCore_SOURCES - html/canvas/OESStandardDerivatives.cpp - html/canvas/OESTextureFloat.cpp - html/canvas/OESVertexArrayObject.cpp - html/canvas/WebGLBuffer.cpp - html/canvas/WebGLCompressedTextureS3TC.cpp - html/canvas/WebGLContextAttributes.cpp - html/canvas/WebGLContextEvent.cpp - html/canvas/WebGLContextGroup.cpp - html/canvas/WebGLContextObject.cpp - html/canvas/WebGLDebugRendererInfo.cpp - html/canvas/WebGLDebugShaders.cpp - html/canvas/WebGLDepthTexture.cpp - html/canvas/WebGLFramebuffer.cpp - html/canvas/WebGLGetInfo.cpp - html/canvas/WebGLLoseContext.cpp - html/canvas/WebGLObject.cpp - html/canvas/WebGLProgram.cpp - html/canvas/WebGLRenderbuffer.cpp - html/canvas/WebGLRenderingContext.cpp - html/canvas/WebGLShader.cpp - html/canvas/WebGLShaderPrecisionFormat.cpp - html/canvas/WebGLSharedObject.cpp - html/canvas/WebGLTexture.cpp - html/canvas/WebGLUniformLocation.cpp - html/canvas/WebGLVertexArrayObjectOES.cpp - html/canvas/WebGLExtension.cpp - html/canvas/EXTTextureFilterAnisotropic.cpp - html/canvas/OESStandardDerivatives.cpp - html/canvas/OESTextureFloat.cpp - html/canvas/OESVertexArrayObject.cpp platform/graphics/ANGLEWebKitBridge.cpp platform/graphics/GraphicsContext3D.cpp platform/graphics/gpu/DrawingBuffer.cpp ) - LIST(APPEND WebCore_IDL_FILES - html/canvas/EXTTextureFilterAnisotropic.idl - html/canvas/OESStandardDerivatives.idl - html/canvas/OESTextureFloat.idl - html/canvas/OESVertexArrayObject.idl - html/canvas/WebGLActiveInfo.idl - html/canvas/WebGLBuffer.idl - html/canvas/WebGLCompressedTextureS3TC.idl - html/canvas/WebGLContextAttributes.idl - html/canvas/WebGLContextEvent.idl - html/canvas/WebGLDebugRendererInfo.idl - html/canvas/WebGLDebugShaders.idl - html/canvas/WebGLDepthTexture.idl - html/canvas/WebGLFramebuffer.idl - html/canvas/WebGLLoseContext.idl - html/canvas/WebGLProgram.idl - html/canvas/WebGLRenderbuffer.idl - html/canvas/WebGLRenderingContext.idl - html/canvas/WebGLShader.idl - html/canvas/WebGLShaderPrecisionFormat.idl - html/canvas/WebGLTexture.idl - html/canvas/WebGLUniformLocation.idl - html/canvas/WebGLVertexArrayObjectOES.idl - ) ENDIF () IF (ENABLE_REQUEST_ANIMATION_FRAME) @@ -2514,199 +2630,6 @@ SET(WebCoreTestSupport_SOURCES testing/InternalSettings.cpp ) -IF (ENABLE_BATTERY_STATUS) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/Modules/battery" - ) - LIST(APPEND WebCore_IDL_FILES - Modules/battery/NavigatorBattery.idl - Modules/battery/BatteryManager.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/battery/NavigatorBattery.cpp - Modules/battery/BatteryController.cpp - Modules/battery/BatteryManager.cpp - Modules/battery/BatteryStatus.cpp - ) -ENDIF () - -IF (ENABLE_GAMEPAD) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/Modules/gamepad" - ) - LIST(APPEND WebCore_IDL_FILES - Modules/gamepad/Gamepad.idl - Modules/gamepad/GamepadList.idl - Modules/gamepad/NavigatorGamepad.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/gamepad/Gamepad.cpp - Modules/gamepad/GamepadList.cpp - Modules/gamepad/NavigatorGamepad.cpp - ) -ENDIF () - -IF (ENABLE_MEDIA_STREAM) - LIST(APPEND WebCore_INCLUDE_DIRECTORIES - ${WEBCORE_DIR}/Modules/mediastream - ${WEBCORE_DIR}/platform/mediastream - ) - LIST(APPEND WebCore_IDL_FILES - Modules/mediastream/DeprecatedPeerConnection.idl - Modules/mediastream/DOMWindowMediaStream.idl - Modules/mediastream/IceCallback.idl - Modules/mediastream/IceCandidate.idl - Modules/mediastream/LocalMediaStream.idl - Modules/mediastream/MediaStream.idl - Modules/mediastream/MediaStreamEvent.idl - Modules/mediastream/MediaStreamList.idl - Modules/mediastream/MediaStreamTrack.idl - Modules/mediastream/MediaStreamTrackEvent.idl - Modules/mediastream/MediaStreamTrackList.idl - Modules/mediastream/NavigatorMediaStream.idl - Modules/mediastream/NavigatorUserMediaError.idl - Modules/mediastream/NavigatorUserMediaErrorCallback.idl - Modules/mediastream/NavigatorUserMediaSuccessCallback.idl - Modules/mediastream/PeerConnection00.idl - Modules/mediastream/SessionDescription.idl - Modules/mediastream/SignalingCallback.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/mediastream/DeprecatedPeerConnection.cpp - Modules/mediastream/IceCandidate.cpp - Modules/mediastream/LocalMediaStream.cpp - Modules/mediastream/MediaStream.cpp - Modules/mediastream/MediaStreamEvent.cpp - Modules/mediastream/MediaStreamList.cpp - Modules/mediastream/MediaStreamRegistry.cpp - Modules/mediastream/MediaStreamTrack.cpp - Modules/mediastream/MediaStreamTrackEvent.cpp - Modules/mediastream/MediaStreamTrackList.cpp - Modules/mediastream/NavigatorMediaStream.cpp - Modules/mediastream/PeerConnection00.cpp - Modules/mediastream/SessionDescription.cpp - Modules/mediastream/UserMediaController.cpp - Modules/mediastream/UserMediaRequest.cpp - - platform/mediastream/IceCandidateDescriptor.cpp - platform/mediastream/IceOptions.cpp - platform/mediastream/MediaHints.cpp - platform/mediastream/MediaStreamCenter.cpp - platform/mediastream/PeerConnection00Handler.cpp - platform/mediastream/SessionDescriptionDescriptor.cpp - ) -ENDIF () - -IF (ENABLE_WEB_AUDIO) - LIST(APPEND WebCore_SOURCES - Modules/webaudio/AsyncAudioDecoder.cpp - Modules/webaudio/AudioBasicInspectorNode.cpp - Modules/webaudio/AudioBasicProcessorNode.cpp - Modules/webaudio/AudioBuffer.cpp - Modules/webaudio/AudioBufferSourceNode.cpp - Modules/webaudio/AudioChannelMerger.cpp - Modules/webaudio/AudioChannelSplitter.cpp - Modules/webaudio/AudioContext.cpp - Modules/webaudio/AudioDestinationNode.cpp - Modules/webaudio/AudioGainNode.cpp - Modules/webaudio/AudioListener.cpp - Modules/webaudio/AudioNode.cpp - Modules/webaudio/AudioNodeInput.cpp - Modules/webaudio/AudioNodeOutput.cpp - Modules/webaudio/AudioPannerNode.cpp - Modules/webaudio/AudioParam.cpp - Modules/webaudio/AudioParamTimeline.cpp - Modules/webaudio/AudioProcessingEvent.cpp - Modules/webaudio/AudioScheduledSourceNode.cpp - Modules/webaudio/AudioSummingJunction.cpp - Modules/webaudio/BiquadDSPKernel.cpp - Modules/webaudio/BiquadFilterNode.cpp - Modules/webaudio/BiquadProcessor.cpp - Modules/webaudio/ConvolverNode.cpp - Modules/webaudio/DefaultAudioDestinationNode.cpp - Modules/webaudio/DelayDSPKernel.cpp - Modules/webaudio/DelayNode.cpp - Modules/webaudio/DelayProcessor.cpp - Modules/webaudio/DynamicsCompressorNode.cpp - Modules/webaudio/JavaScriptAudioNode.cpp - Modules/webaudio/MediaElementAudioSourceNode.cpp - Modules/webaudio/OfflineAudioCompletionEvent.cpp - Modules/webaudio/OfflineAudioDestinationNode.cpp - Modules/webaudio/Oscillator.cpp - Modules/webaudio/RealtimeAnalyser.cpp - Modules/webaudio/RealtimeAnalyserNode.cpp - Modules/webaudio/WaveShaperDSPKernel.cpp - Modules/webaudio/WaveShaperNode.cpp - Modules/webaudio/WaveShaperProcessor.cpp - Modules/webaudio/WaveTable.cpp - - platform/audio/AudioBus.cpp - platform/audio/AudioChannel.cpp - platform/audio/AudioDSPKernelProcessor.cpp - platform/audio/AudioFIFO.cpp - platform/audio/AudioPullFIFO.cpp - platform/audio/AudioResampler.cpp - platform/audio/AudioResamplerKernel.cpp - platform/audio/AudioUtilities.cpp - platform/audio/Biquad.cpp - platform/audio/Cone.cpp - platform/audio/DirectConvolver.cpp - platform/audio/Distance.cpp - platform/audio/DynamicsCompressor.cpp - platform/audio/DynamicsCompressorKernel.cpp - platform/audio/EqualPowerPanner.cpp - platform/audio/FFTConvolver.cpp - platform/audio/FFTFrame.cpp - platform/audio/FFTFrameStub.cpp - platform/audio/HRTFDatabase.cpp - platform/audio/HRTFDatabaseLoader.cpp - platform/audio/HRTFElevation.cpp - platform/audio/HRTFKernel.cpp - platform/audio/HRTFPanner.cpp - platform/audio/MultiChannelResampler.cpp - platform/audio/Panner.cpp - platform/audio/ReverbAccumulationBuffer.cpp - platform/audio/ReverbConvolver.cpp - platform/audio/ReverbConvolverStage.cpp - platform/audio/Reverb.cpp - platform/audio/ReverbInputBuffer.cpp - platform/audio/SincResampler.cpp - platform/audio/VectorMath.cpp - platform/audio/ZeroPole.cpp - ) -ENDIF () - -IF (ENABLE_WEB_INTENTS) - LIST(APPEND WebCore_IDL_FILES - Modules/intents/DeliveredIntent.idl - Modules/intents/DOMWindowIntents.idl - Modules/intents/Intent.idl - Modules/intents/IntentResultCallback.idl - Modules/intents/NavigatorIntents.idl - ) - LIST(APPEND WebCore_SOURCES - Modules/intents/DeliveredIntent.cpp - Modules/intents/DOMWindowIntents.cpp - Modules/intents/Intent.cpp - Modules/intents/IntentRequest.cpp - Modules/intents/NavigatorIntents.cpp - ) -ENDIF () - -if (ENABLE_QUOTA) - LIST(APPEND WebCore_SOURCES - Modules/quota/DOMWindowQuota.cpp - Modules/quota/StorageInfo.cpp - ) - LIST(APPEND WebCore_IDL_FILES - Modules/quota/DOMWindowQuota.idl - Modules/quota/StorageInfo.idl - Modules/quota/StorageInfoErrorCallback.idl - Modules/quota/StorageInfoQuotaCallback.idl - Modules/quota/StorageInfoUsageCallback.idl - ) -ENDIF () - # Modules that the bindings generator scripts may use SET(SCRIPTS_RESOLVE_SUPPLEMENTAL ${WEBCORE_DIR}/bindings/scripts/IDLParser.pm diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 59922b16e..b14f60022 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,4329 @@ +2012-07-22 Kentaro Hara <haraken@chromium.org> + + [V8] CodeGeneratorV8.pm should support static attributes + https://bugs.webkit.org/show_bug.cgi?id=91764 + + Reviewed by Adam Barth. + + CodeGeneratorJS.pm already supports static attributes. + CodeGeneratorV8.pm should also support them. + + Tests: bindings/scripts/test/TestObj.idl + bindings/scripts/test/TestSupplemental.idl + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + + * bindings/scripts/test/TestObj.idl: Added defined(TESTING_V8). + * bindings/scripts/test/TestSupplemental.idl: Added test cases for static attributes in supplemental IDL files. + + * bindings/scripts/test/JS/JSTestInterface.cpp: Updated run-bindings-tests results. + (WebCore): + (WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr): + The generated code is wrong since CodeGeneratorJS.pm does not support static attributes for + supplemental IDL files. I will fix it in a follow-up patch. + (WebCore::jsTestInterfaceConstructorSupplementalStaticAttr): + (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr): + * bindings/scripts/test/JS/JSTestInterface.h: + (WebCore): + * bindings/scripts/test/V8/V8TestInterface.cpp: Updated run-bindings-tests results. + (WebCore::TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter): + (TestInterfaceV8Internal): + (WebCore::TestInterfaceV8Internal::supplementalStaticAttrAttrGetter): + (WebCore::TestInterfaceV8Internal::supplementalStaticAttrAttrSetter): + (WebCore): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::staticReadOnlyIntAttrAttrGetter): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::staticStringAttrAttrGetter): + (WebCore::TestObjV8Internal::staticStringAttrAttrSetter): + (WebCore): + +2012-07-22 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Missing *explicit* keyword in storage and workers. + https://bugs.webkit.org/show_bug.cgi?id=91934 + + Reviewed by Kentaro Hara. + + Some constructors missed to use *explicit* keyword. They need to be added + *explicit* keyword to contructor which has a parameter in order to avoid + implicit type conversion. + + No new tests. Convered by existing tests. + + * storage/StorageAreaImpl.h: + (StorageAreaImpl): + * storage/StorageMap.h: + (StorageMap): + * storage/StorageSyncManager.h: + (StorageSyncManager): + * storage/StorageTask.h: + (StorageTask): + * storage/StorageTracker.h: + (StorageTracker): + * workers/SharedWorker.h: + (SharedWorker): + * workers/Worker.h: + (Worker): + * workers/WorkerLocation.h: + (WebCore::WorkerLocation::WorkerLocation): + * workers/WorkerMessagingProxy.h: + (WorkerMessagingProxy): + +2012-07-23 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively + https://bugs.webkit.org/show_bug.cgi?id=91941 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.make: + * GNUmakefile.am: + * accessibility/AXObjectCache.cpp: + (WebCore::createFromRenderer): + * accessibility/AccessibilityProgressIndicator.cpp: + * accessibility/AccessibilityProgressIndicator.h: + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkOneSelector): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/html.css: + * html/HTMLMeterElement.cpp: + * html/HTMLMeterElement.h: + * html/HTMLMeterElement.idl: + * html/HTMLProgressElement.cpp: + * html/HTMLProgressElement.h: + * html/HTMLProgressElement.idl: + * html/HTMLTagNames.in: + * html/shadow/MeterShadowElement.cpp: + * html/shadow/MeterShadowElement.h: Wrap with #if ENABLE(METER_ELEMENT). + * html/shadow/ProgressShadowElement.cpp: + * html/shadow/ProgressShadowElement.h: Wrap with #if ENABLE(PROGRESS_ELEMENT). + * page/DOMWindow.idl: + * platform/efl/RenderThemeEfl.cpp: + (WebCore::RenderThemeEfl::paintThemePart): + (WebCore::RenderThemeEfl::edjeGroupFromFormType): + (WebCore): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/gtk/RenderThemeGtk.cpp: + (WebCore): + * platform/gtk/RenderThemeGtk.h: + (RenderThemeGtk): + * platform/gtk/RenderThemeGtk2.cpp: + (WebCore): + * platform/gtk/RenderThemeGtk3.cpp: + (WebCore): + * platform/qt/RenderThemeQt.cpp: + (WebCore): + * platform/qt/RenderThemeQt.h: + (WebCore): + (RenderThemeQt): + * platform/qt/RenderThemeQtMobile.cpp: + (WebCore): + * platform/qt/RenderThemeQtMobile.h: + (RenderThemeQtMobile): + * rendering/RenderMeter.cpp: + * rendering/RenderMeter.h: + * rendering/RenderObject.h: + (RenderObject): + * rendering/RenderProgress.cpp: + * rendering/RenderProgress.h: + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::adjustStyle): + (WebCore::RenderTheme::paint): + (WebCore::RenderTheme::paintBorderOnly): + (WebCore::RenderTheme::paintDecorations): + (WebCore): + * rendering/RenderTheme.h: + (WebCore): + (RenderTheme): + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore): + * rendering/RenderThemeChromiumLinux.h: + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore): + * rendering/RenderThemeChromiumSkia.h: + (RenderThemeChromiumSkia): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + * rendering/RenderThemeChromiumWin.h: + (RenderThemeChromiumWin): + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore): + +2012-07-22 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91928 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.make: + * GNUmakefile.am: + * html/HTMLDetailsElement.cpp: + * html/HTMLDetailsElement.idl: + * html/HTMLSummaryElement.cpp: + * html/HTMLTagNames.in: + * html/shadow/DetailsMarkerControl.cpp: + * rendering/RenderDetailsMarker.cpp: + * rendering/RenderDetailsMarker.h: + * rendering/RenderObject.h: + (RenderObject): + * rendering/RenderTreeAsText.cpp: + (WebCore::RenderTreeAsText::writeRenderObject): + +2012-07-21 Dan Bernstein <mitz@apple.com> + + <rdar://problem/11928576> SVG-as-image (constrained) intrinsic size calculation is wrong in vertical writing modes + https://bugs.webkit.org/show_bug.cgi?id=91918 + + Reviewed by Anders Carlsson. + + Test: svg/as-image/svg-intrinsic-size-rectangular-vertical.html + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): When there is a content + renderer, it returns a physical intrinsic size and aspect ratio. The code was already + accounting for this by taking the reciprocal of the aspect ratio in the vertical case. Made + it also transpose the size itself, turning it from physical to logical. Moved this code + after setting m_intrinsicSize, since that member variable is always physical. + +2012-07-21 Patrick Gansterer <paroga@webkit.org> + + Cleanup TextEncoding USE(XXX_UNICODE) macros + https://bugs.webkit.org/show_bug.cgi?id=91923 + + Reviewed by Andreas Kling. + + Replace PLATFORM(QT) with USE(QT4_UNICODE) and OS(WINCE) with USE(WINCE_UNICODE). + This gives us more flexibility in choosing the unicode backend for a port. + + * platform/text/TextEncoding.cpp: + (WebCore::TextEncoding::encode): + * platform/text/TextEncodingRegistry.cpp: + (WebCore::extendTextCodecMaps): + +2012-07-21 Patrick Gansterer <paroga@webkit.org> + + Remove unnecessary ICU header includes from SimpleFontDataWin.cpp + https://bugs.webkit.org/show_bug.cgi?id=91922 + + Reviewed by Kentaro Hara. + + This allows us to use SimpleFontDataWin with an other Unicode implementation too. + + * platform/graphics/win/SimpleFontDataWin.cpp: + +2012-07-21 Kwang Yul Seo <skyul@company100.net> + + A start tag whose tag name is "html" in the "in body" insertion mode is a parse error + https://bugs.webkit.org/show_bug.cgi?id=91916 + + Reviewed by Eric Seidel. + + According to the HTML5 spec, a start tag whose tag name is "html" in the "in body" + insertion mode is a parse error. + + Added HTMLTreeBuilder::processHtmlStartTagForInBody(AtomicHTMLToken&) to call parseError(token). + Removed "FIXME: parse error" from HTMLConstructionSite::insertHTMLHtmlStartTagInBody and + HTMLConstructionSite::insertHTMLBodyStartTagInBody because we already marked the call sites + of these two methods with parseError(token). + + No behavior change because parseError(token) is just a marker. + + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody): + (WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processStartTagForInBody): + (WebCore::HTMLTreeBuilder::processStartTag): + (WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody): + (WebCore): + (WebCore::HTMLTreeBuilder::processStartTagForInHead): + * html/parser/HTMLTreeBuilder.h: + +2012-07-20 Czene Tamás <tczene@inf.u-szeged.hu> + + double data type shoud be changed to float in ColorMatrix + https://bugs.webkit.org/show_bug.cgi?id=91499 + + Reviewed by Nikolas Zimmermann. + + * platform/graphics/filters/FEColorMatrix.cpp: + (WebCore::matrix): + (WebCore::saturate): + (WebCore::huerotate): + (WebCore::luminance): + (WebCore::effectType): + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Take current transformation matrix into account when + deciding on resize algorithm for drawPattern. + https://bugs.webkit.org/show_bug.cgi?id=90624 + + Reviewed by Adrienne Walker. + + Since the pattern shader uses both the current transformation matrix + and the pattern matrix when transforming pixels, we need to + do the same when computing the resampling mode. Also removed the + resampling hint code, added in r60658, since it appears to be dead + (caller was removed in r76379). + + Covered by existing tests, such as + fast/borders/border-image-scale-transform.html. + + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::computeResamplingMode): + Pass in the matrix to be used for computing the destination width and + height (for awesome resampling). Remove the image resampling hint code. + (WebCore::paintSkBitmap): + Pass in the CTM to computeResamplingMode(). + (WebCore::Image::drawPattern): + Concatenate the CTM and the pattern matrix, and pass that to + computeResamplingMode() and TransformDimensions(). Invert the + CTM's scale and apply it to the pattern transform, so their + concatenation gives identity scale. + * platform/graphics/skia/PlatformContextSkia.cpp: + * platform/graphics/skia/PlatformContextSkia.h: + Remove the image resampling hint (dead code). + +2012-07-20 Kwang Yul Seo <skyul@company100.net> + + Anything else in the "in table" insertion mode is a parse error + https://bugs.webkit.org/show_bug.cgi?id=91915 + + Reviewed by Adam Barth. + + According to the HTML5 spec, anything else in the "in table" insertion mode is a parse error. + + No behavior change because parseError(token) is just a marker. + + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processEndTagForInTable): + +2012-07-20 Kent Tamura <tkent@chromium.org> + + Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT + https://bugs.webkit.org/show_bug.cgi?id=91846 + + Reviewed by Kentaro Hara. + + A flag name for an elmement should be ENABLE_*_ELEMENT. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.make: + * GNUmakefile.am: + * css/html.css: + * html/HTMLDataListElement.cpp: + * html/HTMLDataListElement.h: + * html/HTMLDataListElement.idl: + * html/HTMLInputElement.cpp: + (WebCore): + (WebCore::HTMLInputElement::parseAttribute): + (WebCore::HTMLInputElement::insertedInto): + (WebCore::HTMLInputElement::removedFrom): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/HTMLInputElement.idl: + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::parseAttribute): + (WebCore::HTMLOptionElement::childrenChanged): + (WebCore): + * html/HTMLOptionElement.h: + (HTMLOptionElement): + * html/HTMLTagNames.in: + * html/InputType.cpp: + (WebCore): + * html/InputType.h: + (InputType): + * html/RangeInputType.cpp: + (WebCore): + * html/RangeInputType.h: + (RangeInputType): + * html/shadow/SliderThumbElement.cpp: + (WebCore::RenderSliderContainer::layout): + * page/DOMWindow.idl: + * platform/efl/RenderThemeEfl.cpp: + (WebCore): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/qt/RenderThemeQt.cpp: + (WebCore): + * platform/qt/RenderThemeQt.h: + (RenderThemeQt): + * rendering/RenderTheme.cpp: + (WebCore): + * rendering/RenderTheme.h: + (RenderTheme): + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore): + (WebCore::RenderThemeChromiumLinux::paintSliderTrack): + * rendering/RenderThemeChromiumLinux.h: + (RenderThemeChromiumLinux): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + * rendering/RenderThemeChromiumWin.h: + (RenderThemeChromiumWin): + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintSliderTrack): + (WebCore): + +2012-07-18 Ryosuke Niwa <rniwa@webkit.org> + + Unify HTMLCollection and DynamicNodeList + https://bugs.webkit.org/show_bug.cgi?id=91335 + + Reviewed by Anders Carlsson. + + This is the grand unification of HTMLCollection and DynamicNodeList. + + It merges implementations of item() and length() in ChildNodeList, DynamicNodeList, + and HTMLCollection. The unified implementation is based on the one used for HTMLCollection, + that has been improved over the last few days; see r122660 and r122672 for examples. + + There are five key changes: + 1. Made itemBeforeOrAfter aware of DynamicNodeList. + 2. itemBeforeOrAfter and related functions take and return Node* to support ChildNodeList. + 3. Renamed InvalidCollectionType to NodeListCollectionType since DynamicNodeLists need to be + identified itemBeforeOrAfter. + 4. Renamed itemAfter to virtualItemAfter in subclasses of HTMLCollection, and devirtualized + itemAfter used in common cases to avoid performance regressions. To make this intent clear, + SupportItemBefore and DoNotSupportItemBefore have been renamed to DoesNotOverrideItemAfter + and OverridesItemAfter. This change also help us detect a subclass of HTMLCollection that + passes in a wrong value to ItemBeforeSupportType by making forward iterations fail (hit an + assertion or doesn't iterate at all) as well as backward iterations. + 5. Restricted the use of elementsArrayOffset to subclasses that provide virtualItemAfter. + + This patch completes my effort to share code between HTMLCollection and DynamicNodeList. + + * dom/ChildNodeList.cpp: + (WebCore::ChildNodeList::ChildNodeList): + (WebCore): Removed length() and item(). + (WebCore::ChildNodeList::nodeMatches): + * dom/ChildNodeList.h: + (ChildNodeList): + * dom/ClassNodeList.cpp: + (WebCore::ClassNodeList::ClassNodeList): + * dom/Document.cpp: + (WebCore::Document::registerNodeListCache): + (WebCore::Document::unregisterNodeListCache): + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeListCacheBase::invalidateCache): + (WebCore::DynamicNodeList::length): + (WebCore::DynamicNodeList::item): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): Takes new boolean argument + shouldOnlyIncludeDirectChildren indicating whether the non-child descendents should be + included or not. This is necessary to identify ChildNodeList in itemBeforeOrAfter. + (WebCore::DynamicNodeListCacheBase::ownerNode): Moved from DynamicNodeListCacheBase and + HTMLCollectionCacheBase. + (WebCore::DynamicNodeListCacheBase::document): Moved from DynamicNodeListCacheBase. + (WebCore::DynamicNodeListCacheBase::rootNode): Ditto. + (WebCore::DynamicNodeListCacheBase::overridesItemAfter): Renamed from supportsItemBefore + and the return value has been negated. + (WebCore::DynamicNodeListCacheBase::shouldOnlyIncludeDirectChildren): Added. + (WebCore::DynamicNodeListCacheBase): + (WebCore::DynamicNodeList::DynamicNodeList): Takes NodeListType to determine the value of + shouldOnlyIncludeDirectChildren. + (DynamicNodeList): + (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList): + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): + * dom/MicroDataItemList.cpp: + (WebCore::MicroDataItemList::MicroDataItemList): + * dom/NameNodeList.cpp: + (WebCore::NameNodeList::NameNodeList): + * dom/TagNodeList.cpp: + (WebCore::TagNodeList::TagNodeList): + * html/CollectionType.h: + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::HTMLAllCollection): + * html/HTMLCollection.cpp: + (WebCore::shouldOnlyIncludeDirectChildren): + (WebCore::rootTypeFromCollectionType): + (WebCore::invalidationTypeExcludingIdAndNameAttributes): + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::create): + (WebCore::HTMLCollection::~HTMLCollection): + (WebCore::isAcceptableElement): + (WebCore::firstNode): Extracted from itemBeforeOrAfter. + (WebCore::DynamicNodeListCacheBase::iterateForNextNode): Ditto. + (WebCore::DynamicNodeListCacheBase::itemBeforeOrAfter): Takes and returns Node*. + Special case ChildNodeList since there is no need to skip any node. When "this" is a + node list, call nodeMatches instead of isAcceptableElement. + (WebCore::DynamicNodeListCacheBase::itemBefore): No longer takes offsetInArray since + the use of elementsArrayOffset has been restricted to HTMLCollections that provides + virtualItemAfter. + (WebCore::DynamicNodeListCacheBase::itemAfter): Calls virtualItemAfter if necessary. + Otherwise assert offsetInArray is zero since we should never be using this variable + when virtualItemAfter is not provided. + (WebCore::DynamicNodeListCacheBase::isLastItemCloserThanLastOrCachedItem): + (WebCore::DynamicNodeListCacheBase::isFirstItemCloserThanCachedItem): + (WebCore::DynamicNodeListCacheBase::setItemCache): Updates m_cachedElementsArrayOffset + in HTMLCollection if and only if virtualItemAfter is provided. This is safe because + node lists never provide virtualItemAfter. + (WebCore::DynamicNodeListCacheBase::cachedElementsArrayOffset): Similarly, returns + m_cachedElementsArrayOffset if virtualItemAfter is provided. + (WebCore::DynamicNodeListCacheBase::lengthCommon): + (WebCore::DynamicNodeListCacheBase::itemCommon): Note that supportsItemBefore() is + equivalent to !overridesItemAfter() here. + (WebCore::DynamicNodeListCacheBase::itemBeforeOrAfterCachedItem): Uses Node* through + out the function. Since itemBefore never uses offsetInArray, always sets 0 for that. + Note that we never call itemBefore and virtualItemAfter on the same object. + (WebCore::HTMLCollection::virtualItemAfter): Added only to make the class "concrete". + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::tags): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollectionCacheBase): + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::base): + (HTMLCollection): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::HTMLFormCollection): + (WebCore::HTMLFormCollection::virtualItemAfter): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::HTMLNameCollection): + (WebCore::HTMLNameCollection::virtualItemAfter): + * html/HTMLNameCollection.h: + (HTMLNameCollection): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::HTMLOptionsCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + (WebCore::HTMLPropertiesCollection::virtualItemAfter): + (WebCore::HTMLPropertiesCollection::updateNameCache): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): + (WebCore::HTMLTableRowsCollection::virtualItemAfter): + * html/HTMLTableRowsCollection.h: + (HTMLTableRowsCollection): + * html/LabelsNodeList.cpp: + (WebCore::LabelsNodeList::LabelsNodeList): + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): + +2012-07-20 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Simplify backend interface classes + https://bugs.webkit.org/show_bug.cgi?id=91901 + + Reviewed by Tony Chang. + + The IDBTransactionBackendInterface included several methods only used by the + real implementation objects, not via the interfaces. Expose a static Impl::from(Interface) + method for transaction, and migrate all of the backend-internal uses from Interface to Impl. + + No new tests - no functional changes. + + * Modules/indexeddb/IDBCursorBackendImpl.cpp: + (WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl): + * Modules/indexeddb/IDBCursorBackendImpl.h: + (WebCore): + (WebCore::IDBCursorBackendImpl::create): + (IDBCursorBackendImpl): + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::createObjectStore): + (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal): + (WebCore::IDBDatabaseBackendImpl::objectStore): + (WebCore::IDBDatabaseBackendImpl::deleteObjectStore): + (WebCore::IDBDatabaseBackendImpl::deleteObjectStoreInternal): + (WebCore::IDBDatabaseBackendImpl::setVersion): + (WebCore::IDBDatabaseBackendImpl::setVersionInternal): + (WebCore::IDBDatabaseBackendImpl::transactionStarted): + (WebCore::IDBDatabaseBackendImpl::transactionFinished): + (WebCore::IDBDatabaseBackendImpl::transaction): + * Modules/indexeddb/IDBDatabaseBackendImpl.h: + (WebCore): + (IDBDatabaseBackendImpl): + * Modules/indexeddb/IDBIndexBackendImpl.cpp: + (WebCore::IDBIndexBackendImpl::openCursorInternal): + (WebCore::IDBIndexBackendImpl::openCursor): + (WebCore::IDBIndexBackendImpl::openKeyCursor): + (WebCore::IDBIndexBackendImpl::countInternal): Drop unused transaction argument. + (WebCore::IDBIndexBackendImpl::count): + (WebCore::IDBIndexBackendImpl::get): + (WebCore::IDBIndexBackendImpl::getKey): + * Modules/indexeddb/IDBIndexBackendImpl.h: + (IDBIndexBackendImpl): + * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::get): + (WebCore::IDBObjectStoreBackendImpl::put): + (WebCore::IDBObjectStoreBackendImpl::putWithIndexKeys): + (WebCore): + (WebCore::IDBObjectStoreBackendImpl::putInternal): + (WebCore::IDBObjectStoreBackendImpl::deleteFunction): + (WebCore::IDBObjectStoreBackendImpl::clear): + (WebCore::IDBObjectStoreBackendImpl::createIndex): + (WebCore::IDBObjectStoreBackendImpl::createIndexInternal): + (WebCore::IDBObjectStoreBackendImpl::deleteIndex): + (WebCore::IDBObjectStoreBackendImpl::deleteIndexInternal): + (WebCore::IDBObjectStoreBackendImpl::openCursor): + (WebCore::IDBObjectStoreBackendImpl::openCursorInternal): + (WebCore::IDBObjectStoreBackendImpl::count): + (WebCore::IDBObjectStoreBackendImpl::countInternal): Drop unused transaction argument. + * Modules/indexeddb/IDBObjectStoreBackendImpl.h: + (WebCore): + (IDBObjectStoreBackendImpl): + * Modules/indexeddb/IDBTransactionBackendImpl.cpp: + (WebCore::IDBTransactionBackendImpl::objectStore): + * Modules/indexeddb/IDBTransactionBackendImpl.h: + (WebCore::IDBTransactionBackendImpl::from): + (IDBTransactionBackendImpl): + (WebCore::IDBTransactionBackendImpl::mode): + * Modules/indexeddb/IDBTransactionBackendInterface.h: + (IDBTransactionBackendInterface): + +2012-07-20 Joshua Bell <jsbell@chromium.org> + + IndexedDB: "ASSERTION FAILED: !m_requestFinished" hit in IDBRequest::dispatchEvent + https://bugs.webkit.org/show_bug.cgi?id=86911 + + Reviewed by Tony Chang. + + Clean up the IDBRequest/IDBCursor relationship and the IDBRequest lifecycle. + + The IDBRequest's m_cursor/setCursor() calls are renamed to m_pendingCursor/setPendingCursor() to + clarify that the request will move between two states - either there's a cursor request in-flight + c/o a continue() or advance() call, or the result has come in (cursor, null-for-done, or error). + Since they were only ever used together, resetReadyState() is merged into setResultCursor(). The + m_requestFinished flag becomes redundant and is dropped - the ASSERT reported in the bug + becomes an ASSERT(m_readyState == PENDING) and m_readyState tracking is already correct. + + Test: storage/indexeddb/request-continue-abort.html + + * Modules/indexeddb/IDBCursor.cpp: + (WebCore::IDBCursor::advance): Unreachable code path now dead and gone. + (WebCore::IDBCursor::continueFunction): Ditto. + * Modules/indexeddb/IDBRequest.cpp: Most functions just add state assertions. + (WebCore::IDBRequest::IDBRequest): + (WebCore::IDBRequest::abort): + (WebCore::IDBRequest::setCursorDetails): + (WebCore::IDBRequest::setPendingCursor): Merge with old resetReadyState(). + (WebCore): + (WebCore::IDBRequest::getResultCursor): Helper, since digging cursor out of IDBAny is pesky. + (WebCore::IDBRequest::setResultCursor): Just moved in the file to be with its friends. + (WebCore::IDBRequest::finishCursor): + (WebCore::IDBRequest::onError): Just assertions, re-ordering, re-naming. + (WebCore::IDBRequest::onSuccess): + (WebCore::IDBRequest::onSuccessWithContinuation): + (WebCore::IDBRequest::hasPendingActivity): + (WebCore::IDBRequest::dispatchEvent): Simplify! + (WebCore::IDBRequest::enqueueEvent): + * Modules/indexeddb/IDBRequest.h: + (IDBRequest): + +2012-07-20 Andrew Scherkus <scherkus@chromium.org> + + [chromium] Don't display fullscreen button for video elements not containing video + https://bugs.webkit.org/show_bug.cgi?id=91811 + + Reviewed by Eric Carlson. + + Covered by media/media-document-audio-repaint.html + + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::reset): + +2012-07-20 Dmitry Titov <dimich@chromium.org> + + [Chromium] Out of Memory is observed when a large object is passed to a Web Worker. + https://bugs.webkit.org/show_bug.cgi?id=91535. + + Reviewed by David Levin. + + No new tests because of no new behavior and lack of mechanism to monitor used memory. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::SerializedScriptValue): + (WebCore::SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext): + (WebCore): + (WebCore::SerializedScriptValue::~SerializedScriptValue): + * bindings/v8/SerializedScriptValue.h: + (SerializedScriptValue): + Added a method to SerializedScriptValue to add memory pressure on GC proportional to the size of memory allocated in serialized data. + + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + (WebCore::MessageEvent::initMessageEvent): + Call the new method of SerializedScriptValue during creation of MessageEvent (presumably in the thread which contains the right V8 context). + +2012-07-20 David Grogan <dgrogan@chromium.org> + + IndexedDB: Include intVersion when converting between WebCore and WebKit IDBMetadata types + https://bugs.webkit.org/show_bug.cgi?id=91414 + + Reviewed by Adam Barth. + + No new tests because no new behavior. + + * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: + (WebCore::IDBDatabaseBackendImpl::metadata): + No behavior change, this just needs a dummy parameter to match the + modified API. + + * Modules/indexeddb/IDBMetadata.h: + (WebCore::IDBDatabaseMetadata::IDBDatabaseMetadata): + (IDBDatabaseMetadata): + +2012-07-18 Gustavo Noronha Silva <gustavo.noronha@collabora.com> + + [Soup] Unnecessary RefPtr usage and null check + https://bugs.webkit.org/show_bug.cgi?id=91636 + + Reviewed by Martin Robinson. + + Small clean up of code that is not necessary; no change in functionality. + + * platform/network/soup/SocketStreamHandleSoup.cpp: + (WebCore::SocketStreamHandle::connected): + +2012-07-20 Mark Salisbury <mark.salisbury@hp.com> + + Typo in FontCacheWin.cpp causes return value from getCachedFontData() in getLastResortFallbackFont() to be ignored + https://bugs.webkit.org/show_bug.cgi?id=91506 + + Reviewed by Joseph Pecoraro. + + No new test. The "fallback fallback" code ends up creating a font, so you always + get a fallback font even with this code bug. A test would be buggy, being highly + platform dependent on what the "fallback fallback" font is on the particular + windows machine the test runs on. + + * platform/graphics/win/FontCacheWin.cpp: + (WebCore::FontCache::getLastResortFallbackFont): + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Clean up scratch texture usage in Chromium's implementation + of GPU-accelerated filters. + https://bugs.webkit.org/show_bug.cgi?id=83370 + + Reviewed by Adrienne Walker. + + There didn't used to be a safe way to allocate a scratch texture, and + hold into it beyond the lifetime of GrAutoScratchTexture. Now there is: + detach(). + + Covered by existing tests in css3/filters. + + * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: + (WebCore::CCRenderSurfaceFilters::apply): + Use a GrAutoScratchTexture to allocate the destination texture, and + detach() to detach it from the cache before placing it in an + SkGrTexturePixelRef. This means we no longer need to do any lock/ + unlock trickery with the TextureCacheEntry, since the refcount is + enough to keep the texture away from the cache's prying hands. + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Clean up scratch texture usage in Chromium's implementation + of GPU-accelerated filters. + https://bugs.webkit.org/show_bug.cgi?id=83370 + + Reviewed by Adrienne Walker. + + There didn't used to be a safe way to allocate a scratch texture, and + hold into it beyond the lifetime of GrAutoScratchTexture. Now there is: + detach(). + + Covered by existing tests in css3/filters. + + * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp: + (WebCore::CCRenderSurfaceFilters::apply): + Use a GrAutoScratchTexture to allocate the destination texture, and + detach() to detach it from the cache before placing it in an + SkGrTexturePixelRef. This means we no longer need to do any lock/ + unlock trickery with the TextureCacheEntry, since the refcount is + enough to keep the texture away from the cache's prying hands. + +2012-07-19 Andrew Scherkus <scherkus@chromium.org> + + [chromium] CSS tweaks to media controls to prevent styles from being overridden + https://bugs.webkit.org/show_bug.cgi?id=91802 + + Reviewed by Eric Carlson. + + Having the buttons declared as inline caused them to not be included in the box layout, + resulting in styles set outside the media element to affect the position of the buttons. + + In a similar vein, it was also possible to override the font-style attribute for the time + display. + + Test: media/controls-styling-strict.html + + * css/mediaControlsChromium.css: + (audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button): + (audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button): + (audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display): + (audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button): + +2012-07-20 Han Shen <shenhan@google.com> + + [Chromium] Compilation fails under gcc 4.7 + https://bugs.webkit.org/show_bug.cgi?id=90227 + + Reviewed by Tony Chang. + + Disable warnings about c++0x compatibility in gcc newer than 4.6. + + * WebCore.gyp/WebCore.gyp: + +2012-07-20 Vincent Scheib <scheib@chromium.org> + + Unreviewed compile fix, r123247 included unintended changes to Document.cpp. + + See http://trac.webkit.org/changeset/123247. + + * dom/Document.cpp: + (WebCore::Document::webkitExitPointerLock): + +2012-07-20 Ryosuke Niwa <rniwa@webkit.org> + + REGRESSION(r122873): 15% regression on Dromaeo/dom-attr + https://bugs.webkit.org/show_bug.cgi?id=91827 + + Reviewed by Anders Carlsson. + + Move shouldInvalidateNodeListCaches from Document.cpp to Node.cpp since it's only called + in Node::invalidateNodeListCachesInAncestors. + + Test: PerformanceTests/Dromaeo/dom-attr.html. + + * dom/Document.cpp: + (WebCore): + * dom/Node.cpp: + (WebCore::shouldInvalidateNodeListCachesForAttr): Extracted from shouldInvalidateNodeListCaches + to unroll the loop in shouldInvalidateNodeListCaches. Apparently gcc wasn't doing the right thing. + (WebCore::Document::shouldInvalidateNodeListCaches): + (WebCore::Document::invalidateNodeListCaches): + (WebCore::Node::invalidateNodeListCachesInAncestors): + +2012-07-20 Nico Weber <thakis@chromium.org> + + Fix more -Wunused-private-field violations + https://bugs.webkit.org/show_bug.cgi?id=91876 + + Reviewed by Adam Barth. + + As of http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120716/061102.html + the warning finds more bugs. Fix them. + + * html/FTPDirectoryDocument.cpp: + (FTPDirectoryDocumentParser): + (WebCore::FTPDirectoryDocumentParser::FTPDirectoryDocumentParser): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + * html/parser/HTMLTreeBuilder.h: + (HTMLTreeBuilder): + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::MediaControlRootElementChromium): + * html/shadow/MediaControlRootElementChromium.h: + (MediaControlRootElementChromium): + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource): + * inspector/InspectorDOMStorageResource.h: + (InspectorDOMStorageResource): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::CCThreadProxy): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + * rendering/svg/RenderSVGTextPath.cpp: + (WebCore::RenderSVGTextPath::RenderSVGTextPath): + * rendering/svg/RenderSVGTextPath.h: + +2012-07-20 Adam Klein <adamk@chromium.org> + + CodeGeneratorInspector.py is unnecessarily chatty + https://bugs.webkit.org/show_bug.cgi?id=91758 + + Reviewed by Vsevolod Vlasov. + + The code aded in r123091 included a "print" statement for each written + file. This makes for noisy build output, especially noticeable in the + Chromium ninja build (where build output takes up a single line of the + console). + + If this print statement is generally useful, it should be + hidden behind a --verbose commandline option, as we do for the binding + generators. + + * inspector/CodeGeneratorInspector.py: + (SmartOutput.close): Remove print statement. + +2012-07-20 Stephen White <senorblanco@chromium.org> + + [chromium] Enable GPU-accelerated skia implementation of + feDiffuseLighting, feSpecularLighting. + https://bugs.webkit.org/show_bug.cgi?id=91865 + + Reviewed by Dirk Schulze. + + Translate the light parameters into the appropriate + SkLightingImageFilter calls. This path is only enabled when + the filters are created with the Accelerated flag set. + + This will be covered by tests in svg/filters/* when they are + added to the virtual GPU tests. + + * WebCore.gypi: + * platform/graphics/filters/FELighting.h: + (FELighting): + * platform/graphics/filters/skia/FELightingSkia.cpp: Added. + (WebCore): + (WebCore::FELighting::platformApplySkia): + +2012-07-20 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: disable fake workers inspection. + https://bugs.webkit.org/show_bug.cgi?id=91867 + + Reviewed by Vsevolod Vlasov. + + 'Fake workers' is unreliable error-prone way to debug workers. There are a + lot of frameworks supporting it. Inspector should not do that since it has a more + powerful native worker inspection capabilities. Port owners should enable it + in case they want to provide workers debugging. + + * English.lproj/localizedStrings.js: + * WebCore.gypi: + * WebCore.order: + * WebCore.vcproj/WebCore.vcproj: + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::InjectedScriptHost): + * inspector/InjectedScriptHost.h: + (InjectedScriptHost): + * inspector/InjectedScriptHost.idl: + * inspector/Inspector.json: + * inspector/InspectorAgent.cpp: + (WebCore::InspectorAgent::didCommitLoad): + (WebCore::InspectorAgent::enable): + * inspector/InspectorAgent.h: + (WebCore): + (InspectorAgent): + * inspector/InspectorInstrumentation.cpp: + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + * inspector/front-end/InjectedFakeWorker.js: Removed. + * inspector/front-end/ScriptsPanel.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/WorkersSidebarPane.js: + (WebInspector.WorkersSidebarPane): + * inspector/front-end/externs.js: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + * workers/AbstractWorker.cpp: + (WebCore::AbstractWorker::contextDestroyed): + * workers/AbstractWorker.h: + (AbstractWorker): + * workers/SharedWorker.cpp: + (WebCore::SharedWorker::create): + * workers/Worker.cpp: + (WebCore::Worker::create): + +2012-07-20 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123182. + http://trac.webkit.org/changeset/123182 + https://bugs.webkit.org/show_bug.cgi?id=91863 + + Causing ASSERT crashes in tests accessibility/canvas.html and + accessibility/canvas-accessibilitynodeobject.html (Requested + by jernoble on #webkit). + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * accessibility/AXObjectCache.cpp: + (WebCore): + * accessibility/AXObjectCache.h: + (AXObjectCache): + * accessibility/AccessibilityARIAGrid.cpp: + (WebCore::AccessibilityARIAGrid::AccessibilityARIAGrid): + (WebCore::AccessibilityARIAGrid::~AccessibilityARIAGrid): + (WebCore): + (WebCore::AccessibilityARIAGrid::create): + * accessibility/AccessibilityARIAGrid.h: + (AccessibilityARIAGrid): + * accessibility/AccessibilityARIAGridCell.cpp: + (WebCore::AccessibilityARIAGridCell::create): + * accessibility/AccessibilityARIAGridRow.cpp: + (WebCore::AccessibilityARIAGridRow::create): + * accessibility/AccessibilityAllInOne.cpp: + * accessibility/AccessibilityList.cpp: + (WebCore::AccessibilityList::create): + * accessibility/AccessibilityListBox.cpp: + (WebCore::AccessibilityListBox::create): + * accessibility/AccessibilityMediaControls.cpp: + (WebCore::AccessibilityMediaControl::create): + (WebCore::AccessibilityMediaControlsContainer::create): + (WebCore::AccessibilityMediaTimeline::create): + (WebCore::AccessibilityMediaTimeDisplay::create): + * accessibility/AccessibilityMenuList.cpp: + * accessibility/AccessibilityMenuList.h: + (WebCore::AccessibilityMenuList::create): + * accessibility/AccessibilityNodeObject.cpp: Removed. + * accessibility/AccessibilityNodeObject.h: Removed. + * accessibility/AccessibilityObject.h: + (AccessibilityObject): + * accessibility/AccessibilityProgressIndicator.cpp: + (WebCore::AccessibilityProgressIndicator::create): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::AccessibilityRenderObject): + (WebCore::AccessibilityRenderObject::create): + (WebCore::AccessibilityRenderObject::detach): + (WebCore::AccessibilityRenderObject::remapAriaRoleDueToParent): + (WebCore): + (WebCore::AccessibilityRenderObject::determineAriaRoleAttribute): + (WebCore::AccessibilityRenderObject::ariaRoleAttribute): + (WebCore::AccessibilityRenderObject::updateAccessibilityRole): + (WebCore::AccessibilityRenderObject::canSetFocusAttribute): + (WebCore::AccessibilityRenderObject::childrenChanged): + (WebCore::AccessibilityRenderObject::canHaveChildren): + (WebCore::AccessibilityRenderObject::addChildren): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + (WebCore::AccessibilityRenderObject::setRenderer): + * accessibility/AccessibilitySlider.cpp: + (WebCore::AccessibilitySlider::create): + * accessibility/AccessibilityTable.cpp: + (WebCore::AccessibilityTable::AccessibilityTable): + (WebCore::AccessibilityTable::~AccessibilityTable): + (WebCore): + (WebCore::AccessibilityTable::create): + * accessibility/AccessibilityTable.h: + (AccessibilityTable): + * accessibility/AccessibilityTableCell.cpp: + (WebCore::AccessibilityTableCell::create): + * accessibility/AccessibilityTableRow.cpp: + (WebCore::AccessibilityTableRow::create): + +2012-07-20 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Proxy configuration should honor the no_proxy environment variable + https://bugs.webkit.org/show_bug.cgi?id=91747 + + Reviewed by Kenneth Rohde Christiansen. + + Implement a custom Proxy URI Resolver for libsoup + so that we can use it in EFL port. This custom + proxy resolver brings support for setting + exceptions so that the proxy is not used for the + specified hosts. + + By default, the proxy is not used for localhost and + 127.0.0.1. + + No new tests, no behavior change for layout tests. + + * PlatformEfl.cmake: + * platform/network/soup/ProxyResolverSoup.cpp: Added. + (soup_proxy_resolver_wk_init): + (soupProxyResolverWkFinalize): + (soupProxyResolverWkSetProperty): + (soupProxyResolverWkGetProperty): + (shouldBypassProxy): + (idle_return_proxy_uri): + (soupProxyResolverWkGetProxyURIAsync): + (soupProxyResolverWkGetProxyURISync): + (soup_proxy_resolver_wk_class_init): + (soup_proxy_resolver_wk_interface_init): + (soupProxyResolverWkNew): + * platform/network/soup/ProxyResolverSoup.h: Added. + +2012-07-20 Pierre Rossi <pierre.rossi@gmail.com> + + ColorChooserClient should expose the element's location + https://bugs.webkit.org/show_bug.cgi?id=91767 + + Reviewed by Kent Tamura. + + The rationale is that the chrome client could have an interest in placing the picker next to + the element for usability reasons. + + No new tests as there is not much logic here: Just exposing a geometry information to WebKit. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::elementRectRelativeToWindow): + (WebCore): + * html/ColorInputType.h: + (ColorInputType): + * platform/ColorChooserClient.h: + (ColorChooserClient): + +2012-07-20 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [WK2] WebIntents doesn't build if mutation observers is disabled + https://bugs.webkit.org/show_bug.cgi?id=91839 + + Reviewed by Kenneth Rohde Christiansen. + + WebIntents was depending on a code protected by ENABLE(MUTATION_OBSERVERS). + Now the code is also enabled by ENABLE(WEB_INTENTS). + + * bindings/js/JSDictionary.cpp: + (WebCore): + * bindings/js/JSDictionary.h: + +2012-07-20 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions]Assert failure when layout positioned objects in regions + https://bugs.webkit.org/show_bug.cgi?id=90792 + + Reviewed by Andreas Kling. + + Before clamping the containing block (for an out-of-flow positioned element + inside a named flow) to the region, we have to test whether the region is not + null, which can happen when the named flow does not have attached regions. + + Tests: fast/regions/positioned-vrl-in-named-flow.html + fast/regions/positioned-vrl-in-parent-named-flow.html + fast/regions/positioned-with-vrl-parent-in-named-flow.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::containingBlockLogicalWidthForPositioned): + (WebCore::RenderBox::computePositionedLogicalWidth): + (WebCore::RenderBox::computePositionedLogicalHeight): + +2012-07-20 Stephen Chenney <schenney@chromium.org> + + SVG Filter Effect sub-region not applied for some filters + https://bugs.webkit.org/show_bug.cgi?id=89767 + + Reviewed by Dirk Schulze. + + The filter effect region for SVG feGaussian and feDropShadow filters + was incorrectly set, failing to account for the radius of the blur. + This patch fixes the problem and removes an unneccessary clip + operation when the filter result is blitted into the target. That clip + was clipping the shadow from webkit-shadow. + + Tests: svg/filters/feDropShadow-subregion.svg + svg/filters/feGaussianBlur-subregion.svg + + * platform/graphics/filters/FEDropShadow.cpp: + (WebCore::FEDropShadow::determineAbsolutePaintRect): Moved the code + that clips the paint rect by the filter effect subregion to come after + the paint is modified by the filter radius. + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::FEGaussianBlur::determineAbsolutePaintRect): + Moved the code that clips the paint rect by the filter effect subregion to + come after the paint is modified by the filter radius. + * rendering/svg/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::postApplyResource): + Removed a clip that is unnecessary and that was incorrectly clipping drop shadows. + +2012-07-19 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: Status bar icons are misaligned by 1px to the right + https://bugs.webkit.org/show_bug.cgi?id=91757 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/inspector.css: + (.glyph): + (.glyph.shadow): + +2012-07-20 Andrei Poenaru <poenaru@adobe.com> + + Web Inspector: Protocol Extension: add getNamedFlowCollection command + https://bugs.webkit.org/show_bug.cgi?id=91607 + + Reviewed by Pavel Feldman. + + Extended the protocol with "getNamedFlowCollection" command. + This command returns the CSS Named Flows from the document. + + Test: inspector/styles/protocol-getNamedFlowCollection-command.html + + * dom/WebKitNamedFlowCollection.cpp: + (WebCore::WebKitNamedFlowCollection::namedFlowsNames): + (WebCore): + * dom/WebKitNamedFlowCollection.h: + (WebKitNamedFlowCollection): + * inspector/Inspector.json: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::getNamedFlowCollection): + (WebCore): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::assertDocument): + (WebCore): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync): + +2012-07-20 Eugene Klyuchnikov <eustas.big@gmail.com> + + Web Inspector: Timeline: forward compatibility for load. + https://bugs.webkit.org/show_bug.cgi?id=91714 + + Reviewed by Pavel Feldman. + + Accept records of unrecognized types and render them as "unknown". + + Test: inspector/timeline/timeline-load-incompatible.html + + * English.lproj/localizedStrings.js: Added UI string. + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.recordStyle): Add missing record + styles at runtime. + (WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails): + Add some common information for default case. + +2012-07-20 MORITA Hajime <morrita@google.com> + + Another unreviewed Mac build fix against r123184. + + * WebCore.exp.in: + +2012-07-20 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions]Crash when flowing a region into itself + https://bugs.webkit.org/show_bug.cgi?id=90289 + + Reviewed by Andreas Kling. + + If a region is designed to receive itself as content through a named flow, we avoid + a circular dependency by not attaching the region to the desired named flow. + In such occasions, the region's attached flow thread object is null and + we have to check this pointer before using it in RenderRegion::styleDidChange. + + Test: fast/regions/flow-region-into-itself-crash.html + + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::styleDidChange): + +2012-07-20 MORITA Hajime <morrita@google.com> + + Unreviewed Mac build fix against r123184. + + * WebCore.exp.in: + +2012-07-17 Kinuko Yasuda <kinuko@chromium.org> + + If value for responseType defined as type that not supported, it should not throw an exception in XHR 2 + https://bugs.webkit.org/show_bug.cgi?id=90976 + + Reviewed by Alexey Proskuryakov. + + http://www.w3.org/TR/XMLHttpRequest2/#the-responsetype-attribute + The spec does not say it should throw an exception when a non-supported + type is set, and other browsers do not throw it either. + + Test: fast/xmlhttprequest/xmlhttprequest-responsetype-set-type.html + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::setResponseType): Stop throwing an exception when non-supported type is given. + +2012-07-20 Matt Falkenhagen <falken@chromium.org> + + Show or hide <dialog> depending on the open attribute + https://bugs.webkit.org/show_bug.cgi?id=90931 + + Reviewed by Kent Tamura. + + Test: fast/dom/HTMLDialogElement/dialog-open.html + + * css/html.css: Add CSS for dialog. This is copied verbatim from the HTML5 spec: http://www.whatwg.org/specs/web-apps/current-work/#flow-content-1 + (dialog:not([open])): + (dialog): + * html/HTMLDialogElement.cpp: + (WebCore::HTMLDialogElement::close): Set open to false, to hide the dialog. + (WebCore::HTMLDialogElement::show): Set open to true, to show the dialog. + (WebCore): + (WebCore::HTMLDialogElement::isPresentationAttribute): Make openAttr a presentation attribute, to work around bug 91058 + * html/HTMLDialogElement.h: + (HTMLDialogElement): + * html/HTMLDialogElement.idl: + +2012-07-20 Shinya Kawanaka <shinyak@chromium.org> + + Needs pseudo id to point the inner element of an img elemnet for styling + https://bugs.webkit.org/show_bug.cgi?id=91590 + + Reviewed by Hajime Morita. + + We introduce pseudo id to point the element in UserAgentShadowDOM. + This enables us to style the inner element of an img element shadow. + Please see also http://trac.webkit.org/wiki/ShadowDOMForReplacedElements + + Test: fast/dom/shadow/shadowdom-for-image-with-pseudo-id.html + + * html/shadow/ImageInnerElement.cpp: + (WebCore::ImageInnerElement::shadowPseudoId): + (WebCore): + * html/shadow/ImageInnerElement.h: + (ImageInnerElement): + +2012-07-20 Kent Tamura <tkent@chromium.org> + + REGRESSION(r121420): Performance regression of form state saving for pages with multiple forms + https://bugs.webkit.org/show_bug.cgi?id=91804 + + Reviewed by Hajime Morita. + + The complexity of FormKeyGenerator::formKey() was O(N) where N is the + number of form elements with an identical action URL, and formKey() is + called for every form. So, it's O(N^2). A page in www.reddit.com + contains hundreds of form elements with action="#". So FormController:: + formElementsState() took a few seconds on a slow machine. + + In order to avoid O(N^2) operation, storing a map from form signatures + to next index numbers, instead of storing existing formKey strings. + + No new tests. Just a performance improvement. + + * html/FormController.cpp: + (FormKeyGenerator): Remove m_existingKeys. Add a map from a form + signature string to the next index number. + (WebCore::formSignature): Returns a signature string for a form, without + an index number. This is like "actionURL [name1 name2 ]" + (WebCore::FormKeyGenerator::formKey): + Creates a formKey string by concatenating a formSignature and #n. N is + obtained from m_formSignatureToNextIndexMap in O(1). + (WebCore::FormKeyGenerator::willDeleteForm): + Remove the code for m_existingKeys. + +2012-07-20 Keishi Hattori <keishi@webkit.org> + + Fix crash in WebCore::HTMLInputElement::dataList + https://bugs.webkit.org/show_bug.cgi?id=91818 + + Reviewed by Kent Tamura. + + Fix crash that occurs when setting slider appearance on a regular node. + + Test: fast/forms/range/slider-appearance-crash.html + + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paintSliderTicks): Check if node is an input element. + +2012-07-20 Kent Tamura <tkent@chromium.org> + + [Chromium] Fix an assertion failure in TextFieldDecorationElement::hostInput() + https://bugs.webkit.org/show_bug.cgi?id=91824 + + Reviewed by Hajime Morita. + + No new tests. This code is used only in Chromium browser. + + * html/shadow/TextFieldDecorationElement.cpp: + (WebCore::TextFieldDecorationElement::hostInput): + Use shadowHost(), and allow to return 0. + (WebCore::TextFieldDecorationElement::defaultEventHandler): + Check 0. + +2012-07-19 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Compile WebCore without QtWidgets + https://bugs.webkit.org/show_bug.cgi?id=91819 + + Reviewed by Kenneth Rohde Christiansen. + + * WebCore.pri: QT += opengl is not needed for Qt 5, given that QtGui has OpenGL + support built in with the QOpenGL* classes. + +2012-07-19 MORITA Hajime <morrita@google.com> + + [Refactoring] Replace Node's Document pointer with a TreeScope pointer + https://bugs.webkit.org/show_bug.cgi?id=59816 + + Reviewed by Ryosuke Niwa. + + Before this change, Node::treeScope() fetches the TreeScope object + from ElementRareData. This approach has several shortcomings: + + - rareData() call is slow due to a hashtable lookup. + - In shadow tree, each node has its tree scope in ElementRareData, + that means the rare-data is no longer rare in that case. + + This change gets rid of ElementRareData::m_treeScope by replacing + Node::m_document with Node::m_treeScope. And retrieves the + document of Node through m_treeScope. + + Note that Node::document() is a hot function and naive + replacemennt of m_document with m_treeScope can hurt the + speed. This change employs some tricks to address it. + + - This change introduces Node::InShadowTree flag, if the flag is off, + that means m_treeScope is actually a document an can be returned as the result. + this eliminates an extract dereference. + - Node::m_treeScope can be null. But we don't want to issue any extra + conditional statement. So this change represents a null + TreeScope as TreeScope::nullInstance(), which saves one conditional + statement. + + With these changes, the Node::document() slowdown is minimized to + unnoticeable size. + + No new tests. Covered by existing tests. + + * dom/Document.cpp: Took care of connectio betwen TreeScope. + (WebCore::Document::Document): + (WebCore::Document::~Document): + (WebCore::Document::suggestedMIMEType): + * dom/Document.h: + (WebCore::Node::treeScope): Now just return m_treeScope, taking care of nullInstance() case. + (WebCore): + (WebCore::Node::setTreeScope): Now just sets m_treeScope. + (WebCore::Node::documentInternal): Extracted from document() to have ASSERT-free version. + (WebCore::Node::document): Re-implemented over treeScope() and the flag. + (WebCore::Node::isDocumentNode): Re-implemented using treeScope() + (WebCore::Node::Node): + * dom/Node.cpp: + (WebCore::Node::~Node): + (WebCore::Node::reportMemoryUsage): + * dom/Node.h: + (Node): + (WebCore::Node::inDocument): + (WebCore::Node::isInShadowTree): Rewrote to use InShadowTree flag. + * dom/NodeRareData.h: + (WebCore::NodeRareData::NodeRareData): Eliminated m_treeScope. + (NodeRareData): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::ShadowRoot): + * dom/TreeScope.cpp: + (WebCore::TreeScope::TreeScope): + (WebCore): + (WebCore::TreeScope::setParentTreeScope): Added. + (WebCore::TreeScope::isDocumentScope): Added. + (WebCore::TreeScope::nullInstance): Added. + * dom/TreeScope.h: Added m_parentTreeScope. + (WebCore): + (WebCore::TreeScope::rootDocument): Added. + (TreeScope): + * dom/TreeScopeAdopter.cpp: No longer calls setDocument() + (WebCore::TreeScopeAdopter::moveTreeToNewScope): + (WebCore::TreeScopeAdopter::moveNodeToNewDocument): + * editing/MoveSelectionCommand.cpp: Includes Document.h to find inlined Node functions + * editing/RemoveNodeCommand.cpp: Includes Document.h to find inlined Node functions + * editing/RemoveNodePreservingChildrenCommand.cpp: Includes Document.h to find inlined Node functions + * inspector/PageConsoleAgent.cpp: Includes Document.h to find inlined Node functions + +2012-07-19 David Hyatt <hyatt@apple.com> + + SVG not properly respecting max-width. + https://bugs.webkit.org/show_bug.cgi?id=91474 + + My previous checkin for 91474 accidentally inverted width and height in the division case for + the computation of height. When I fixed this inversion, I discovered that <object> elements + are in fact also broken with max-width handling, and that furthermore, trying to apply the same + max-width fix by calling RenderBox::computeReplacedLogicalWidth/Height failed because those methods + call intrinsicLogicalWidth()/Height(). Becuase m_intrinsicSize is out-of-date and does not reflect + the values we just obtained from the contentRenderer, we use the default 300x150 values for object + and fail to render. + + In order to both fix SVG/<object> with max-width constraints and to keep <object> rendering correctly + even when there are no max-width constraints, I was forced to update the m_intrinsicSize immediately + in order to make sure that the RenderBox methods returned the right values when computing the width/height + constrained to max/min-width/height values. + + Reviewed by Dan Bernstein. + + Added two new tests in svg/as-image. One test covers non-rectangular images to test for the inversion + mistake I made. The second test applies a max-width to <object> and shows that we have never gotten + this right before. An existing test in svg/as-image/ already covers basic <object> use (and tests that + the intrinsic size of 300x150 is not used when an explicit non-percentage size is specified on the SVG + itself). + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): + Add a check to update m_intrinsicSize when we know it should apply, so that the calls to check against + min/max-width fetch this correct size. + + * rendering/RenderReplaced.h: + (RenderReplaced): + Make m_intrinsicSize mutable because of the mutation that occurs during the method above. It may be + that we should re-evaluate whether all of these methods should be const, but this would impact RenderBox + methods as well, so I chose to hold off going down that rabbit hole. + +2012-07-19 Dominic Mazzoni <dmazzoni@google.com> + + AX: Need AccessibilityObjects for nodes without renderers in canvas subtree + https://bugs.webkit.org/show_bug.cgi?id=87899 + + Reviewed by Chris Fleizach. + + Refactors AccessibilityRenderObject so that it inherits from a new class, + AccessibilityNodeObject, that can be constructed from a Node without a + renderer. Modifies AXObjectCache so that it automatically creates an + AccessibilityNodeObject for elements in a canvas subtree but not otherwise. + A new layout test verifies that this correctly exposes an accessibility + tree with appropriate roles for elements in a canvas subtree. + + This patch does not try to complete the implementation of + AccessibilityNodeObject. Most AX methods are still unimplemented and need + to be migrated from AccessibilityRenderObject to AccessibilityNodeObject + in a future patch. + + This patch also doesn't change anything outside of WebCore/accessibility, so + the rest of WebCore only calls AXObjectCache when there are changes to a + RenderObject, not to a Node. Accessible notifications on nodes without + renderers need to be implemented in a future patch. + + Test: accessibility/canvas-accessibilitynodeobject.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::get): + (WebCore): + (WebCore::createFromNode): + (WebCore::AXObjectCache::getOrCreate): + (WebCore::AXObjectCache::remove): + * accessibility/AXObjectCache.h: + (AXObjectCache): + (WebCore::AXObjectCache::get): + (WebCore::AXObjectCache::getOrCreate): + (WebCore::AXObjectCache::remove): + * accessibility/AccessibilityARIAGrid.cpp: + (WebCore::AccessibilityARIAGrid::AccessibilityARIAGrid): + (WebCore): + (WebCore::AccessibilityARIAGrid::~AccessibilityARIAGrid): + (WebCore::AccessibilityARIAGrid::init): + (WebCore::AccessibilityARIAGrid::create): + * accessibility/AccessibilityARIAGrid.h: + (AccessibilityARIAGrid): + * accessibility/AccessibilityARIAGridCell.cpp: + (WebCore::AccessibilityARIAGridCell::create): + * accessibility/AccessibilityARIAGridRow.cpp: + (WebCore::AccessibilityARIAGridRow::create): + * accessibility/AccessibilityAllInOne.cpp: + * accessibility/AccessibilityList.cpp: + (WebCore::AccessibilityList::create): + * accessibility/AccessibilityListBox.cpp: + (WebCore::AccessibilityListBox::create): + * accessibility/AccessibilityMediaControls.cpp: + (WebCore::AccessibilityMediaControl::create): + (WebCore::AccessibilityMediaControlsContainer::create): + (WebCore::AccessibilityMediaTimeline::create): + (WebCore::AccessibilityMediaTimeDisplay::create): + * accessibility/AccessibilityMenuList.cpp: + (WebCore::AccessibilityMenuList::create): + (WebCore): + * accessibility/AccessibilityMenuList.h: + (AccessibilityMenuList): + * accessibility/AccessibilityNodeObject.cpp: Added. + (WebCore): + (WebCore::AccessibilityNodeObject::AccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::~AccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::init): + (WebCore::AccessibilityNodeObject::create): + (WebCore::AccessibilityNodeObject::detach): + (WebCore::AccessibilityNodeObject::childrenChanged): + (WebCore::AccessibilityNodeObject::updateAccessibilityRole): + (WebCore::AccessibilityNodeObject::firstChild): + (WebCore::AccessibilityNodeObject::lastChild): + (WebCore::AccessibilityNodeObject::previousSibling): + (WebCore::AccessibilityNodeObject::nextSibling): + (WebCore::AccessibilityNodeObject::parentObjectIfExists): + (WebCore::AccessibilityNodeObject::parentObject): + (WebCore::AccessibilityNodeObject::elementRect): + (WebCore::AccessibilityNodeObject::setNode): + (WebCore::AccessibilityNodeObject::document): + (WebCore::AccessibilityNodeObject::determineAccessibilityRole): + (WebCore::AccessibilityNodeObject::addChildren): + (WebCore::AccessibilityNodeObject::accessibilityIsIgnored): + (WebCore::AccessibilityNodeObject::canSetFocusAttribute): + (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute): + (WebCore::AccessibilityNodeObject::ariaRoleAttribute): + (WebCore::AccessibilityNodeObject::remapAriaRoleDueToParent): + * accessibility/AccessibilityNodeObject.h: Added. + (WebCore): + (AccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::isAccessibilityNodeObject): + (WebCore::AccessibilityNodeObject::node): + (WebCore::AccessibilityNodeObject::isDetached): + (WebCore::toAccessibilityNodeObject): + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::isAccessibilityNodeObject): + * accessibility/AccessibilityProgressIndicator.cpp: + (WebCore::AccessibilityProgressIndicator::create): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::AccessibilityRenderObject): + (WebCore::AccessibilityRenderObject::init): + (WebCore): + (WebCore::AccessibilityRenderObject::create): + (WebCore::AccessibilityRenderObject::detach): + (WebCore::AccessibilityRenderObject::setRenderer): + (WebCore::AccessibilityRenderObject::canHaveChildren): + (WebCore::AccessibilityRenderObject::addCanvasChildren): + (WebCore::AccessibilityRenderObject::addChildren): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + * accessibility/AccessibilitySlider.cpp: + (WebCore::AccessibilitySlider::create): + * accessibility/AccessibilityTable.cpp: + (WebCore::AccessibilityTable::AccessibilityTable): + (WebCore): + (WebCore::AccessibilityTable::~AccessibilityTable): + (WebCore::AccessibilityTable::init): + (WebCore::AccessibilityTable::create): + * accessibility/AccessibilityTable.h: + (AccessibilityTable): + * accessibility/AccessibilityTableCell.cpp: + (WebCore::AccessibilityTableCell::create): + * accessibility/AccessibilityTableRow.cpp: + (WebCore::AccessibilityTableRow::create): + +2012-07-19 Dan Bernstein <mitz@apple.com> + + The ATSUI-based complex text code is unused + https://bugs.webkit.org/show_bug.cgi?id=91816 + + Reviewed by Sam Weinig. + + * WebCore.gypi: Removed references to the files deleted in this change. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * platform/graphics/FontCache.h: + (FontCache): Replaced USE(CORE_TEXT) with PLATFORM(MAC) || PLATFORM(CHROMIUM) && OS(DARWIN). + * platform/graphics/SimpleFontData.h: + (SimpleFontData): Removed USE(ATSUI)-only code, replaced USE(CORE_TEXT) with + (PLATFORM(CHROMIUM) && OS(DARWIN)). + * platform/graphics/mac/ComplexTextController.cpp: Removed USE(ATSUI)-only code. Moved + collectComplexTextRunsForCharacters() and the ComplexTextRun constructor out of this file. + * platform/graphics/mac/ComplexTextController.h: Removed USE(ATSUI)-only code and removed + #if USE(CORE_TEXT) because anyone including this header is using Core Text. + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: Removed. + * platform/graphics/mac/ComplexTextControllerCoreText.mm: + (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moved from + ComplexTextController.cpp into this file and merged with createTextRunFromFontDataCoreText(). + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Moved from + ComplexTextController.cpp into this file and merged with + collectComplexTextRunsForCharactersCoreText(). + * platform/graphics/mac/SimpleFontDataATSUI.mm: Removed. + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformInit): Remove USE(ATSUI)-only code. + (WebCore::SimpleFontData::platformDestroy): Ditto. + * platform/text/mac/ShapeArabic.c: Removed. + * platform/text/mac/ShapeArabic.h: Removed. + +2012-07-19 Kent Tamura <tkent@chromium.org> + + Introduce Node::shadowHost() + https://bugs.webkit.org/show_bug.cgi?id=91814 + + Reviewed by Hajime Morita. + + Introduce Node::shadowHost(), which return the host element, or 0. + Node::shadowAncestorNode() is used to obtain a shadow host. However it + is confusing because it returns 'this' if this is not in a shadow tree. + + Replaces one callsite of shadowAncestorNode() with shadowHost(). + + No behavior change. + + * dom/Node.cpp: + (WebCore::Node::shadowHost): Added. + * dom/Node.h: + (Node): Declare shadowHost(), and add a comment to shadowAncestorNode(). + * html/shadow/CalendarPickerElement.cpp: + (WebCore::CalendarPickerElement::hostInput): + Replace shadowAncestorNode() with shaodwHost(). + +2012-07-19 Kent Tamura <tkent@chromium.org> + + Form state restore: Need to identify a form by its content + https://bugs.webkit.org/show_bug.cgi?id=91209 + + Reviewed by Hajime Morita. + + Add names of the first two controls of a form to its formKey + string. By this change, we can correctly restore states to + reordered forms like webkit.org/b/91209#c0. + + Tests: Added test cases to fast/forms/state-restore-per-form.html. + + * html/FormController.cpp: + (WebCore::recordFormStructure): + Append at most two name attribute values. + (WebCore::createKey): Insert a string built by recordFromStructure(). + (WebCore::formStateSignature): Bump the version. + +2012-07-19 Wei James <james.wei@intel.com> + + enable Web Audio for chromium android port + https://bugs.webkit.org/show_bug.cgi?id=89428 + + Reviewed by Kenneth Russell. + + * WebCore.gyp/WebCore.gyp: + * platform/audio/FFTFrameStub.cpp: + (WebCore::FFTFrame::doFFT): + +2012-07-19 David Hyatt <hyatt@apple.com> + + SVG images broken when max-width specified. + https://bugs.webkit.org/show_bug.cgi?id=91474 + + SVG images were computing intrinsic dimensions when width and height were auto that did not + respect min-max width/height. Normal images had code that applied these constraints properly. + Looking at the code before the check-in that broke things, these constraints used to be + applied to all images regardless of type via calcAspectRatioLogicalWidth/Height. + + This patch leaves the new function structure in place but converts the code to be more like + it was prior to the introduction of the regression. Instead of raw intrinsic sizes being + used in the SVG case, now all image types get the intrinsic sizes constrained when doing + width/height computations. + + Reviewed by Dan Bernstein. + + Test: svg/as-image/svg-intrinsic-size.html + + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): + Rename computeIntrinsicRatioInformationForRenderBox to computeAspectRatioInformationForRenderBox. + Also rename the intrinsicSize reference to constrainedSize to reflect the fact that the size + is not necessarily the intrinsic size any longer but instead a size where both axes have been + constrained based off the max-min values of the opposite axes. + + Move the constraining code out of RenderReplaced::computeIntrinsicRatioInformation into this + function so that the SVG code path appies the constraints as well. The movement of this code + is what fixes the bug. + + (WebCore::RenderReplaced::computeIntrinsicRatioInformation): + Changed to remove the code that constrains the returned size, since it is shifting to + computeAspectRatioInformationForRenderBox instead. + + (WebCore::RenderReplaced::computeReplacedLogicalWidth): + (WebCore::RenderReplaced::computeReplacedLogicalHeight): + * rendering/RenderReplaced.h: + (RenderReplaced): + Patch the name of the reference passed in to computeReplacedLogicalWidth/Height to be + constrainedSize instead of intrinsicSize, so that it is more obvious that the returned + result is not just the intrinsic size of the image. + +2012-07-19 Dmitry Titov <dimich@chromium.org> + + Unreviewed, reverting http://trac.webkit.org/changeset/123149. + It broke an IDB test on Chromium page cycler. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::SerializedScriptValue): + (WebCore): + * bindings/v8/SerializedScriptValue.h: + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + (WebCore::MessageEvent::initMessageEvent): + +2012-07-19 Julien Chaffraix <jchaffraix@webkit.org> + + [CSS2.1] Anonymous tables should be inline/block-level based off their parent + https://bugs.webkit.org/show_bug.cgi?id=15365 + + Reviewed by Abhishek Arya. + + This change makes us match bullet 3 "Generate missing parents" of section 17.2.1 http://www.w3.org/TR/CSS2/tables.html#anonymous-boxes": + "If a table is contained by an inline element, then the anonymous tables should be inline-tables." + + Patch based on an earlier change by Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>. + + Tests: css2.1/20110323/inline-table-002b.html + fast/dynamic/insert-before-table-part-in-continuation.html + fast/table/inline-table-in-continuation.html + fast/table/inline-table-with-caption.html + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::createAnonymousWithParentRenderer): + Added a check to determine if we should be inline or block based on our parent to match CSS 2.1. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::addChildIgnoringContinuation): + Changed the child addition logic to not wrap a table part in an inline context. This change works + as intended as we will call RenderObject::addChild which will create an anonymous inline table that + will be added under |this| instead of the table part. As the table is inline, it doesn't need to be + wrapped when we recursively call RenderInline::addChild. + +2012-07-19 Chris Fleizach <cfleizach@apple.com> + + WebKit should pass <title> element value as the default description for web views + https://bugs.webkit.org/show_bug.cgi?id=91763 + + Reviewed by Anders Carlsson. + + Update the logic for determining the description for the AXWebArea to include the document's title. + + Test: platform/mac/accessibility/document-title-used-for-description.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::webAreaAccessibilityDescription): + Move web area description handling into a separate method. + (WebCore::AccessibilityRenderObject::accessibilityDescription): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + +2012-07-19 Zeev Lieber <zlieber@chromium.org> + + [Chromium] Textures drawn during occlusion are incorrectly re-used when unoccluded. + https://bugs.webkit.org/show_bug.cgi?id=91537 + + Reviewed by Adrienne Walker. + + Detecting if any external occlusion occurs when drawing a + texture. If external occlusion happens, the texture is marked as + "incomplete" in LayerRendererChromium, and is not being considered + for re-use. + + Minor refactoring of CCQuadCuller - extracted interface + (CCQuadSink) and united append() and appendSurface() methods. + + Added unit tests to verify this fix; also added test to try + clipping instead of occlusion. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (LayerRendererChromium::CachedTexture): + (WebCore::LayerRendererChromium::CachedTexture::create): + (WebCore::LayerRendererChromium::CachedTexture::~CachedTexture): + (WebCore::LayerRendererChromium::CachedTexture::isComplete): + (WebCore::LayerRendererChromium::CachedTexture::setIsComplete): + (WebCore::LayerRendererChromium::CachedTexture::CachedTexture): + (WebCore): + (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame): + (WebCore::LayerRendererChromium::haveCachedResourcesForRenderPassId): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h: + (CCIOSurfaceLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::appendDebugBorderQuad): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore): + (WebCore::CCLayerImpl::appendQuads): + (CCLayerImpl): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::::unoccludedContentRect): + (WebCore::::unoccludedContributingSurfaceContentRect): + (WebCore): + * platform/graphics/chromium/cc/CCOcclusionTracker.h: + (CCOcclusionTrackerBase): + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + (WebCore::CCQuadCuller::CCQuadCuller): + (WebCore::CCQuadCuller::append): + * platform/graphics/chromium/cc/CCQuadCuller.h: + (WebCore): + (CCQuadCuller): + (WebCore::CCQuadCuller::~CCQuadCuller): + (WebCore::CCQuadCuller::hasExternalOcclusion): + * platform/graphics/chromium/cc/CCQuadSink.h: + (WebKit): + (WebCore): + (CCQuadSink): + (WebCore::CCQuadSink::~CCQuadSink): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::CCRenderPass): + (WebCore::CCRenderPass::appendQuadsForLayer): + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::hasExternalOcclusion): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::CCRenderSurface): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + (WebCore::CCRenderSurface::setHasExternalOcclusion): + (WebCore::CCRenderSurface::hasExternalOcclusion): + (CCRenderSurface): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: + (WebCore::CCScrollbarLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: + (CCScrollbarLayerImpl): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: + (WebCore::CCSolidColorLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + (CCSolidColorLayerImpl): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTextureLayerImpl.h: + (CCTextureLayerImpl): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (CCVideoLayerImpl): + +2012-07-19 Simon Fraser <simon.fraser@apple.com> + + Keep overlap testing on for descendants of an animating element + https://bugs.webkit.org/show_bug.cgi?id=91787 + + Reviewed by Beth Dakin. + + RenderLayerCompositor::computeCompositingRequirements() would turn off + overlap testing for descendants of a layer that has a 3D transform, + or has an animating transform. This could cause compositing changes + inside an animating element when transitions start and stop, which + is undesirable. + + Instead, we can keep overlap testing on for descendants of that + animating element, but we have to turn it off for layers later + in z-order. + + Also enhance the "IndirectCompositingReason" flags so that in + the compositing log output, we can distinguish between layers that + were composited as a result of overlap testing from those compositing + for stacking reasons. + + Test: compositing/layer-creation/animation-overlap-with-children.html + + * rendering/RenderLayer.h: New IndirectCompositingReason value to + distinguish overlap from stacking. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + Use an IndirectCompositingReason enum rather than a bool to track whether + the layer starts as composited. + Remove the if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) + check that turned off overlap testing for descendants of this layer. + Use IndirectCompositingForStacking (somewhat arbitrarily) for reflection layers. + Turn overlap testing off for layers later in the z-order. + (WebCore::RenderLayerCompositor::requiresOwnBackingStore): Take IndirectCompositingForStacking into + account. + (WebCore::RenderLayerCompositor::reasonForCompositing): Improve the logging output. + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Added missing files to the Qt build. + + No new tests, WebGL is still disabled by default in the bots. + + * Target.pri: + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Added missing files to the Qt build. + + No new tests, WebGL is still disabled by default in the bots. + + * Target.pri: + +2012-07-19 Simon Fraser <simon.fraser@apple.com> + + Keep overlap testing on for descendants of an animating element + https://bugs.webkit.org/show_bug.cgi?id=91787 + + Reviewed by Beth Dakin. + + RenderLayerCompositor::computeCompositingRequirements() would turn off + overlap testing for descendants of a layer that has a 3D transform, + or has an animating transform. This could cause compositing changes + inside an animating element when transitions start and stop, which + is undesirable. + + Instead, we can keep overlap testing on for descendants of that + animating element, but we have to turn it off for layers later + in z-order. + + Also enhance the "IndirectCompositingReason" flags so that in + the compositing log output, we can distinguish between layers that + were composited as a result of overlap testing from those compositing + for stacking reasons. + + Test: compositing/layer-creation/animation-overlap-with-children.html + + * rendering/RenderLayer.h: New IndirectCompositingReason value to + distinguish overlap from stacking. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + Use an IndirectCompositingReason enum rather than a bool to track whether + the layer starts as composited. + Remove the if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) + check that turned off overlap testing for descendants of this layer. + Use IndirectCompositingForStacking (somewhat arbitrarily) for reflection layers. + Turn overlap testing off for layers later in the z-order. + (WebCore::RenderLayerCompositor::requiresOwnBackingStore): Take IndirectCompositingForStacking into + account. + (WebCore::RenderLayerCompositor::reasonForCompositing): Improve the logging output. + +2012-07-19 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS shaders in Qt (software mode) + https://bugs.webkit.org/show_bug.cgi?id=85140 + + Reviewed by Simon Hausmann. + + Added missing files to the Qt build. + + No new tests, WebGL is still disabled by default in the bots. + + * Target.pri: + +2012-07-17 Dmitry Titov <dimich@chromium.org> + + [Chromium] Out of Memory is observed when a large object is passed to a Web Worker. + https://bugs.webkit.org/show_bug.cgi?id=91535. + + Reviewed by Dave Levin. + + No new tests because of no new behavior and lack of mechanism to monitor used memory. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::SerializedScriptValue): + (WebCore::SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext): + (WebCore): + (WebCore::SerializedScriptValue::~SerializedScriptValue): + * bindings/v8/SerializedScriptValue.h: + (SerializedScriptValue): + Added a method to SerializedScriptValue to add memory pressure on GC proportional to the size of memory allocated in serialized data. + + * dom/MessageEvent.cpp: + (WebCore::MessageEvent::MessageEvent): + (WebCore::MessageEvent::initMessageEvent): + Call the new method of SerializedScriptValue during creation of MessageEvent (presumably in the thread which contains the right V8 context). + +2012-07-19 Dan Bernstein <mitz@apple.com> + + In flipped blocks writing modes, no flipping occurs when mapping RenderText’s local coordinates to absolute + https://bugs.webkit.org/show_bug.cgi?id=91780 + + Reviewed by Anders Carlsson. + + Test: fast/writing-mode/flipped-blocks-text-map-local-to-container.html + + When RenderObject::mapLocalToContainer() was called on a RenderText with ApplyContainerFlip, + it would not flip (if the container was not a box) but it would always pass + DoNotApplyContainerFlip when recurring to the parent. This meant that no one applied the flip. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::mapLocalToContainer): Made the setting of applyContainerFlip to + false unconditional on the container actually being flipped. + * rendering/RenderObject.cpp: + (WebCore::RenderObject::mapLocalToContainer): Rather than always passing + DoNotApplyContainerFlip when recurring to the parent, changed this function to pass through + the value of applyContainerFlip it was called with, unless it applied the flip itself. + +2012-07-19 Erik Arvidsson <arv@chromium.org> + + Window top should not be replaceable + https://bugs.webkit.org/show_bug.cgi?id=91755 + + Reviewed by Adam Barth. + + Window top is readonly and unforgable and should not be replaceable. + + http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-object + + This change brings JSC inline with all other browsers. + + No new tests. Modified existing tests. + + * page/DOMWindow.idl: + +2012-07-19 Max Feil <mfeil@rim.com> + + [BlackBerry] Only maintain the hole punch rect while html5 video is being renderered + https://bugs.webkit.org/show_bug.cgi?id=91689 + + Reviewed by Antonio Gomes. + + The hole punch rectangle needs to be present if and only if html5 + video content is being rendered. Otherwise unwanted content may + show through from behind the browser tab's window. + + I am not adding any new tests because the difficulty of testing + for this case outweighs the benefit. + + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::updateStates): + +2012-07-19 Bem Jones-Bey <bjonesbe@adobe.com> + + [CSS Exclusions] - Code cleanup: make shape parsing use isComma() instead of manual checks + https://bugs.webkit.org/show_bug.cgi?id=91760 + + Reviewed by Eric Seidel. + + Remove code duplication by making the rectangle, circle, and ellipse + methods use isComma() to detect a comma. + + No new tests needed: no new functionality added. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseExclusionShapeRectangle): + (WebCore::CSSParser::parseExclusionShapeCircle): + (WebCore::CSSParser::parseExclusionShapeEllipse): + +2012-07-19 Raymond Toy <rtoy@google.com> + + Limit maximum delay of DelayNode. + https://bugs.webkit.org/show_bug.cgi?id=91675 + + Reviewed by Kenneth Russell. + + Clip the maximum delay of a DelayNode to a reasonable maximum. + + Test: webaudio/delaynode-maxdelaylimit.html + + * Modules/webaudio/DelayNode.cpp: + (WebCore): Add maximumAllowedDelayTime. + (WebCore::DelayNode::DelayNode): Clip max delay. + +2012-07-14 Robert Hogan <robert@webkit.org> + + CSS 2.1 failure: text-indent-intrinsic-003 fails + https://bugs.webkit.org/show_bug.cgi?id=80576 + + Reviewed by Eric Seidel. + + Negative values of text-indent should be distributed across inline children until used up. + This fixes text-indent-intrinsic-003 and text-indent-intrinsic-004. + + Tests: css2.1/20110323/text-indent-intrinsic-001.htm + css2.1/20110323/text-indent-intrinsic-002.htm + css2.1/20110323/text-indent-intrinsic-003.htm + css2.1/20110323/text-indent-intrinsic-004.htm + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): If text-indent is negative, keep + applying it to inline children in the first formatted line until it's reduced to zero. This isn't + a consideration when text-indent is a positive value. + +2012-07-19 Douglas Stockwell <dstockwell@google.com> + + Crash in WebCore::StyleResolver::collectMatchingRulesForList + https://bugs.webkit.org/show_bug.cgi?id=90803 + + Reviewed by Andreas Kling. + + When a ProcessingInstruction was removed from the document the owner + was removed, but the style resolver was not guaranteed to be updated. + It was then possible for an inconsistent version of the stylesheet to + remain visible in the DOM. Fixed by removing an invalid condition and + mirroring the logic from StyleElement. + + Test: fast/css/xml-stylesheet-removed.xhtml + + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::removedFrom): Mirror the logic from + StyleElement -- always update the style resolver. + +2012-07-19 Bem Jones-Bey <bjonesbe@adobe.com> + + Shape-inside / shape-outside should support percent-based measurements + https://bugs.webkit.org/show_bug.cgi?id=90311 + + Reviewed by Andreas Kling. + + Update the CSS Parser to accept percentage length values for exclusion + shapes. + + Testing added to LayoutTests/fast/exclusions/parsing-wrap-shape-lengths.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseExclusionShapeRectangle): + (WebCore::CSSParser::parseExclusionShapeCircle): + (WebCore::CSSParser::parseExclusionShapeEllipse): + (WebCore::CSSParser::parseExclusionShapePolygon): + +2012-07-19 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r123117. + http://trac.webkit.org/changeset/123117 + https://bugs.webkit.org/show_bug.cgi?id=91667 + + Breaks chromium-win compile. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/scripts/rule_bison.py: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + * make-hash-tools.pl: + +2012-07-19 James Simonsen <simonjam@chromium.org> + + Regression(120096): Protect the element used by ImageLoader until the end of notifyFinished(). + https://bugs.webkit.org/show_bug.cgi?id=90471 + + Reviewed by Brady Eidson. + + Test: http/tests/security/video-poster-cross-origin-crash.html + + * html/HTMLImageLoader.cpp: + (WebCore::HTMLImageLoader::notifyFinished): Hang on to the element until we're done. + * loader/ImageLoader.cpp: + (WebCore::ImageLoader::setImage): No behavior change. + (WebCore): + (WebCore::ImageLoader::setImageWithoutConsideringPendingLoadEvent): Split off from old setImage, minus calling updatedHasPendingLoadEvent(). + (WebCore::ImageLoader::notifyFinished): Invoke updatedHasPendingLoadEvent when done with cross origin errors. + * loader/ImageLoader.h: + (ImageLoader): + +2012-07-19 Scott Graham <scottmg@chromium.org> + + Use native (non-cygwin) binaries for perl, gperf, and bison in Chromium + https://bugs.webkit.org/show_bug.cgi?id=91667 + + Reviewed by Kentaro Hara. + + Using native tools instead of cygwin version improves build time + performance by roughly 50% (on top of previous cl-instead-of-gcc + change). + + No new tests. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/scripts/rule_bison.py: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + * make-hash-tools.pl: + +2012-07-19 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: CPU bars are not cleared along with the rest of the timeline panel + https://bugs.webkit.org/show_bug.cgi?id=91753 + + Reviewed by Pavel Feldman. + + - remove early bail-outs in refreshMainThreadBars; let it run to clear bars for the non-existent / invisible events; + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._refreshMainThreadBars): + +2012-07-19 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Throw native TypeErrors per spec + https://bugs.webkit.org/show_bug.cgi?id=91679 + + Reviewed by Kentaro Hara. + + Per the IDB spec, the advance(), openCursor(), openKeyCursor() and transaction() + methods supposed to throw true native JavaScript TypeError objects as exceptions + rather than DOMException objects. Implement this by adding a special DOMException + code that is tested for in the binding layer. + + Tests: storage/indexeddb/cursor-advance.html + storage/indexeddb/index-basics.html + storage/indexeddb/index-basics-workers.html + storage/indexeddb/objectstore-cursor.html + storage/indexeddb/transaction-basics.html + + * Modules/indexeddb/IDBCursor.cpp: Use the new DOMException code. + (WebCore::IDBCursor::advance): + (WebCore::IDBCursor::stringToDirection): + (WebCore::IDBCursor::directionToString): + * Modules/indexeddb/IDBDatabase.cpp: Ditto. + (WebCore::IDBDatabase::setVersion): + * Modules/indexeddb/IDBDatabaseException.cpp: Remove temporary cruft/mark as legacy. + (WebCore): + * Modules/indexeddb/IDBDatabaseException.h: Ditto. + * Modules/indexeddb/IDBDatabaseException.idl: Ditto. + * Modules/indexeddb/IDBFactory.cpp: Use the new DOMException code. + (WebCore::IDBFactory::open): + (WebCore::IDBFactory::deleteDatabase): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::createIndex): Use the new DOMException code. + * Modules/indexeddb/IDBTransaction.cpp: Use the new DOMException code. + (WebCore::IDBTransaction::stringToMode): + (WebCore::IDBTransaction::modeToString): + * bindings/js/JSDOMBinding.cpp: + (WebCore::setDOMException): Intercept new DOMException code, throw native TypeError. + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::setDOMException): Ditto. + * dom/ExceptionCode.h: Add new DOMException code. + +2012-07-19 Joshua Bell <jsbell@chromium.org> + + Roll out r121610 and r122487 which may have been causing flaky crashes + https://bugs.webkit.org/show_bug.cgi?id=91637 + + Reviewed by Kentaro Hara. + + Flaky crashes started in random tests following r121610. It's not clear + that r121610 is to blame, but we'd like to prove or disprove it. + If this doesn't resolve the crashes, this patch should be rolled out. + + * WebCore.gypi: + * bindings/v8/NPObjectWrapper.cpp: Added. + (WebCore): + (NPProxyObject): + (WebCore::NPObjectWrapper::NPObjectWrapper): + (WebCore::NPObjectWrapper::create): + (WebCore::NPObjectWrapper::clear): + (WebCore::NPObjectWrapper::getWrapper): + (WebCore::NPObjectWrapper::getUnderlyingNPObject): + (WebCore::NPObjectWrapper::getObjectForCall): + (WebCore::NPObjectWrapper::NPAllocate): + (WebCore::NPObjectWrapper::NPDeallocate): + (WebCore::NPObjectWrapper::NPPInvalidate): + (WebCore::NPObjectWrapper::NPHasMethod): + (WebCore::NPObjectWrapper::NPInvoke): + (WebCore::NPObjectWrapper::NPInvokeDefault): + (WebCore::NPObjectWrapper::NPHasProperty): + (WebCore::NPObjectWrapper::NPGetProperty): + (WebCore::NPObjectWrapper::NPSetProperty): + (WebCore::NPObjectWrapper::NPRemoveProperty): + (WebCore::NPObjectWrapper::NPNEnumerate): + (WebCore::NPObjectWrapper::NPNConstruct): + (WebCore::NPObjectWrapper::NPInvokePrivate): + * bindings/v8/NPObjectWrapper.h: Added. + (WebCore): + (NPObjectWrapper): + * bindings/v8/NPV8Object.cpp: + (WebCore::freeV8NPObject): + (_NPN_Invoke): + (_NPN_InvokeDefault): + (_NPN_EvaluateHelper): + (_NPN_GetProperty): + (_NPN_SetProperty): + (_NPN_RemoveProperty): + (_NPN_HasProperty): + (_NPN_HasMethod): + (_NPN_Enumerate): + (_NPN_Construct): + * bindings/v8/NPV8Object.h: + (WebCore): + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + (WebCore::ScriptController::clearScriptObjects): + (WebCore::ScriptController::windowScriptNPObject): + * bindings/v8/ScriptController.h: + (ScriptController): + +2012-07-19 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: minimize number of properties on WebInspector.TimelinePresentationModel.Record + https://bugs.webkit.org/show_bug.cgi?id=91744 + + Reviewed by Pavel Feldman. + + - replace most properties on TimelinePresentationModel.Record with getters; + + This reduces the amount of memory we use for timeline presentation model records almost by 2x. + + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.Record): + (WebInspector.TimelinePresentationModel.Record.prototype.get children): + (WebInspector.TimelinePresentationModel.Record.prototype.get category): + (WebInspector.TimelinePresentationModel.Record.prototype.get title): + (WebInspector.TimelinePresentationModel.Record.prototype.get startTime): + (WebInspector.TimelinePresentationModel.Record.prototype.get data): + (WebInspector.TimelinePresentationModel.Record.prototype.get type): + (WebInspector.TimelinePresentationModel.Record.prototype.get frameId): + (WebInspector.TimelinePresentationModel.Record.prototype.get endTime): + (WebInspector.TimelinePresentationModel.Record.prototype.get totalHeapSize): + (WebInspector.TimelinePresentationModel.Record.prototype.get usedHeapSize): + (WebInspector.TimelinePresentationModel.Record.prototype.get _selfTime): + (WebInspector.TimelinePresentationModel.Record.prototype.get stackTrace): + (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent): + (WebInspector.TimelinePresentationModel.Record.prototype.calculateAggregatedStats): + +2012-07-19 Dongwoo Im <dw.im@samsung.com> + + [EFL] Fix build break when WEB_AUDIO is enabled. + https://bugs.webkit.org/show_bug.cgi?id=91735 + + Unreviewed build fix. + + New files are added for the Web Audio fearure. + These files should be included into the CMakeLists.txt file. + + * CMakeLists.txt: Add the newly created files into the CMakeLists.txt + +2012-07-19 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Remove support for Qt versions before 4.8.0 + https://bugs.webkit.org/show_bug.cgi?id=91730 + + Reviewed by Kenneth Rohde Christiansen. + + Remove Qt version check #ifdefs for Qt versions before 4.8.0. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::clipBoundingRect): + * platform/qt/ThirdPartyCookiesQt.cpp: + (WebCore::urlsShareSameDomain): + (WebCore::thirdPartyCookiePolicyPermits): + +2012-07-19 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: CodeGeneratorInspector.py: fix output write logic to support incremental build + https://bugs.webkit.org/show_bug.cgi?id=90642 + + Reviewed by Yury Semikhatsky. + + A small intermediate writer is added. It handles comparing old and new source before actual writing. + + * inspector/CodeGeneratorInspector.py: + (flatten_list): + (SmartOutput): + (SmartOutput.__init__): + (SmartOutput.write): + (SmartOutput.close): + +2012-07-19 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] MHTML files not being loaded due to reported mime type not supported + https://bugs.webkit.org/show_bug.cgi?id=89978 + + Reviewed by Carlos Garcia Campos. + + Make 'message/rfc822' a supported MIME type for MHTML files in GTK. + + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::continueAfterContentPolicy): Add + 'message/rfc822' to the list of MIME types to be considered to + avoid them bypasing cross-domain security checks, only for GTK. + * loader/archive/ArchiveFactory.cpp: + (WebCore::archiveMIMETypes): Add 'message/rfc822' to the list of + supported MIME types when MHTML support is enabled in GTK. + +2012-07-19 Jan Keromnes <janx@linux.com> + + Web Inspector: Factor ExtensionView into separate file + https://bugs.webkit.org/show_bug.cgi?id=91699 + + Reviewed by Vsevolod Vlasov. + + The class ExtensionView was defined in ExtensionPanel.js but needed to + be in a separate file since it is going to be reused somewhere else. + + Current test coverage is enough since no behavior was changed. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/compile-front-end.py: + * inspector/front-end/ExtensionPanel.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2012-07-19 Shinya Kawanaka <shinyak@chromium.org> + + [Refactoring] Use userAgentShadowRoot() to take user agent shadow root. + https://bugs.webkit.org/show_bug.cgi?id=91716 + + Reviewed by Hajime Morita. + + We have introduced Element::userAgentShadowRoot in r123071 to take user agent shadow root. + We have used shadow()->oldestShadowRoot() to take the user agent shadow root, however its code intention was + not so clear. Using userAgentShadowRoot() will make it clearer. + + No new tests, simple refactoring. + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::createShadowSubtree): + (WebCore::ColorInputType::shadowColorSwatch): + * html/FileInputType.cpp: + (WebCore::FileInputType::createShadowSubtree): + (WebCore::FileInputType::multipleAttributeChanged): + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::findMainSummary): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::willAddAuthorShadowRoot): + (WebCore::HTMLImageElement::imageElement): + (WebCore::HTMLImageElement::innerElement): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::shadowSelect): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::innerTextElement): + (WebCore::HTMLTextAreaElement::updatePlaceholderText): + * html/InputType.cpp: + (WebCore::InputType::destroyShadowSubtree): + * html/RangeInputType.cpp: + (WebCore::RangeInputType::handleMouseDownEvent): + (WebCore::RangeInputType::createShadowSubtree): + * html/TextFieldInputType.cpp: + (WebCore::TextFieldInputType::createShadowSubtree): + (WebCore::TextFieldInputType::updatePlaceholderText): + * html/ValidationMessage.cpp: + (WebCore::ValidationMessage::deleteBubbleTree): + * html/shadow/SliderThumbElement.cpp: + (WebCore::sliderThumbElementOf): + (WebCore::trackLimiterElementOf): + +2012-07-19 Keishi Hattori <keishi@webkit.org> + + Redraw slider tick marks when datalist changes. + https://bugs.webkit.org/show_bug.cgi?id=89544 + + Reviewed by Kent Tamura. + + Updating the datalist should redraw the slider tick marks. This patch monitors + the id target element of the list attribute using ListAttributeTargetObserver + and notifies changes to the option element inside of a datalist element. + + Test: fast/forms/datalist/update-range-with-datalist.html + + * html/HTMLDataListElement.cpp: + (WebCore::HTMLDataListElement::optionElementChildrenChanged): Called when a child option element's value might have changed. + (WebCore): + * html/HTMLDataListElement.h: + (HTMLDataListElement): + * html/HTMLInputElement.cpp: + (ListAttributeTargetObserver): Inherits IdTargetObserver. + (WebCore): + (WebCore::HTMLInputElement::parseAttribute): Observe the form attribute target. + (WebCore::HTMLInputElement::insertedInto): Observe the form attribute id target. + (WebCore::HTMLInputElement::removedFrom): Remove the observer. + (WebCore::HTMLInputElement::resetListAttributeTargetObserver): + (WebCore::HTMLInputElement::listAttributeTargetChanged): + (WebCore::ListAttributeTargetObserver::create): + (WebCore::ListAttributeTargetObserver::ListAttributeTargetObserver): + (WebCore::ListAttributeTargetObserver::idTargetChanged): + * html/HTMLInputElement.h: + (WebCore): + (HTMLInputElement): + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::parseAttribute): If the value attribute changed, notify the owner datalist element. + (WebCore::HTMLOptionElement::childrenChanged): If the children changed, notify the owner datalist element. + (WebCore): + (WebCore::HTMLOptionElement::ownerDataListElement): The datalist that the option element is inside of. + * html/HTMLOptionElement.h: + (WebCore): + (HTMLOptionElement): + * html/InputType.cpp: + (WebCore): + (WebCore::InputType::listAttributeTargetChanged): + * html/InputType.h: + (InputType): + * html/RangeInputType.cpp: + (WebCore): + (WebCore::RangeInputType::listAttributeTargetChanged): + * html/RangeInputType.h: + (RangeInputType): + +2012-07-19 Dongwoo Im <dw.im@samsung.com> + + CodeGeneratorV8.pm : @enabledAtRuntime is not used in GenerateHeader. + https://bugs.webkit.org/show_bug.cgi?id=91715 + + Reviewed by Kentaro Hara. + + @enabledAtRuntime is not used in GenerateHeader. + We can remove it from GenerateHeader. + + No new tests as this has no functional changes. + + * bindings/scripts/CodeGeneratorV8.pm: Remove @enabledAtRuntime from GenerateHeader. + (GenerateHeader): + +2012-07-19 Abhishek Arya <inferno@chromium.org> + + Crash in FontCache::releaseFontData. + https://bugs.webkit.org/show_bug.cgi?id=91710 + + Reviewed by Tim Horton. + + Revert back change made to StyleResolver in r122896. The + maximum font size clamp is required there since transformed + sizes use that code path. + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + +2012-07-18 Ryosuke Niwa <rniwa@webkit.org> + + Another build fix after r123065. Don't list deleted file in gypi. + + * WebCore.gypi: + +2012-07-18 Keishi Hattori <keishi@webkit.org> + + Implement painting slider tick marks + https://bugs.webkit.org/show_bug.cgi?id=87844 + + Reviewed by Kent Tamura. + + This implements painting slider tick marks for <datalist> support for input type=range. + This does not support automatic update when list target changes, and it will be fixed + in a follow up patch (Bug 89544). + + Tests: fast/forms/datalist/input-appearance-range-with-datalist-rtl.html + fast/forms/datalist/input-appearance-range-with-datalist-zoomed.html + fast/forms/datalist/input-appearance-range-with-datalist.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::sliderThumbElement): + (WebCore): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/InputType.h: + (WebCore::InputType::sliderThumbElement): + * html/RangeInputType.cpp: + (WebCore::RangeInputType::typeMismatchFor): We need HTMLInputElement::isValidValue("foo") to return false. + (WebCore): + (WebCore::RangeInputType::sliderThumbElement): + * html/RangeInputType.h: + (RangeInputType): + * html/shadow/SliderThumbElement.cpp: + (WebCore::RenderSliderContainer::layout): Slider height needs to be increased for the tick marks. + * platform/efl/RenderThemeEfl.cpp: + (WebCore): + (WebCore::RenderThemeEfl::sliderTickSize): + (WebCore::RenderThemeEfl::sliderTickOffsetFromTrackCenter): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::sliderTickSize): + (WebCore): + (WebCore::RenderThemeQt::sliderTickOffsetFromTrackCenter): + * platform/qt/RenderThemeQt.h: + (RenderThemeQt): + * rendering/RenderTheme.cpp: + (WebCore): + (WebCore::RenderTheme::paintSliderTicks): + * rendering/RenderTheme.h: + (RenderTheme): + * rendering/RenderThemeChromiumCommon.cpp: + (WebCore::RenderThemeChromiumCommon::supportsDataListUI): + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore): + (WebCore::RenderThemeChromiumLinux::sliderTickSize): Tick size for horizontal slider. i.e. Width is length along the track. + (WebCore::RenderThemeChromiumLinux::sliderTickOffsetFromTrackCenter): Offset from + middle of draw rect to draw the ticks. Minus value means above the track. + (WebCore::RenderThemeChromiumLinux::paintSliderTrack): + * rendering/RenderThemeChromiumLinux.h: + (RenderThemeChromiumLinux): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore): + (WebCore::RenderThemeChromiumWin::sliderTickSize): + (WebCore::RenderThemeChromiumWin::sliderTickOffsetFromTrackCenter): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + (WebCore::RenderThemeChromiumWin::paintSliderThumb): + * rendering/RenderThemeChromiumWin.h: + (RenderThemeChromiumWin): + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintSliderTrack): + (WebCore): + (WebCore::RenderThemeMac::sliderTickSize): + (WebCore::RenderThemeMac::sliderTickOffsetFromTrackCenter): + +2012-07-18 Shinya Kawanaka <shinyak@chromium.org> + + Element wants to have userAgentShadowRoot() + https://bugs.webkit.org/show_bug.cgi?id=91564 + + Reviewed by Eric Carlson. + + We introduce Element::userAgentShadowRoot() to return a UserAgentShadowRoot. + It returns the oldest shadow root if any, and checks the type of ShadowRoot in debug build. + + Previously, we have used elementShadow()->oldestShadowRoot() to get UserAgentShadowRoot. + The class implementor will know the oldest shadow root is UserAgentShadowRoot, but it is not + clear for the other people. This method will make the code intention clearer. + + We will introduce userAgentShadowRoot to the other elements (e.g. HTMLInputElement) after this patch. + + No new tests, simple refactoring. + + * dom/Element.cpp: + (WebCore::Element::userAgentShadowRoot): + (WebCore): + * dom/Element.h: + (Element): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::createShadowSubtree): + (WebCore::HTMLMediaElement::willAddAuthorShadowRoot): + (WebCore::HTMLMediaElement::mediaControls): + (WebCore::HTMLMediaElement::hasMediaControls): + (WebCore::HTMLMediaElement::createMediaControls): + +2012-07-18 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE] Remove duplicated #ifdef guard in CMakeLists.txt + https://bugs.webkit.org/show_bug.cgi?id=91575 + + Reviewed by Dirk Pranke. + + CMake files have used ENABLE_XXX macro. However, almost source and idl files are already protected by #ifdef. + So, we don't need to guard them in CMake files again. + + In SVG idl files case, blackberry port doesn't support it yet. So, SVG idl files are handled by WebCore_SVG_IDL_FILES macro. + + No new tests. This patch isn't for functionality. + + * CMakeLists.txt: + * PlatformBlackBerry.cmake: Change SVG_IDL_FILES with WebCore_SVG_IDL_FILES. + +2012-07-18 Hironori Bono <hbono@chromium.org> + + Move contents right when a vertical scrollbar is shown at the left side of an RTL element. + https://bugs.webkit.org/show_bug.cgi?id=85856 + + Reviewed by Hajime Morita. + + This change prevents the scrollWidth value from being cropped by the width of a + scrollbar when a vertical scrollbar is shown at the left side of an RTL element. + This change also increases the clientLeft value by this scrollbar width and move + contents right to improve compliance with CSSOM <http://www.w3.org/TR/cssom-view>. + + Tests: scrollbars/rtl/div-horizontal.html + scrollbars/rtl/div-vertical.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintObject): Move contents to the right. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::topLeftLocationOffset): Move the top-left corner to the right to prevent WebKit from cropping scrollWidth. + * rendering/RenderBox.h: + (WebCore::RenderBox::clientLeft): Increase clientLeft by the width of a scrollbar. + +2012-07-18 Kent Tamura <tkent@chromium.org> + + Form state restore: Classify form control sates by owners in internal and serialized representations + https://bugs.webkit.org/show_bug.cgi?id=91594 + + Reviewed by Hajime Morita. + + Before this change, the internal representation of form control states + was a map like: + + {name, type, formKey} -> [FormControlState, FormControlState, ...] + + Also, the serialized representation was: + + [name, type, formKey, FormControlState, + name, type, formKey, formControlState, + ...] + + This changes these represenations. The internal representation is + + A map owned by FormController: + formKey -> SavedFormState + SavedFormState owns a map like: + {name, type} -> [FormControlState, FormControlState, ...] + + The serialized representation is: + + [formKey, count, + name, type, FormControlState, + name, type, FormControlState, + name, type, FormControlState, + .... + formKey, count, + name, type, FormControlState, + name, type, FormControlState, + name, type, FormControlState, + ....] + + The serialized representation would be smaller in many cases because + each of items doesn't have formKey. + + Tests: Covered by fast/forms/state-restore-broken-state.html, + state-restore-per-form.html, and state-restore-skip-stateless.html. + + * html/FormController.cpp: + (FormElementKey): Remove formKey argument and m_formKey. + (WebCore::FormElementKey::FormElementKey): + (WebCore::FormElementKey::operator=): + (WebCore::FormElementKey::ref): + (WebCore::FormElementKey::deref): + (WebCore::operator==): + + (SavedFormState): + - The role of SavedFromState was changed. It represented all of control + states. Now it represent control states owned by a signle form. + - Make this non-copyable and fast-allocated. + - Add m_controlStateCount, a counter of FormControlState + (WebCore::SavedFormState::SavedFormState): + Initialize m_controlStateCount. + (WebCore::isNotFormControlTypeCharacter): + Moved from another place in this file. + (WebCore::SavedFormState::deserialize): + Added. Build a SavedFromState with the specified stateVector. + (WebCore::SavedFormState::serializeTo): + Added. m_controlStateCount is needed here. + (WebCore::SavedFormState::appendControlState): + - Remove formKey arguement. + - Update m_controlStateCount. + (WebCore::SavedFormState::takeControlState): ditto. + + (WebCore::formStateSignature): Bump the version. + (WebCore::FormController::createSavedFormStateMap): + Added. Build a SavedFormStateMap from the form control list. This is a + helper for formElementsState, and classifies controls in the document. + (WebCore::FormController::formElementsState): + Build a SavedFormStateMap with createSavedFormStateMap(), + then serializes it. + (WebCore::FormController::setStateForNewFormElements): + Deserialize SavedFormState, and build SavedFormStateMap. + (WebCore::FormController::takeStateForFormElement): + Finds the corresponding SavedFormState with a formKey, and uses it. + * html/FormController.h: + Declare createSavedFormStateMap(), and moved typedefs for it. + +2012-07-18 Antoine Labour <piman@chromium.org> + + [chromium] Introduce CCResourceProvider, replacing TextureAllocator and hiding textures from clients to allow transport + https://bugs.webkit.org/show_bug.cgi?id=91044 + + Reviewed by Adrienne Walker. + + This does several things: + - Add a CCResourceProvider class, that hides textures and the 3D context + from layers (except those that need it). Instead layers manage + "resources". In the future, resources are expected to be transportable + to a "parent" CCResourceProvider to allow flattening of nested + compositors. + - Replace texture ids by resource ids in DrawQuads (allowing them to be + serializable). + - Replace TextureAllocator uses by the CCResourceProvider class. + - Upload of data is done through the CCResourceProvider instead of + explicit GL calls. + - External textures are wrapped into a resource at draw time (see + caveat/FIXME in CCTextureLayerImpl). + - Rendering with the resources is done through an explicit + beginRenderFrom/endRenderFrom that exposes the texture only between that + pair. + - Merge all the LayerTextureSubImage instances (one per layer), into a + single instance on the CCResourceProvider. + + Added CCResourceProviderTest, the refactoring is covered by existing tests. + + * WebCore.gypi: + * platform/chromium/support/WebCompositorTextureQuad.cpp: + (WebKit::WebCompositorTextureQuad::create): + (WebKit::WebCompositorTextureQuad::WebCompositorTextureQuad): + * platform/chromium/support/WebCompositorTileQuad.cpp: + (WebKit::WebCompositorTileQuad::create): + (WebKit::WebCompositorTileQuad::WebCompositorTileQuad): + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapCanvasLayerTextureUpdater::Texture::updateRect): + (WebCore::BitmapCanvasLayerTextureUpdater::create): + (WebCore::BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater): + (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate): + (WebCore::BitmapCanvasLayerTextureUpdater::updateTextureRect): + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: + (WebCore): + (Texture): + (BitmapCanvasLayerTextureUpdater): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::create): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + (Texture): + (BitmapSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::createAcceleratedCanvas): + (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect): + (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect): + * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h: + (Texture): + (FrameBufferSkPictureCanvasLayerTextureUpdater): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerTextureUpdater::create): + (WebCore::ImageLayerTextureUpdater::updateTextureRect): + (WebCore::ImageLayerTextureUpdater::ImageLayerTextureUpdater): + (ImageLayerTextureUpdater): + (WebCore::ImageLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::create): + (WebCore::LayerRendererChromium::LayerRendererChromium): + (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame): + (WebCore::applyFilters): + (WebCore::LayerRendererChromium::drawBackgroundFilters): + (WebCore::LayerRendererChromium::drawRenderPassQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawYUVVideoQuad): + (WebCore::LayerRendererChromium::drawTextureQuad): + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): + (WebCore::LayerRendererChromium::drawHeadsUpDisplay): + (WebCore::LayerRendererChromium::finishDrawingFrame): + (WebCore::LayerRendererChromium::getFramebufferTexture): + (WebCore::LayerRendererChromium::useRenderPass): + (WebCore::LayerRendererChromium::useScopedTexture): + (WebCore::LayerRendererChromium::bindFramebufferToTexture): + (WebCore::LayerRendererChromium::finishCurrentFramebuffer): + (WebCore): + (WebCore::LayerRendererChromium::initializeSharedObjects): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + (WebCore::LayerRendererChromium::resourceProvider): + * platform/graphics/chromium/LayerTextureSubImage.cpp: + (WebCore::LayerTextureSubImage::LayerTextureSubImage): + (WebCore::LayerTextureSubImage::upload): + (WebCore::LayerTextureSubImage::uploadWithTexSubImage): + (WebCore::LayerTextureSubImage::uploadWithMapTexSubImage): + * platform/graphics/chromium/LayerTextureSubImage.h: + (WebKit): + (LayerTextureSubImage): + * platform/graphics/chromium/LayerTextureUpdater.h: + (WebCore): + (Texture): + * platform/graphics/chromium/ManagedTexture.cpp: + (WebCore::ManagedTexture::ManagedTexture): + (WebCore::ManagedTexture::reserve): + (WebCore::ManagedTexture::allocate): + (WebCore::ManagedTexture::steal): + (WebCore::ManagedTexture::clear): + * platform/graphics/chromium/ManagedTexture.h: + (WebCore::ManagedTexture::resourceId): + (ManagedTexture): + * platform/graphics/chromium/ScrollbarLayerChromium.cpp: + (WebCore::ScrollbarLayerChromium::pushPropertiesTo): + (WebCore::ScrollbarLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/TextureCopier.cpp: + (WebCore::AcceleratedTextureCopier::copyTexture): + (WebCore): + (WebCore::AcceleratedTextureCopier::flush): + * platform/graphics/chromium/TextureCopier.h: + (TextureCopier): + (AcceleratedTextureCopier): + * platform/graphics/chromium/TextureManager.cpp: + (WebCore::TextureManager::TextureManager): + (WebCore::TextureManager::deleteEvictedTextures): + (WebCore::TextureManager::removeTexture): + (WebCore::TextureManager::allocateTexture): + (WebCore::TextureManager::requestTexture): + * platform/graphics/chromium/TextureManager.h: + (WebCore): + (WebCore::TextureManager::create): + (TextureManager): + (TextureInfo): + (EvictionEntry): + * platform/graphics/chromium/TextureUploader.h: + (TextureUploader): + * platform/graphics/chromium/ThrottledTextureUploader.cpp: + (WebCore::ThrottledTextureUploader::uploadTexture): + * platform/graphics/chromium/ThrottledTextureUploader.h: + (ThrottledTextureUploader): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::pushPropertiesTo): + * platform/graphics/chromium/TrackingTextureAllocator.cpp: Removed. + * platform/graphics/chromium/TrackingTextureAllocator.h: Removed. + * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: + (WebCore::CCHeadsUpDisplay::draw): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::willDraw): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h: + (CCIOSurfaceLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::willDraw): + (WebCore::CCLayerImpl::didDraw): + (WebCore::CCLayerImpl::contentsResourceId): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::initializeLayerRenderer): + (WebCore::CCLayerTreeHost::deleteContentsTexturesOnImplThread): + (WebCore::CCLayerTreeHost::beginCommitOnImplThread): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::CCLayerTreeHostImpl::releaseContentsTextures): + (WebCore::CCLayerTreeHostImpl::didDrawAllLayers): + (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (WebCore): + (WebCore::CCLayerTreeHostImpl::resourceProvider): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + (WebCore::CCPrioritizedTexture::acquireBackingTexture): + (WebCore::CCPrioritizedTexture::resourceId): + (WebCore::CCPrioritizedTexture::upload): + (WebCore::CCPrioritizedTexture::beginRenderTo): + (WebCore::CCPrioritizedTexture::endRenderTo): + (WebCore): + * platform/graphics/chromium/cc/CCPrioritizedTexture.h: + (WebCore): + (CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::Backing::resourceId): + (WebCore::CCPrioritizedTexture::Backing::Backing): + (Backing): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + (WebCore::CCPrioritizedTextureManager::CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::~CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): + (WebCore::CCPrioritizedTextureManager::reduceMemory): + (WebCore::CCPrioritizedTextureManager::clearAllMemory): + (WebCore::CCPrioritizedTextureManager::allBackingTexturesWereDeleted): + (WebCore::CCPrioritizedTextureManager::createBacking): + (WebCore::CCPrioritizedTextureManager::destroyBacking): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: + (WebCore::CCPrioritizedTextureManager::create): + (CCPrioritizedTextureManager): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::maskResourceId): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderer.h: + (WebCore): + (CCRenderer): + * platform/graphics/chromium/cc/CCResourceProvider.cpp: Added. + (WebCore): + (WebCore::textureToStorageFormat): + (WebCore::isTextureFormatSupportedForStorage): + (WebCore::CCResourceProvider::create): + (WebCore::CCResourceProvider::~CCResourceProvider): + (WebCore::CCResourceProvider::graphicsContext3D): + (WebCore::CCResourceProvider::inUseByConsumer): + (WebCore::CCResourceProvider::createResource): + (WebCore::CCResourceProvider::createResourceFromExternalTexture): + (WebCore::CCResourceProvider::deleteResource): + (WebCore::CCResourceProvider::deleteOwnedResources): + (WebCore::CCResourceProvider::upload): + (WebCore::CCResourceProvider::beginRenderTo): + (WebCore::CCResourceProvider::endRenderTo): + (WebCore::CCResourceProvider::beginRenderFrom): + (WebCore::CCResourceProvider::endRenderFrom): + (WebCore::CCResourceProvider::CCResourceProvider): + (WebCore::CCResourceProvider::initialize): + * platform/graphics/chromium/cc/CCResourceProvider.h: Added. + (WebKit): + (WebCore): + (CCResourceProvider): + (WebCore::CCResourceProvider::maxTextureSize): + (WebCore::CCResourceProvider::numResources): + (Resource): + * platform/graphics/chromium/cc/CCScopedTexture.cpp: + (WebCore::CCScopedTexture::CCScopedTexture): + (WebCore::CCScopedTexture::allocate): + (WebCore::CCScopedTexture::free): + * platform/graphics/chromium/cc/CCScopedTexture.h: + (WebCore::CCScopedTexture::create): + (CCScopedTexture): + (WebCore::CCScopedTexture::beginRenderTo): + (WebCore::CCScopedTexture::endRenderTo): + (WebCore::CCScopedTexture::beginRenderFrom): + (WebCore::CCScopedTexture::endRenderFrom): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: + (WebCore::CCScrollbarLayerImpl::CCScrollbarLayerImpl): + (WebCore): + (WebCore::CCScrollbarLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: + (WebCore::CCScrollbarLayerImpl::setBackTrackResourceId): + (WebCore::CCScrollbarLayerImpl::setForeTrackResourceId): + (WebCore::CCScrollbarLayerImpl::setThumbResourceId): + (CCScrollbarLayerImpl): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::recreateContext): + (WebCore::CCSingleThreadProxy::doCommit): + (WebCore::CCSingleThreadProxy::stop): + * platform/graphics/chromium/cc/CCTexture.h: + (WebCore::CCTexture::id): + (WebCore::CCTexture::setId): + (CCTexture): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::CCTextureLayerImpl): + (WebCore::CCTextureLayerImpl::willDraw): + (WebCore): + (WebCore::CCTextureLayerImpl::appendQuads): + (WebCore::CCTextureLayerImpl::didDraw): + * platform/graphics/chromium/cc/CCTextureLayerImpl.h: + (CCTextureLayerImpl): + * platform/graphics/chromium/cc/CCTextureUpdater.cpp: + (WebCore::CCTextureUpdater::update): + * platform/graphics/chromium/cc/CCTextureUpdater.h: + (WebCore): + (CCTextureUpdater): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::scheduledActionUpdateMoreResources): + (WebCore::CCThreadProxy::layerTreeHostClosedOnImplThread): + (WebCore::CCThreadProxy::recreateContextOnImplThread): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::DrawableTile::resourceId): + (WebCore::DrawableTile::setResourceId): + (WebCore::DrawableTile::DrawableTile): + (DrawableTile): + (WebCore::CCTiledLayerImpl::contentsResourceId): + (WebCore::CCTiledLayerImpl::hasTextureIdForTileAt): + (WebCore::CCTiledLayerImpl::appendQuads): + (WebCore::CCTiledLayerImpl::pushTileProperties): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::CCVideoLayerImpl): + (WebCore::CCVideoLayerImpl::~CCVideoLayerImpl): + (WebCore::CCVideoLayerImpl::willDraw): + (WebCore::CCVideoLayerImpl::willDrawInternal): + (WebCore::CCVideoLayerImpl::appendQuads): + (WebCore::CCVideoLayerImpl::didDraw): + (WebCore::CCVideoLayerImpl::FramePlane::allocateData): + (WebCore::CCVideoLayerImpl::FramePlane::freeData): + (WebCore::CCVideoLayerImpl::allocatePlaneData): + (WebCore::CCVideoLayerImpl::copyPlaneData): + (WebCore::CCVideoLayerImpl::freePlaneData): + (WebCore::CCVideoLayerImpl::freeUnusedPlaneData): + (WebCore::CCVideoLayerImpl::didLoseContext): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (CCVideoLayerImpl): + (FramePlane): + (WebCore::CCVideoLayerImpl::FramePlane::FramePlane): + +2012-07-18 Hayato Ito <hayato@chromium.org> + + [Shadow] A 'selectstart' event fired on distributed nodes should not be stopped at shadow boundary of the parent shadow host. + https://bugs.webkit.org/show_bug.cgi?id=90508 + + Reviewed by Dimitri Glazkov. + + We should not stop some kinds of events at the shadow boundary of a shadow host if the + event is fired on distributed nodes. + + See the spec for such kinds of events. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#events-that-are-always-stopped + + Test: fast/dom/shadow/events-stopped-at-shadow-boundary.html + + * dom/EventDispatcher.cpp: + (WebCore::EventDispatcher::ensureEventAncestors): + (WebCore::inTheSameScope): + (WebCore): + (WebCore::EventDispatcher::determineDispatchBehavior): + * dom/EventDispatcher.h: + (EventDispatcher): + +2012-07-18 Julien Chaffraix <jchaffraix@webkit.org> + + Crash in RenderTableSection::addCell. + http://webkit.org/b/89496 + + Reviewed by Abhishek Arya. + + The issue comes from RenderBox::splitAnonymousBoxesAroundChild that would move sections + across tables but didn't force the table to do a synchronous section recalc. This opened + the way for race conditions where we would query the table column structure while it's dirty + (this is not uncommon but as usually the table's column representation is always bigger or + more split than a section's, it's usually harmless). + + The fix is to force a synchronous section recalc. + + Test: fast/table/split-table-no-section-update-crash.html + + * rendering/RenderBox.cpp: + (WebCore::markBoxForRelayoutAfterSplit): + Changed to call forceSectionsRecalc ie force a section recalc. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::recalcSections): + Added missing ASSERT for unneeded calls. + + * rendering/RenderTable.h: + (WebCore::RenderTable::forceSectionsRecalc): + Added this helper function. + +2012-07-18 Julien Chaffraix <jchaffraix@webkit.org> + + Avoid calling GraphicsContext drawing primitives for 0px borders + https://bugs.webkit.org/show_bug.cgi?id=90039 + + Reviewed by Eric Seidel. + + The current code would happily call GraphicsContext to draw empty (0px) borders. + There is no good use case for going all the way to GraphicsContext in this case as + 0px borders, regardless of the border-style, will not be painted. Thus this is a waste + of time on all platforms. On Chromium, this trigger some issues with pdf rendering as + Skia interprets 0px lines as very thin lines. + + This change adds 0-checks in the border painting code as well as ASSERTs for + performance and to catch future bad use. + + Test: fast/borders/0px-borders.html + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/openvg/GraphicsContextOpenVG.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::drawRect): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::GraphicsContext::drawRect): + Added an ASSERT on all platforms to catch incorrect use. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::BorderEdge::shouldRender): + Changed to not render 0px borders, which should avoid unneeded work + in the patining code (context saving / restoring or transparency layer + push). + + (WebCore::RenderBoxModelObject::paintOneBorderSide): + Added an ASSERT here that the border side is not empty. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::drawLineForBoxSide): + Added an early return with a comment as to why it's not feasible to + ASSERT as would be best. + +2012-07-18 Elliott Sprehn <esprehn@gmail.com> + + REGRESSION (r89900): Assertion failure on null view() when destroying the document + https://bugs.webkit.org/show_bug.cgi?id=91547 + + Reviewed by Abhishek Arya. + + Check for document destruction during insertion to avoid crash on null RenderView when trying + to count the number of RenderQuote and RenderCounter objects. + + Test: fast/css-generated-content/bug91547.html + + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::appendChildNode): + (WebCore::RenderObjectChildList::insertChildNode): + +2012-07-18 Nat Duca <nduca@chromium.org> + + [chromium] Add histogram for tracking compositor-thread frame rate + https://bugs.webkit.org/show_bug.cgi?id=91692 + + Reviewed by Adrienne Walker. + + This patch tracks the interval between compositor thread frames + and pushes it into a platform histogram. This allows us to track + compositor-thread frame rate in the wild. + + * platform/graphics/chromium/cc/CCFrameRateCounter.cpp: + (WebCore::CCFrameRateCounter::markBeginningOfFrame): + +2012-07-18 Dan Bernstein <mitz@apple.com> + + Hit testing in the gap between pages returns incorrect results + https://bugs.webkit.org/show_bug.cgi?id=91695 + + Reviewed by Dave Hyatt. + + Test: fast/multicol/hit-test-gap-between-pages.html + + * rendering/RenderBlock.h: + (RenderBlock): Promoted adjustPointToColumnContents from private to protected. + * rendering/RenderView.cpp: + (WebCore::RenderView::updateHitTestResult): If we get here, and we make the document element + the inner node, adjust the local point for columns. + +2012-07-18 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Direction parameter ignored by some openCursor() overloads + https://bugs.webkit.org/show_bug.cgi?id=91687 + + Reviewed by Tony Chang. + + A few of the openCursor() and openKeyCursor() overloads were not passing along the + direction parameter, resulting in the default direction being used. Trivial fixes. + Also, added a whitespace fix to a relevant console warning. + + Test: storage/indexeddb/cursor-overloads.html + + * Modules/indexeddb/IDBIndex.cpp: + (WebCore::IDBIndex::openCursor): + (WebCore::IDBIndex::openKeyCursor): + * Modules/indexeddb/IDBObjectStore.cpp: + (WebCore::IDBObjectStore::openCursor): + +2012-07-18 Erik Arvidsson <arv@chromium.org> + + [V8] Improve Replaceable extended attribute + https://bugs.webkit.org/show_bug.cgi?id=91668 + + Reviewed by Adam Barth. + + Replaceable is working by chance in the V8 bindings because V8 does not correctly handle + read only properties on the prototype chain. With this change we generate a setter that + uses ForceSet to replace the existing property when set. + + Test: fast/dom/Window/replaceable.html + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateReplaceableAttrSetter): + (GenerateFunctionCallback): + (GenerateSingleBatchedAttribute): + (GenerateImplementation): + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::replaceableAttribute): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + (webkit_dom_test_obj_get_replaceable_attribute): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + (WebCore::jsTestObjReplaceableAttribute): + (WebCore::setJSTestObjReplaceableAttribute): + * bindings/scripts/test/JS/JSTestObj.h: + (WebCore): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj replaceableAttribute]): + (-[DOMTestObj setReplaceableAttribute:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjV8Internal::replaceableAttributeAttrGetter): + (TestObjV8Internal): + (WebCore::TestObjV8Internal::TestObjReplaceableAttrSetter): + (WebCore): + +2012-07-18 Erik Arvidsson <arv@chromium.org> + + [V8] Remove temporary flag override for es52_globals + https://bugs.webkit.org/show_bug.cgi?id=91681 + + Reviewed by Adam Barth. + + V8 has now changed their default value for the es52_globals so we no longer needs this override. + + No new tests. No change in functionality. + + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::initContextIfNeeded): + * bindings/v8/WorkerContextExecutionProxy.cpp: + (WebCore::WorkerContextExecutionProxy::initIsolate): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: add id to SharedQuadState + https://bugs.webkit.org/show_bug.cgi?id=91670 + + Reviewed by Adrienne Walker. + + This assigns an integer ID to SharedQuadState objects and a + corresponding ID to quads. This ID is unique only within a + RenderPass and currently is just set to the index in the shared quad + state list. This is redundant with the pointer and exists to + simplify serialization. + + I found out that pointer rewriting within a pickler is blocked by + pointers to memory being const there, so the reassignment will have to + be performed in the application layer anyway. In that case, it's + simplest to add some ID integers. + + No new tests (will introduce them when making use of the ID). + + * platform/chromium/support/WebCompositorQuad.cpp: + (WebKit::WebCompositorQuad::WebCompositorQuad): + (WebKit::WebCompositorQuad::setSharedQuadState): + (WebKit): + * platform/chromium/support/WebCompositorSharedQuadState.cpp: + (WebKit::WebCompositorSharedQuadState::WebCompositorSharedQuadState): + (WebKit::WebCompositorSharedQuadState::create): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForLayer): + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + (WebCore::CCRenderPass::appendQuadsToFillScreen): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::createSharedQuadState): + (WebCore::CCRenderSurface::createReplicaSharedQuadState): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-07-18 Alexandre Elias <aelias@google.com> + + [chromium] Ubercomp: clean up CCRenderer interface + https://bugs.webkit.org/show_bug.cgi?id=91555 + + Reviewed by Adrienne Walker. + + I replaced the one-by-one RenderPass calls with a new drawFrame() + method that directly takes a CCRenderPassList, and moved a small + amount of code from CCLayerTreeHostImpl to implement it. In ubercomp + mode, we will produce a frame bundle rather than a command-stream, so + the full list is easier to work with. + + Also, give empty default implementations for the methods that don't + need to do anything in a non-GL context, and make private + setScissorToRect. + + No new tests (no-op refactoring). + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawFrame): + (WebCore): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::drawLayers): + * platform/graphics/chromium/cc/CCRenderer.h: + (WebCore::CCRenderer::viewportChanged): + (WebCore::CCRenderer::decideRenderPassAllocationsForFrame): + (WebCore::CCRenderer::haveCachedResourcesForRenderPassId): + (CCRenderer): + (WebCore::CCRenderer::finishDrawingFrame): + (WebCore::CCRenderer::doNoOp): + (WebCore::CCRenderer::isContextLost): + +2012-07-18 Pravin D <pravind.2k4@gmail.com> + + Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated + https://bugs.webkit.org/show_bug.cgi?id=11355 + + Reviewed by Julien Chaffraix. + + The content height of a child must be container height minus padding, border width and height of horizontal scrollbar(if any). + + Tests: fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html + fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computePercentageLogicalHeight): + (WebCore::RenderBox::computeReplacedLogicalHeightUsing): + Subtracting the height of the scrollbar from the client height when the client has percentage height. + +2012-07-18 Pravin D <pravind.2k4@gmail.com> + + Content size of child having percent height inside a fixed height container having overflow:auto is wrongly calculated + https://bugs.webkit.org/show_bug.cgi?id=11355 + + Reviewed by Julien Chaffraix. + + The content height of a child must be container height minus padding, border width and height of horizontal scrollbar(if any). + + Tests: fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto.html + fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computePercentageLogicalHeight): + (WebCore::RenderBox::computeReplacedLogicalHeightUsing): + Subtracting the height of the scrollbar from the client height when the client has percentage height. + +2012-07-18 Anantanarayanan G Iyengar <ananta@chromium.org> + + [chromium] Ensure that the compositor code which is aware of flipped status of video-textures + per platform sets the flipped bit to false on Windows. + https://bugs.webkit.org/show_bug.cgi?id=91562 + + Reviewed by Adrienne Walker. + + No new tests. (HW video decode is still only being tested manually for orientation) + + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + +2012-07-18 Emil A Eklund <eae@chromium.org> + + Replace uses of RenderBox::x(), y() in rendering code with with point and size methods + https://bugs.webkit.org/show_bug.cgi?id=91549 + + Reviewed by Eric Seidel. + + Replaces uses of RenderBox::x() and RenderBox::y() with + RenderBox::location(), RenderBox::locationOffset() and + RenderBox::frameRect(). + + No new tests, no change in functionality. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::positionNewFloats): + Use child->frameRect() and child->location() instead of constructing a + rect and size from the x, y, width and height values. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::repaintDuringLayoutIfMoved): + Compare and copy m_frameRect directly instead of comparing and copying + the individual values. + + (WebCore::RenderBox::localCaretRect): + Use location() instead of x() and y(). + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): + Use pixelSnappedIntSize and RenderBox::size() instead of computing and + snapping the width and height separately. + + * rendering/RenderImage.cpp: + (WebCore::RenderImage::nodeAtPoint): + USe locationOffset() instead of creating a new LayoutSize object from the + x() and y() values. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::updateHitTestResult): + Move by Size instead of x and y value. + + (WebCore::RenderInline::addFocusRingRects): + Move by Size instead of x and y value. + + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::offsetFromContainer): + Shrink offset by size instead of using x and y values. + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::layoutRows): + (WebCore::RenderTableSection::setLogicalPositionForCell): + Use child->frameRect() and child->location() instead of constructing a + rect and size from the x, y, width and height values. + + * rendering/svg/SVGRenderTreeAsText.cpp: + (WebCore::writeRenderSVGTextBox): + Use location() instead of x() and y(). + +2012-07-18 Tony Chang <tony@chromium.org> + + [chromium] Unreviewed, try to fix the chromium-win build after r123014. + + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + +2012-07-18 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Fix some coding style violations + https://bugs.webkit.org/show_bug.cgi?id=91565 + + Reviewed by Tony Chang. + + In declarations, put the * next to the type not the identifier. + Remove k as a prefix for various constants. + + No new tests - no functional changes. + + * Modules/indexeddb/IDBCursorBackendImpl.cpp: + (WebCore::IDBCursorBackendImpl::prefetchContinueInternal): + * Modules/indexeddb/IDBFactoryBackendImpl.cpp: + (WebCore::computeFileIdentifier): + * Modules/indexeddb/IDBKey.h: + (WebCore::IDBKey::IDBKey): + * Modules/indexeddb/IDBLevelDBBackingStore.cpp: + (WebCore::IDBLevelDBBackingStore::getDatabaseNames): + (WebCore::IDBLevelDBBackingStore::getIDBDatabaseMetaData): + (WebCore::IDBLevelDBBackingStore::createIDBDatabaseMetaData): + (WebCore::IDBLevelDBBackingStore::updateIDBDatabaseMetaData): + (WebCore::IDBLevelDBBackingStore::deleteDatabase): + (WebCore::IDBLevelDBBackingStore::getObjectStores): + (WebCore::getNewObjectStoreId): + (WebCore::IDBLevelDBBackingStore::createObjectStore): + (WebCore::IDBLevelDBBackingStore::deleteObjectStore): + (WebCore::getNewVersionNumber): + (WebCore::IDBLevelDBBackingStore::nextAutoIncrementNumber): + (WebCore::IDBLevelDBBackingStore::forEachObjectStoreRecord): + (WebCore::IDBLevelDBBackingStore::getIndexes): + (WebCore::getNewIndexId): + (WebCore::IDBLevelDBBackingStore::createIndex): + (WebCore::IDBLevelDBBackingStore::putIndexDataForRecord): + (WebCore): + * Modules/indexeddb/IDBLevelDBCoding.cpp: + (IDBLevelDBCoding): + (WebCore::IDBLevelDBCoding::maxIDBKey): + (WebCore::IDBLevelDBCoding::minIDBKey): + (WebCore::IDBLevelDBCoding::decodeVarInt): + (WebCore::IDBLevelDBCoding::encodeIDBKey): + (WebCore::IDBLevelDBCoding::decodeIDBKey): + (WebCore::IDBLevelDBCoding::extractEncodedIDBKey): + (WebCore::IDBLevelDBCoding::keyTypeByteToKeyType): + (WebCore::IDBLevelDBCoding::compareEncodedIDBKeys): + (WebCore::IDBLevelDBCoding::encodeIDBKeyPath): + (WebCore::IDBLevelDBCoding::decodeIDBKeyPath): + (WebCore::IDBLevelDBCoding::compare): + (WebCore::IDBLevelDBCoding::KeyPrefix::KeyPrefix): + (WebCore::IDBLevelDBCoding::KeyPrefix::encode): + (WebCore::IDBLevelDBCoding::KeyPrefix::compare): + (WebCore::IDBLevelDBCoding::KeyPrefix::type): + (WebCore::IDBLevelDBCoding::SchemaVersionKey::encode): + (WebCore::IDBLevelDBCoding::MaxDatabaseIdKey::encode): + (WebCore::IDBLevelDBCoding::DatabaseFreeListKey::decode): + (WebCore::IDBLevelDBCoding::DatabaseFreeListKey::encode): + (WebCore::IDBLevelDBCoding::DatabaseNameKey::decode): + (WebCore::IDBLevelDBCoding::DatabaseNameKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encodeMaxKey): + (WebCore::IDBLevelDBCoding::IndexMetaDataKey::decode): + (WebCore::IDBLevelDBCoding::IndexMetaDataKey::encode): + (WebCore::IDBLevelDBCoding::IndexMetaDataKey::encodeMaxKey): + (WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::encode): + (WebCore::IDBLevelDBCoding::IndexFreeListKey::decode): + (WebCore::IDBLevelDBCoding::IndexFreeListKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreNamesKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreNamesKey::encode): + (WebCore::IDBLevelDBCoding::IndexNamesKey::decode): + (WebCore::IDBLevelDBCoding::IndexNamesKey::encode): + (WebCore::IDBLevelDBCoding::ObjectStoreDataKey::decode): + (WebCore::IDBLevelDBCoding::ObjectStoreDataKey::encode): + (WebCore::IDBLevelDBCoding::ExistsEntryKey::decode): + (WebCore::IDBLevelDBCoding::ExistsEntryKey::encode): + (WebCore::IDBLevelDBCoding::IndexDataKey::decode): + * Modules/indexeddb/IDBLevelDBCoding.h: + (IDBLevelDBCoding): + (ObjectStoreDataKey): + (ExistsEntryKey): + +2012-07-18 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call SQLiteFileSystem-related functions directly + https://bugs.webkit.org/show_bug.cgi?id=91631 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * Modules/webdatabase/chromium/QuotaTracker.cpp: + (WebCore::QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin): + * platform/chromium/PlatformSupport.h: + (PlatformSupport): + * platform/sql/chromium/SQLiteFileSystemChromium.cpp: + (WebCore::SQLiteFileSystem::deleteDatabaseFile): + (WebCore::SQLiteFileSystem::getDatabaseFileSize): + * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp: + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + +2012-07-18 Oliver Hunt <oliver@apple.com> + + WebKit provides APIs that make it possible for JSC to attempt to initialise the heap without initialising threading + https://bugs.webkit.org/show_bug.cgi?id=91663 + + Reviewed by Filip Pizlo. + + Initialising a JSGlobalData now requires us to have initialised JSC's threading + logic, as that also initialises the JSC VM runtime options. WebKit provides a + number of routines that make use of commonJSGlobalData() that can be used before + webcore has called the appropriate initialisation routine. This patch makes the + minimal change of ensuring that commonJSGlobalData initialises threading before + attempting to create the common heap. + + * bindings/js/JSDOMWindowBase.cpp: + (WebCore::JSDOMWindowBase::commonJSGlobalData): + +2012-07-18 Michael Saboff <msaboff@apple.com> + + Make TextCodecUTF8 handle 8 bit data without converting to UChar's + https://bugs.webkit.org/show_bug.cgi?id=90320 + + Reviewed by Oliver Hunt. + + Change UTF8 Codec to produce 8-bit strings when data fits in 8-bit range. + First we try decoding the string as all 8-bit and then fall back to 16 bit + when we find the first character that doesn't fit in 8 bits. Then we take + the already decoded data and copy / convert it to a 16-bit buffer and then + continue process the rest of the stream as 16-bits. + + No new tests, no change in functionality. + + * platform/text/TextCodecUTF8.cpp: + (WebCore::TextCodecUTF8::handleError): + (WebCore::TextCodecUTF8::decode): + * platform/text/TextCodecUTF8.h: + (TextCodecUTF8): + +2012-07-18 Sailesh Agrawal <sail@chromium.org> + + Chromium Mac: Add TEXTURE_RECTANGLE_ARB support to CCVideoLayerImpl + https://bugs.webkit.org/show_bug.cgi?id=91169 + + Reviewed by Adrienne Walker. + + This extends CCVideoLayerImpl to support TEXTURE_RECTANGLE_ARB. This texture target is used by the Mac hardware accelerated video decoder. + + No new tests (HW video decode on Mac is being tested manually.). + + * platform/chromium/support/WebCompositorIOSurfaceQuad.cpp: + (WebKit::WebCompositorIOSurfaceQuad::create): Added an orientation argument. + (WebKit::WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad): Added an orientation argument. + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): Added support for non-flipped IOSurface textures. + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): Changed TextureIOSurfaceProgram to be non-flipped. To draw flipped textures drawIOSurfaceQuad sets a different value for texTransformLocation. + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::appendQuads): Updated call to CCIOSurfaceDrawQuad constructor. + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): Added support for drawing TEXTURE_RECTANGLE_ARB textures. + +2012-07-18 Michael Saboff <msaboff@apple.com> + + Make TextCodecLatin1 handle 8 bit data without converting to UChar's + https://bugs.webkit.org/show_bug.cgi?id=90319 + + Reviewed by Oliver Hunt. + + Updated codec to create 8 bit strings where possible. + We assume that the incoming stream can all be decoded as 8-bit values. + If we find a 16-bit value, we take the already decoded data and + copy / convert it to a 16-bit buffer and then continue process the rest + of the stream as 16-bits. + + No new tests, functionality covered with existing tests. + + * platform/text/TextCodecASCIIFastPath.h: + (WebCore::copyASCIIMachineWord): + * platform/text/TextCodecLatin1.cpp: + (WebCore::TextCodecLatin1::decode): + +2012-07-18 Dimitri Glazkov <dglazkov@chromium.org> + + Fix up old name in RuleSet::addRulesFromSheet + https://bugs.webkit.org/show_bug.cgi?id=91646 + + Reviewed by Andreas Kling. + + Simple parameter rename, no change in functionality. + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): Renamed styleSelector to resolver to reflect recent rename of the parameter type. + +2012-07-18 Vincent Scheib <scheib@chromium.org> + + Unify allowfullscreen logic in Document::webkitFullScreenEnabled and fullScreenIsAllowedForElement. + https://bugs.webkit.org/show_bug.cgi?id=91448 + + Reviewed by Adrienne Walker. + + Unifies redundant traversal logic and static cast previously used + to determine if an element or document can be made fullscreen. + This clean up prepares for pointer lock, which will use the same logic. + + Added a test to detect an edge case of an owning document with + fullscreen permision moving an iframe to fullscreen, while that iframe + does not have permision for its contents to be made fullscreen. + + Test: fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent.html + + * dom/Document.cpp: + (WebCore::isAttributeOnAllOwners): + (WebCore::Document::fullScreenIsAllowedForElement): + (WebCore::Document::webkitFullscreenEnabled): + +2012-07-18 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Add central error management to EFL port + https://bugs.webkit.org/show_bug.cgi?id=91598 + + Reviewed by Kenneth Rohde Christiansen. + + Define possible error types in ErrorsEfl so + that we can reuse the header in both WebKit1 + and WebKit2. This is inspired from the GTK + port. + + No new tests, no behavior change. + + * PlatformEfl.cmake: + * platform/efl/ErrorsEfl.cpp: Added. + (WebCore): + (WebCore::cancelledError): + (WebCore::blockedError): + (WebCore::cannotShowURLError): + (WebCore::interruptedForPolicyChangeError): + (WebCore::cannotShowMIMETypeError): + (WebCore::fileDoesNotExistError): + (WebCore::pluginWillHandleLoadError): + (WebCore::downloadNetworkError): + (WebCore::downloadCancelledByUserError): + (WebCore::downloadDestinationError): + (WebCore::printError): + (WebCore::printerNotFoundError): + (WebCore::invalidPageRangeToPrint): + * platform/efl/ErrorsEfl.h: Added. + (WebCore): + +2012-07-18 Varun Jain <varunjain@chromium.org> + + [chromium] Fix crash in DragImageTest caused by r122996 + https://bugs.webkit.org/show_bug.cgi?id=91653 + + Reviewed by Tony Chang. + + Covered by existing DragImageTest. + + * platform/chromium/DragImageChromiumSkia.cpp: + (WebCore::deleteDragImage): + +2012-07-18 Varun Jain <varunjain@chromium.org> + + [chromium] Drag image for image elements should be scaled with device scale factor. + https://bugs.webkit.org/show_bug.cgi?id=89688 + + Reviewed by Adam Barth. + + Modified ManualTest: ManualTests/chromium/drag-image-accounts-for-device-scale.html + + * page/Frame.cpp: + (WebCore::Frame::nodeImage): + (WebCore::Frame::dragImageForSelection): + * platform/chromium/DragImageChromiumSkia.cpp: + (WebCore::dragImageSize): + (WebCore::deleteDragImage): + (WebCore::scaleDragImage): + (WebCore::dissolveDragImageToFraction): + (WebCore::createDragImageFromImage): + * platform/chromium/DragImageRef.h: + (DragImageChromium): + (WebCore): + * platform/graphics/skia/BitmapImageSingleFrameSkia.h: + (BitmapImageSingleFrameSkia): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::ImageBuffer): + (WebCore::ImageBuffer::copyImage): + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia): + (WebCore::BitmapImageSingleFrameSkia::create): + * platform/graphics/skia/NativeImageSkia.cpp: + (WebCore::NativeImageSkia::NativeImageSkia): + * platform/graphics/skia/NativeImageSkia.h: + (NativeImageSkia): + (WebCore::NativeImageSkia::resolutionScale): + +2012-07-18 Yong Li <yoli@rim.com> + + [BlackBerry] Move about: URL handling out of WebCore + https://bugs.webkit.org/show_bug.cgi?id=91541 + + Reviewed by Rob Buis. + + Remove about URL handling from our NetworkJob. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::NetworkJob): + (WebCore::NetworkJob::initialize): + (WebCore::NetworkJob::cancelJob): + (WebCore::NetworkJob::sendResponseIfNeeded): + * platform/network/blackberry/NetworkJob.h: + (NetworkJob): + * platform/network/blackberry/NetworkManager.cpp: + (WebCore::NetworkManager::startJob): + +2012-07-18 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r122984. + http://trac.webkit.org/changeset/122984 + https://bugs.webkit.org/show_bug.cgi?id=91171 + + Broken the shared build, need to export a SkData in skia + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setURLForRect): + +2012-07-18 Rob Buis <rbuis@rim.com> + + Alignment crash in MIMESniffer + https://bugs.webkit.org/show_bug.cgi?id=89787 + + Reviewed by Yong Li. + + PR 169064 + + Prevent ASSERT on unaligned data. Special-case handling of unaligned data + to maskedCompareSlowCase. + + No test, too hard to reproduce. + + * platform/network/MIMESniffing.cpp: + (std::maskedCompareSlowCase): + (std): + (std::maskedCompare): + +2012-07-18 Steve VanDeBogart <vandebo@chromium.org> + + Chrome/Skia: PDF print output does not have clickable links. + https://bugs.webkit.org/show_bug.cgi?id=91171 + + Reviewed by Stephen White. + + Connect GraphicsContext::setURLForRect to Skia's new API for annotations. + + Printing is not generally testable. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setURLForRect): + +2012-07-18 Philippe Normand <pnormand@igalia.com> + + [GStreamer] 0.11 build broken + https://bugs.webkit.org/show_bug.cgi?id=91629 + + Reviewed by Alexis Menard. + + * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: + (webkitVideoSinkProposeAllocation): Pass null GstStructure to + gst_query_add_allocation_meta(). Our propose-allocation method + is simple enough to not need to set it. + +2012-07-18 Chris Fleizach <cfleizach@apple.com> + + AX: <input type="submit"> unlabelled. + https://bugs.webkit.org/show_bug.cgi?id=91563 + + Reviewed by Adele Peterson. + + Make sure the default value is returned if there is no other value specified. + + Test: platform/mac/accessibility/submit-button-default-value.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::title): + +2012-07-17 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove awkward anchorPoint usage that implicity affects layer position + https://bugs.webkit.org/show_bug.cgi?id=91472 + + Reviewed by Adrienne Walker. + + Covered by existing layout tests and unit tests, several existing unit tests updated. + + In GraphicsLayerChromium, anchorPoint() implicity affects + position(). Therefore, unit tests needed to remember to set + anchorPoint correctly when trying to position layers for + testing. However, it's easy to forget that initialization, and + probably shouldn't be necessary anyway since conceptually + anchorPoint does not affect layer position. + + This patch removes the "actualPosition + anchorPoint" quirk in + GraphicsLayerChromium, so that this problem is avoided. + + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::updateLayerPosition): No longer computes position + anchorPoint. Instead this is done in calcDrawTransformsInternal. + (WebCore::GraphicsLayerChromium::updateLayerSize): No longer affects computation of position. + (WebCore::GraphicsLayerChromium::updateAnchorPoint): No longer affects computation of position + (WebCore::GraphicsLayerChromium::updateLayerPreserves3D): Position is initialized to zero instead of relative to anchorPoint + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateDrawTransformsInternal): explicitly use position + anchorPoint in this code, for both layer and replica. + Note that replicaLayer now uses its own anchorPoint, which seems to be more consistent with Safari behavior. + +2012-07-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: [Regression] Save as file is missing in Network panel preview/response tabs. + https://bugs.webkit.org/show_bug.cgi?id=91625 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/HandlerRegistry.js: + * inspector/front-end/NetworkPanel.js: + +2012-07-18 Dirk Schulze <krit@webkit.org> + + SVG CSS property types with <number> don't support exponents + https://bugs.webkit.org/show_bug.cgi?id=52542 + + Reviewed by Nikolas Zimmermann. + + Parse numbers in SVG presentation attributes with SVG parser to support scientific notations. + The SVG parser is already well tested and has some extra checks for edge like protection from + overflow. + + The patch is based upon a patch of Bear Travis. + + Test: svg/css/scientific-numbers.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::lex): Use SVG parser to parse numbers of SVG attributes. + * svg/SVGParserUtilities.cpp: + (WebCore::parseSVGNumber): Added accessor to call from CSSParser with double value. + (WebCore): + * svg/SVGParserUtilities.h: + (WebCore): + + +2012-07-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: beautify the paused in debugger message, make it configurable from the front-end. + https://bugs.webkit.org/show_bug.cgi?id=91628 + + Reviewed by Vsevolod Vlasov. + + Made message smaller, using consistent font; + Made message configurable from the front-end. + + * English.lproj/localizedStrings.js: + * inspector/DOMNodeHighlighter.cpp: + (WebCore::InspectorOverlay::InspectorOverlay): + (WebCore::InspectorOverlay::setPausedInDebuggerMessage): + (WebCore::InspectorOverlay::update): + (WebCore::InspectorOverlay::drawPausedInDebugger): + * inspector/DOMNodeHighlighter.h: + (InspectorOverlay): + * inspector/Inspector.json: + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::setOverlayMessage): + (WebCore): + (WebCore::InspectorDebuggerAgent::clear): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/PageDebuggerAgent.cpp: + (WebCore::PageDebuggerAgent::setOverlayMessage): + * inspector/PageDebuggerAgent.h: + (PageDebuggerAgent): + * inspector/front-end/DebuggerModel.js: + (WebInspector.DebuggerModel.prototype._setDebuggerPausedDetails): + +2012-07-18 Douglas Stockwell <dstockwell@chromium.org> + + WebCore::StylePropertySet::addParsedProperties - crash + https://bugs.webkit.org/show_bug.cgi?id=91153 + + Reviewed by Andreas Kling. + + WebKitCSSKeyframeRule::style exposed an immutable StylePropertySet. + Modified to create a mutable copy on demand. + + Test: fast/css/css-keyframe-style-mutate-crash.html + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * css/WebKitCSSKeyframeRule.cpp: + (WebCore::StyleKeyframe::mutableProperties): Added, creates a mutable copy of properties as required. + (WebCore::WebKitCSSKeyframeRule::style): + * css/WebKitCSSKeyframeRule.h: + (WebCore::StyleKeyframe::properties): Made const, use mutableProperties to mutate. + +2012-07-18 Huang Dongsung <luxtella@company100.net> + + [Texmap] Make TextureMapperLayer clip m_state.needsDisplayRect with the layerRect. + https://bugs.webkit.org/show_bug.cgi?id=91595 + + Reviewed by Noam Rosenthal. + + Internal review by Kwang Yul Seo. + + Currently, TextureMapperLayer creates an ImageBuffer as big as + m_state.needsDisplayRect if m_state.needsDispaly is false. The size of + m_state.needsDisplayRect can be bigger than the size of the layerRect, so we may + consume more memory than the size of the layerRect. It even can cause crash if + m_state.needsDisplayRect is too big. + + No new tests, covered by existing tests. + + * platform/graphics/texmap/TextureMapperLayer.cpp: + (WebCore::TextureMapperLayer::updateBackingStore): + +2012-07-18 Jason Liu <jason.liu@torchmobile.com.cn> + + [BlackBerry] We should update the status in NetworkJob if there is a new one from libcurl. + https://bugs.webkit.org/show_bug.cgi?id=91475 + + Reviewed by Yong Li. + + Libcurl sometimes sends multiple status messages, we need to keep the last + one in NetworkJob. + We originally had the m_statusReceived check, then we found out that libcurl + sometimes sent additional 401 codes and added the 401 exception to the check, + and now we're removing the whole check(so we don't need the exception either). + + RIM PR# 163172 + Reviewed internally by Joe Mason. + + No new tests. This is caused by libcurl's multiple status messages. + So we don't need to write a test case for webkit. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::handleNotifyStatusReceived): + +2012-07-18 Kevin Ellis <kevers@chromium.org> + + TOUCH_ADJUSTMENT is too aggressive when snapping to large elements. + https://bugs.webkit.org/show_bug.cgi?id=91262 + + Reviewed by Antonio Gomes. + + Constrains the extent to which the touch point can be adjusted when + generating synthetic mouse events when TOUCH_ADJUSTEMNT is enabled. + Previously, the target position snapped to the center of the target + element, which can be far removed from the touch position when tapping + on or near a large element. The refined strategy is to leave the + adjusted position unchanged if tapping within the element or to snap + to the center of the overlap region if the touch point lies outside the + bounds of the element, but the touch area and element bounds overlap. + For non-rectilineary bounds, a point lying outside the element boundary + is pulled towards the center of the element, by an amount limited by + the radius of the touch area. + + Tests: touchadjustment/big-div.html + touchadjustment/rotated-node.html + + * page/TouchAdjustment.cpp: + (WebCore::TouchAdjustment::contentsToWindow): + (TouchAdjustment): + (WebCore::TouchAdjustment::snapTo): + (WebCore::TouchAdjustment::findNodeWithLowestDistanceMetric): + +2012-07-18 Sergey Rogulenko <rogulenko@google.com> + + Web Inspector: adding pause icon for JavaScript debugging + https://bugs.webkit.org/show_bug.cgi?id=90880 + + Reviewed by Pavel Feldman. + + Refactored DOMNodeHighlighter into InspectorOverlay class and added a feature to show a "pause" screen when + the Javascript debugger is paused. + + * inspector/DOMNodeHighlighter.cpp: + (WebCore::InspectorOverlay::InspectorOverlay): + (WebCore::InspectorOverlay::paint): + (WebCore::InspectorOverlay::drawOutline): + (WebCore::InspectorOverlay::getHighlight): + (WebCore::InspectorOverlay::setPausedInDebugger): + (WebCore::InspectorOverlay::hideHighlight): + (WebCore): + (WebCore::InspectorOverlay::highlightNode): + (WebCore::InspectorOverlay::setHighlightData): + (WebCore::InspectorOverlay::clearHighlightData): + (WebCore::InspectorOverlay::highlightedNode): + (WebCore::InspectorOverlay::update): + (WebCore::InspectorOverlay::drawHighlight): + (WebCore::InspectorOverlay::drawPausedInDebugger): + * inspector/DOMNodeHighlighter.h: + (WebCore): + (InspectorOverlay): + (WebCore::InspectorOverlay::create): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::drawHighlight): + (WebCore::InspectorController::getHighlight): + (WebCore::InspectorController::highlightedNode): + * inspector/InspectorController.h: + (WebCore): + (InspectorController): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::~InspectorDOMAgent): + (WebCore::InspectorDOMAgent::handleMousePress): + (WebCore::InspectorDOMAgent::mouseDidMoveOverElement): + (WebCore::InspectorDOMAgent::setSearchingForNode): + (WebCore::InspectorDOMAgent::setHighlightDataFromConfig): + (WebCore::InspectorDOMAgent::setInspectModeEnabled): + (WebCore::InspectorDOMAgent::highlightRect): + (WebCore::InspectorDOMAgent::highlightNode): + (WebCore::InspectorDOMAgent::highlightFrame): + (WebCore::InspectorDOMAgent::hideHighlight): + * inspector/InspectorDOMAgent.h: + (WebCore): + (WebCore::InspectorDOMAgent::create): + (InspectorDOMAgent): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::create): + (WebCore::InspectorPageAgent::InspectorPageAgent): + (WebCore::InspectorPageAgent::didPaint): + * inspector/InspectorPageAgent.h: + (WebCore): + * inspector/PageDebuggerAgent.cpp: + (WebCore::PageDebuggerAgent::create): + (WebCore::PageDebuggerAgent::PageDebuggerAgent): + (WebCore::PageDebuggerAgent::disable): + (WebCore): + (WebCore::PageDebuggerAgent::didPause): + (WebCore::PageDebuggerAgent::didContinue): + * inspector/PageDebuggerAgent.h: + (WebCore): + (PageDebuggerAgent): + +2012-07-17 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: intern strings when processing timeline records + https://bugs.webkit.org/show_bug.cgi?id=91531 + + Reviewed by Pavel Feldman. + + - added StringPool that is capable of interning strings; + - used it in TimelineModel to process all incoming records; + + * inspector/front-end/TimelineModel.js: + (WebInspector.TimelineModel): + (WebInspector.TimelineModel.prototype._addRecord): + (WebInspector.TimelineModel.prototype.reset): + * inspector/front-end/utilities.js: + +2012-07-18 Scott Graham <scottmg@chromium.org> + + Use cl to preprocess IDL for Chromium Windows generate_supplemental_dependency + https://bugs.webkit.org/show_bug.cgi?id=91548 + + Reviewed by Kentaro Hara. + + Use cl.exe as preprocessor for IDL files rather than cygwin gcc. Cuts + two minute execution time on Windows by a bit better than 50%. + + No new tests. + + * WebCore.gyp/WebCore.gyp: + * bindings/scripts/preprocessor.pm: + (applyPreprocessor): + +2012-07-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: remove search replace from behind experiment, polish the behavior + https://bugs.webkit.org/show_bug.cgi?id=91519 + + Reviewed by Vsevolod Vlasov. + + - This change makes replace loop with no boundary, removes the loop parameter + from jumpToNext/Previous; + - Lays out replace as a second row + - Fixes replace all with no search matches + - Splits Search and Search and Replace + - Introduces explicit Next / Previous buttons in the search mode + - Introduces editRange on the TextEditor so that it was preserving the undo stack + (we'll need to fix editor so that it does not require it). + + * English.lproj/localizedStrings.js: + * inspector/front-end/ConsolePanel.js: + (WebInspector.ConsolePanel.prototype.performSearch): + (WebInspector.ConsolePanel.prototype.jumpToNextSearchResult): + (WebInspector.ConsolePanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.jumpToNextSearchResult): + (WebInspector.ElementsPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ExtensionPanel.js: + (WebInspector.ExtensionPanel.prototype.performSearch): + (WebInspector.ExtensionPanel.prototype.jumpToNextSearchResult): + (WebInspector.ExtensionPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/JavaScriptSourceFrame.js: + (WebInspector.JavaScriptSourceFrame.prototype.beforeTextChanged): + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkLogView.prototype.jumpToPreviousSearchResult): + (WebInspector.NetworkLogView.prototype.jumpToNextSearchResult): + (WebInspector.NetworkPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.NetworkPanel.prototype.jumpToNextSearchResult): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.performSearch): + (WebInspector.Panel.prototype.jumpToNextSearchResult): + (WebInspector.Panel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype.jumpToNextSearchResult): + (WebInspector.ProfilesPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.jumpToNextSearchResult): + (WebInspector.ResourcesPanel.prototype.jumpToPreviousSearchResult): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._editorClosed): + (WebInspector.ScriptsPanel.prototype._editorSelected): + (WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback): + (WebInspector.ScriptsPanel.prototype.performSearch): + (WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult): + (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.ScriptsPanel.prototype.replaceSelectionWith): + (WebInspector.ScriptsPanel.prototype.replaceAllWith): + * inspector/front-end/SearchController.js: + (WebInspector.SearchController): + (WebInspector.SearchController.prototype.cancelSearch): + (WebInspector.SearchController.prototype.resetSearch): + (WebInspector.SearchController.prototype.handleShortcut): + (WebInspector.SearchController.prototype._updateSearchNavigationButtonState): + (WebInspector.SearchController.prototype._updateReplaceVisibility): + (WebInspector.SearchController.prototype._onKeyDown): + (WebInspector.SearchController.prototype._onNextButtonSearch): + (WebInspector.SearchController.prototype._onPrevButtonSearch): + (WebInspector.SearchController.prototype._performSearch): + (WebInspector.SearchController.prototype._updateReplaceDetailsVisibility): + (WebInspector.SearchController.prototype._replace): + (WebInspector.SearchController.prototype._replaceAll): + * inspector/front-end/Settings.js: + (WebInspector.ExperimentsSettings): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.beforeTextChanged): + (WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches): + (WebInspector.SourceFrame.prototype.performSearch): + (WebInspector.SourceFrame.prototype.replaceSearchMatchWith): + (WebInspector.SourceFrame.prototype.replaceAllWith): + (WebInspector.TextEditorDelegateForSourceFrame.prototype.beforeTextChanged): + * inspector/front-end/TextEditor.js: + (WebInspector.TextEditor.prototype.editRange): + * inspector/front-end/inspector.css: + (.toolbar-search-replace .search-replace): + (.toolbar-search): + (.toolbar-search-replace): + (.toolbar-search-close-button): + (.toolbar-search-close-button:hover): + (.toolbar-search-close-button:active): + (.toolbar-search input[type="checkbox"]): + (.toolbar-search-replace .toolbar-replace-control): + +2012-07-18 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] Divide ENABLE(WEBGL) into ENABLE(WEBGL) and USE(3D_GRAPHICS) in CMakeLists.txt + https://bugs.webkit.org/show_bug.cgi?id=91584 + + Reviewed by Noam Rosenthal. + + This patch is a subset of Efl's UI_SIDE_COMPOSITING implementation. + Modified CMakeLists.txt so that the basic 3D-graphics sources can be compiled even when WebGL is disabled. + + * CMakeLists.txt: + * PlatformEfl.cmake: + * platform/graphics/GraphicsContext3D.h: + (GraphicsContext3D): + * platform/graphics/efl/GraphicsContext3DEfl.cpp: + (WebCore::GraphicsContext3D::platformGraphicsContext3D): + +2012-07-18 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt + https://bugs.webkit.org/show_bug.cgi?id=91600 + + Reviewed by Andreas Kling. + + Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages() + instead of the direct imagetypes at the appropriate places. + + Covered by existing tests. + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::paintToCanvas): + * platform/graphics/qt/PathQt.cpp: + (WebCore::scratchContext): + * platform/graphics/texmap/TextureMapperGL.cpp: + (WebCore::TextureMapperGL::drawRepaintCounter): + * platform/graphics/texmap/TextureMapperImageBuffer.cpp: + (WebCore::BitmapTextureImageBuffer::updateContents): + +2012-07-18 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: create timeline detail records lazily + https://bugs.webkit.org/show_bug.cgi?id=91513 + + Reviewed by Pavel Feldman. + + - only create timeline record details when these are used; + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelineRecordListRow.prototype.update): + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent): + (WebInspector.TimelinePresentationModel.Record.prototype._refreshDetails): + (WebInspector.TimelinePresentationModel.Record.prototype.details): + 2012-07-18 Simon Hausmann <simon.hausmann@nokia.com> [ANGLE] On QT, use Bison and Flex during ANGLE build diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig index 7f95c3018..80259a75e 100644 --- a/Source/WebCore/Configurations/FeatureDefines.xcconfig +++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig @@ -48,9 +48,9 @@ ENABLE_CSS_VARIABLES = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; -ENABLE_DATALIST = ; +ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; -ENABLE_DETAILS = ENABLE_DETAILS; +ENABLE_DETAILS_ELEMENT = ENABLE_DETAILS_ELEMENT; ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; @@ -97,7 +97,7 @@ ENABLE_LINK_PRERENDER = ; ENABLE_MATHML = ENABLE_MATHML; ENABLE_MEDIA_SOURCE = ; ENABLE_MEDIA_STATISTICS = ; -ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_METER_ELEMENT = ENABLE_METER_ELEMENT; ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; @@ -107,7 +107,7 @@ ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; -ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; @@ -134,4 +134,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 767073e7d..ea60b26b7 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -815,24 +815,24 @@ WebKitFontFamilyNames.cpp WebKitFontFamilyNames.h : dom/make_names.pl css/WebKit # HTML tag and attribute names -ifeq ($(findstring ENABLE_DATALIST,$(FEATURE_DEFINES)), ENABLE_DATALIST) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST=1 +ifeq ($(findstring ENABLE_DATALIST_ELEMENT,$(FEATURE_DEFINES)), ENABLE_DATALIST_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST_ELEMENT=1 endif -ifeq ($(findstring ENABLE_DETAILS,$(FEATURE_DEFINES)), ENABLE_DETAILS) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_DETAILS=1 +ifeq ($(findstring ENABLE_DETAILS_ELEMENT,$(FEATURE_DEFINES)), ENABLE_DETAILS_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_DETAILS_ELEMENT=1 endif -ifeq ($(findstring ENABLE_METER_TAG,$(FEATURE_DEFINES)), ENABLE_METER_TAG) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_METER_TAG=1 +ifeq ($(findstring ENABLE_METER_ELEMENT,$(FEATURE_DEFINES)), ENABLE_METER_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_METER_ELEMENT=1 endif ifeq ($(findstring ENABLE_MICRODATA,$(FEATURE_DEFINES)), ENABLE_MICRODATA) HTML_FLAGS := $(HTML_FLAGS) ENABLE_MICRODATA=1 endif -ifeq ($(findstring ENABLE_PROGRESS_TAG,$(FEATURE_DEFINES)), ENABLE_PROGRESS_TAG) - HTML_FLAGS := $(HTML_FLAGS) ENABLE_PROGRESS_TAG=1 +ifeq ($(findstring ENABLE_PROGRESS_ELEMENT,$(FEATURE_DEFINES)), ENABLE_PROGRESS_ELEMENT) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_PROGRESS_ELEMENT=1 endif ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO) diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 9edc64141..70a18a05e 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -75,7 +75,6 @@ localizedStrings["Aggregated Time"] = "Aggregated Time"; localizedStrings["All Nodes"] = "All Nodes"; localizedStrings["All Panels"] = "All Panels"; localizedStrings["All"] = "All"; -localizedStrings["Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation"] = "Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation"; localizedStrings["Always enable"] = "Always enable"; localizedStrings["An error occurred trying to\nread the “%s” table."] = "An error occurred trying to\nread the “%s” table."; localizedStrings["An unexpected error %s occurred."] = "An unexpected error %s occurred."; @@ -215,6 +214,8 @@ localizedStrings["Font"] = "Font"; localizedStrings["Font scale factor:"] = "Font scale factor:"; localizedStrings["Fonts"] = "Fonts"; localizedStrings["Form Data"] = "Form Data"; +localizedStrings["Program"] = "Program"; +localizedStrings["Unknown: "] = "Unknown: %s"; localizedStrings["Function Call"] = "Function Call"; localizedStrings["Function"] = "Function"; localizedStrings["GC Event"] = "GC Event"; @@ -723,4 +724,5 @@ localizedStrings["Time End"] = "Time End"; localizedStrings["Find"] = "Find"; localizedStrings["Replace"] = "Replace"; localizedStrings["Replace All"] = "Replace All"; -localizedStrings["Skip"] = "Skip"; +localizedStrings["Previous"] = "Previous"; +localizedStrings["Paused in debugger"] = "Paused in debugger"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index aa102c8c1..5871c6bcb 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -169,26 +169,26 @@ endif # END TARGET_WIN32 # ---- # HTML Details Element # ---- -if ENABLE_DETAILS -FEATURE_DEFINES += ENABLE_DETAILS=1 -webcore_cppflags += -DENABLE_DETAILS=1 -endif # END ENABLE_DETAILS +if ENABLE_DETAILS_ELEMENT +FEATURE_DEFINES += ENABLE_DETAILS_ELEMENT=1 +webcore_cppflags += -DENABLE_DETAILS_ELEMENT=1 +endif # END ENABLE_DETAILS_ELEMENT # ---- # HTML Meter Element # ---- -if ENABLE_METER_TAG -FEATURE_DEFINES += ENABLE_METER_TAG=1 -webcore_cppflags += -DENABLE_METER_TAG=1 -endif # END ENABLE_METER_TAG +if ENABLE_METER_ELEMENT +FEATURE_DEFINES += ENABLE_METER_ELEMENT=1 +webcore_cppflags += -DENABLE_METER_ELEMENT=1 +endif # END ENABLE_METER_ELEMENT # ---- # HTML Progress Element # ---- -if ENABLE_PROGRESS_TAG -FEATURE_DEFINES += ENABLE_PROGRESS_TAG=1 -webcore_cppflags += -DENABLE_PROGRESS_TAG=1 -endif # END ENABLE_PROGRESS_TAG +if ENABLE_PROGRESS_ELEMENT +FEATURE_DEFINES += ENABLE_PROGRESS_ELEMENT=1 +webcore_cppflags += -DENABLE_PROGRESS_ELEMENT=1 +endif # END ENABLE_PROGRESS_ELEMENT # ---- # JavaScript Debugger/Profiler @@ -223,11 +223,11 @@ endif # END ENABLE_SQL_DATABASE # ---- # HTML5 datalist Support # ---- -if ENABLE_DATALIST -FEATURE_DEFINES += ENABLE_DATALIST=1 -HTML_FEATURES += ENABLE_DATALIST=1 -webcore_cppflags += -DENABLE_DATALIST=1 -endif # END ENABLE_DATALIST +if ENABLE_DATALIST_ELEMENT +FEATURE_DEFINES += ENABLE_DATALIST_ELEMENT=1 +HTML_FEATURES += ENABLE_DATALIST_ELEMENT=1 +webcore_cppflags += -DENABLE_DATALIST_ELEMENT=1 +endif # END ENABLE_DATALIST_ELEMENT # ---- # HTML5 data transfer items support diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp index 6e28691af..ef34cb8c7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp @@ -182,16 +182,11 @@ void IDBCursor::advance(unsigned long count, ExceptionCode& ec) } if (!count) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return; } - if (!m_request->resetReadyState(m_transaction.get())) { - ASSERT_NOT_REACHED(); - ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; - return; - } - m_request->setCursor(this); + m_request->setPendingCursor(this); m_gotValue = false; m_backend->advance(count, m_request, ec); } @@ -216,14 +211,9 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec) // FIXME: We're not using the context from when continue was called, which means the callback // will be on the original context openCursor was called on. Is this right? - if (m_request->resetReadyState(m_transaction.get())) { - m_request->setCursor(this); - m_gotValue = false; - m_backend->continueFunction(key, m_request, ec); - } else { - ASSERT_NOT_REACHED(); - ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; - } + m_request->setPendingCursor(this); + m_gotValue = false; + m_backend->continueFunction(key, m_request, ec); } PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec) @@ -306,7 +296,7 @@ IDBCursor::Direction IDBCursor::stringToDirection(const String& directionString, if (directionString == IDBCursor::directionPrevUnique()) return IDBCursor::PREV_NO_DUPLICATE; - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBCursor::NEXT; } @@ -326,7 +316,7 @@ const AtomicString& IDBCursor::directionToString(unsigned short direction, Excep return IDBCursor::directionPrevUnique(); default: - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBCursor::directionNext(); } } diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp index fe58988e4..ae27af8a3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp @@ -37,12 +37,12 @@ #include "IDBObjectStoreBackendImpl.h" #include "IDBRequest.h" #include "IDBTracing.h" -#include "IDBTransactionBackendInterface.h" +#include "IDBTransactionBackendImpl.h" #include "SerializedScriptValue.h" namespace WebCore { -IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore) +IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore) : m_cursor(cursor) , m_direction(direction) , m_cursorType(cursorType) @@ -189,7 +189,7 @@ void IDBCursorBackendImpl::prefetchContinueInternal(ScriptExecutionContext*, Pas if (cursor->m_cursor) cursor->m_savedCursor = cursor->m_cursor->clone(); - const size_t kMaxSizeEstimate = 10 * 1024 * 1024; + const size_t maxSizeEstimate = 10 * 1024 * 1024; size_t sizeEstimate = 0; for (int i = 0; i < numberToFetch; ++i) { @@ -211,7 +211,7 @@ void IDBCursorBackendImpl::prefetchContinueInternal(ScriptExecutionContext*, Pas if (cursor->m_cursorType != IDBCursorBackendInterface::IndexKeyCursor) sizeEstimate += cursor->m_cursor->value().length() * sizeof(UChar); - if (sizeEstimate > kMaxSizeEstimate) + if (sizeEstimate > maxSizeEstimate) break; } diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h index 153016f12..043c40352 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h @@ -41,18 +41,19 @@ namespace WebCore { class IDBDatabaseBackendImpl; class IDBIndexBackendImpl; class IDBKeyRange; -class IDBObjectStoreBackendInterface; -class IDBTransactionBackendInterface; +class IDBObjectStoreBackendImpl; +class IDBTransactionBackendImpl; class SerializedScriptValue; class IDBCursorBackendImpl : public IDBCursorBackendInterface { public: - static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendInterface* transaction, IDBObjectStoreBackendInterface* objectStore) + static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction direction, CursorType cursorType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore) { return adoptRef(new IDBCursorBackendImpl(cursor, direction, cursorType, transaction, objectStore)); } virtual ~IDBCursorBackendImpl(); + // IDBCursorBackendInterface virtual PassRefPtr<IDBKey> key() const; virtual PassRefPtr<IDBKey> primaryKey() const; virtual PassRefPtr<SerializedScriptValue> value() const; @@ -62,11 +63,12 @@ public: virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&); virtual void prefetchReset(int usedPrefetches, int unusedPrefetches); - void close(); virtual void postSuccessHandlerCallback() { ASSERT_NOT_REACHED(); } + void close(); + private: - IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor>, IDBCursor::Direction, CursorType, IDBTransactionBackendInterface*, IDBObjectStoreBackendInterface*); + IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor>, IDBCursor::Direction, CursorType, IDBTransactionBackendImpl*, IDBObjectStoreBackendImpl*); static void advanceInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, unsigned long, PassRefPtr<IDBCallbacks>); static void continueFunctionInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); @@ -76,9 +78,9 @@ private: RefPtr<IDBBackingStore::Cursor> m_savedCursor; IDBCursor::Direction m_direction; CursorType m_cursorType; - RefPtr<IDBTransactionBackendInterface> m_transaction; - RefPtr<IDBObjectStoreBackendInterface> m_objectStore; - + RefPtr<IDBTransactionBackendImpl> m_transaction; + RefPtr<IDBObjectStoreBackendImpl> m_objectStore; + bool m_closed; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index 35b5ca1f0..2f9c8932e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -190,7 +190,7 @@ void IDBDatabase::deleteObjectStore(const String& name, ExceptionCode& ec) PassRefPtr<IDBVersionChangeRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version, ExceptionCode& ec) { if (version.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp index 505ba757b..e45147d5c 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp @@ -136,7 +136,7 @@ PassRefPtr<IDBBackingStore> IDBDatabaseBackendImpl::backingStore() const IDBDatabaseMetadata IDBDatabaseBackendImpl::metadata() const { - IDBDatabaseMetadata metadata(m_name, m_version); + IDBDatabaseMetadata metadata(m_name, m_version, IDBDatabaseMetadata::NoIntVersion); for (ObjectStoreMap::const_iterator it = m_objectStores.begin(); it != m_objectStores.end(); ++it) metadata.objectStores.set(it->first, it->second->metadata()); return metadata; @@ -144,16 +144,18 @@ IDBDatabaseMetadata IDBDatabaseBackendImpl::metadata() const PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(!m_objectStores.contains(name)); RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(this, name, keyPath, autoIncrement); ASSERT(objectStore->name() == name); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + RefPtr<IDBDatabaseBackendImpl> database = this; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, objectStore, transaction), - createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreFromMap, database, objectStore))) { + if (!transaction->scheduleTask( + createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, objectStore, transaction), + createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreFromMap, database, objectStore))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return 0; } @@ -162,7 +164,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectS return objectStore.release(); } -void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction) { int64_t objectStoreId; @@ -175,28 +177,30 @@ void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, transaction->didCompleteTaskEvents(); } -PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::objectStore(const String& name) +PassRefPtr<IDBObjectStoreBackendImpl> IDBDatabaseBackendImpl::objectStore(const String& name) { return m_objectStores.get(name); } void IDBDatabaseBackendImpl::deleteObjectStore(const String& name, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(m_objectStores.contains(name)); RefPtr<IDBDatabaseBackendImpl> database = this; RefPtr<IDBObjectStoreBackendImpl> objectStore = m_objectStores.get(name); - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::deleteObjectStoreInternal, database, objectStore, transaction), - createCallbackTask(&IDBDatabaseBackendImpl::addObjectStoreToMap, database, objectStore))) { + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + + if (!transaction->scheduleTask( + createCallbackTask(&IDBDatabaseBackendImpl::deleteObjectStoreInternal, database, objectStore, transaction), + createCallbackTask(&IDBDatabaseBackendImpl::addObjectStoreToMap, database, objectStore))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return; } m_objectStores.remove(name); } -void IDBDatabaseBackendImpl::deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBDatabaseBackendImpl::deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction) { database->m_backingStore->deleteObjectStore(database->id(), objectStore->id()); transaction->didCompleteTaskEvents(); @@ -230,18 +234,21 @@ void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCal } RefPtr<DOMStringList> objectStoreNames = DOMStringList::create(); - RefPtr<IDBTransactionBackendInterface> transaction = this->transaction(objectStoreNames.get(), IDBTransaction::VERSION_CHANGE, ec); + RefPtr<IDBTransactionBackendInterface> transactionInterface = this->transaction(objectStoreNames.get(), IDBTransaction::VERSION_CHANGE, ec); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionInterface.get()); ASSERT(!ec); RefPtr<IDBDatabaseBackendImpl> database = this; - if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::setVersionInternal, database, version, callbacks, transaction), - createCallbackTask(&IDBDatabaseBackendImpl::resetVersion, database, m_version))) { + if (!transaction->scheduleTask( + createCallbackTask(&IDBDatabaseBackendImpl::setVersionInternal, database, version, callbacks, transaction), + createCallbackTask(&IDBDatabaseBackendImpl::resetVersion, database, m_version))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } } -void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> prpTransaction) { + RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction; int64_t databaseId = database->id(); database->m_version = version; if (!database->m_backingStore->updateIDBDatabaseMetaData(databaseId, database->m_version)) { @@ -249,21 +256,21 @@ void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRef transaction->abort(); return; } - callbacks->onSuccess(transaction); + callbacks->onSuccess(PassRefPtr<IDBTransactionBackendInterface>(transaction)); } -void IDBDatabaseBackendImpl::transactionStarted(PassRefPtr<IDBTransactionBackendInterface> prpTransaction) +void IDBDatabaseBackendImpl::transactionStarted(PassRefPtr<IDBTransactionBackendImpl> prpTransaction) { - RefPtr<IDBTransactionBackendInterface> transaction = prpTransaction; + RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction; if (transaction->mode() == IDBTransaction::VERSION_CHANGE) { ASSERT(!m_runningVersionChangeTransaction); m_runningVersionChangeTransaction = transaction; } } -void IDBDatabaseBackendImpl::transactionFinished(PassRefPtr<IDBTransactionBackendInterface> prpTransaction) +void IDBDatabaseBackendImpl::transactionFinished(PassRefPtr<IDBTransactionBackendImpl> prpTransaction) { - RefPtr<IDBTransactionBackendInterface> transaction = prpTransaction; + RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction; ASSERT(m_transactions.contains(transaction.get())); m_transactions.remove(transaction.get()); if (transaction->mode() == IDBTransaction::VERSION_CHANGE) { @@ -338,7 +345,7 @@ PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(D } } - RefPtr<IDBTransactionBackendInterface> transaction = IDBTransactionBackendImpl::create(objectStoreNames, mode, this); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::create(objectStoreNames, mode, this); m_transactions.add(transaction.get()); return transaction.release(); } diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h index 21f4f93c1..805eb617f 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h @@ -41,6 +41,7 @@ class IDBBackingStore; class IDBDatabase; class IDBFactoryBackendImpl; class IDBObjectStoreBackendImpl; +class IDBTransactionBackendImpl; class IDBTransactionBackendInterface; class IDBTransactionCoordinator; @@ -58,18 +59,18 @@ public: void openConnection(PassRefPtr<IDBCallbacks>); void deleteDatabase(PassRefPtr<IDBCallbacks>); + // IDBDatabaseBackendInterface virtual IDBDatabaseMetadata metadata() const; - virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&); virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&); virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&); virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* objectStoreNames, unsigned short mode, ExceptionCode&); virtual void close(PassRefPtr<IDBDatabaseCallbacks>); - PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name); + PassRefPtr<IDBObjectStoreBackendImpl> objectStore(const String& name); IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); } - void transactionStarted(PassRefPtr<IDBTransactionBackendInterface>); - void transactionFinished(PassRefPtr<IDBTransactionBackendInterface>); + void transactionStarted(PassRefPtr<IDBTransactionBackendImpl>); + void transactionFinished(PassRefPtr<IDBTransactionBackendImpl>); private: IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier); @@ -79,9 +80,9 @@ private: int32_t connectionCount(); void processPendingCalls(); - static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); + static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); // These are used as setVersion transaction abort tasks. static void removeObjectStoreFromMap(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>); @@ -101,9 +102,9 @@ private: ObjectStoreMap m_objectStores; RefPtr<IDBTransactionCoordinator> m_transactionCoordinator; - RefPtr<IDBTransactionBackendInterface> m_runningVersionChangeTransaction; + RefPtr<IDBTransactionBackendImpl> m_runningVersionChangeTransaction; - typedef HashSet<IDBTransactionBackendInterface*> TransactionSet; + typedef HashSet<IDBTransactionBackendImpl*> TransactionSet; TransactionSet m_transactions; class PendingSetVersionCall; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp index 803499055..fe850bb19 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp @@ -62,8 +62,7 @@ static const struct IDBDatabaseExceptionNameDescription { { "QuotaExceededError", "The operation failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.", QUOTA_EXCEEDED_ERR }, // FIXME: This isn't used yet { "SyntaxError", "The keypath argument contains an invalid key path.", SYNTAX_ERR }, { "DataCloneError", "The data being stored could not be cloned by the internal structured cloning algorithm.", DATA_CLONE_ERR }, - // FIXME: should be a JavaScript TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 - { "TypeError", "This should be a TypeError", 0 }, + { 0, 0, 0 }, // FIXME: Previous/legacy value was IDB_TYPE_ERR. { 0, 0, 0 }, // FIXME: Previous/legacy value was IDB_NOT_SUPPORTED_ERR. }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h index 2890aecbf..3e44a68ce 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h @@ -65,7 +65,7 @@ public: IDB_QUOTA_EXCEEDED_ERR, IDB_SYNTAX_ERR, IDB_DATA_CLONE_ERR, - IDB_TYPE_ERR, // FIXME: Placeholder until bindings have been updated to throw a JS TypeError. See https://bugs.webkit.org/show_bug.cgi?id=85513 + LEGACY_IDB_TYPE_ERR, // FIXME: Placeholder. LEGACY_IDB_NOT_SUPPORTED_ERR, // FIXME: Placeholder. }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl index 984cab922..67d811c3e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseException.idl @@ -49,10 +49,6 @@ module storage { const unsigned short READ_ONLY_ERR = 9; const unsigned short VER_ERR = 12; - // FIXME: Placeholder until bindings have been updated to throw a JS TypeError. - // See https://bugs.webkit.org/show_bug.cgi?id=85513 - const unsigned short TYPE_ERR = 21; - const unsigned short NOT_FOUND_ERR = 8; const unsigned short ABORT_ERR = 20; const unsigned short TIMEOUT_ERR = 23; diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp index 7e10cb1a5..cf52cc1fe 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp @@ -108,7 +108,7 @@ PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* cont PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { if (name.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } if (!isContextValid(context)) @@ -122,7 +122,7 @@ PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const S PassRefPtr<IDBVersionChangeRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { if (name.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } if (!isContextValid(context)) diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp index 3cce0c375..dfb1457a3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp @@ -44,8 +44,8 @@ namespace WebCore { static String computeFileIdentifier(SecurityOrigin* securityOrigin) { - static const char kLevelDBFileSuffix[] = "@1"; - return securityOrigin->databaseIdentifier() + kLevelDBFileSuffix; + static const char levelDBFileSuffix[] = "@1"; + return securityOrigin->databaseIdentifier() + levelDBFileSuffix; } static String computeUniqueIdentifier(const String& name, SecurityOrigin* securityOrigin) diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp index fec96804b..eae488400 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp @@ -100,7 +100,7 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openCursor(context, keyRange.release(), ec); + return openCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, unsigned short direction, ExceptionCode& ec) @@ -109,7 +109,7 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openCursor(context, keyRange.release(), ec); + return openCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) @@ -183,7 +183,7 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openKeyCursor(context, keyRange.release(), ec); + return openKeyCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, unsigned short direction, ExceptionCode& ec) @@ -192,7 +192,7 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openKeyCursor(context, keyRange.release(), ec); + return openKeyCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp index afdb7ec3c..9f5ff3baf 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp @@ -39,6 +39,7 @@ #include "IDBMetadata.h" #include "IDBObjectStoreBackendImpl.h" #include "IDBTracing.h" +#include "IDBTransactionBackendImpl.h" namespace WebCore { @@ -73,7 +74,7 @@ IDBIndexMetadata IDBIndexBackendImpl::metadata() const return IDBIndexMetadata(m_name, m_keyPath, m_unique, m_multiEntry); } -void IDBIndexBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, unsigned short untypedDirection, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBIndexBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, unsigned short untypedDirection, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction) { IDB_TRACE("IDBIndexBackendImpl::openCursorInternal"); IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(untypedDirection); @@ -108,8 +109,9 @@ void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsign RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks, transaction))) + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + if (!transaction->scheduleTask( + createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks, transaction))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -119,12 +121,13 @@ void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> prpKeyRange, uns RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; - if (!transaction->scheduleTask(createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks, transaction))) + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + if (!transaction->scheduleTask( + createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks, transaction))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } -void IDBIndexBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface>) +void IDBIndexBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks) { IDB_TRACE("IDBIndexBackendImpl::countInternal"); uint32_t count = 0; @@ -145,7 +148,8 @@ void IDBIndexBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBI void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { IDB_TRACE("IDBIndexBackendImpl::count"); - if (!transaction->scheduleTask(createCallbackTask(&countInternal, this, range, callbacks, transaction))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&countInternal, this, range, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -205,7 +209,8 @@ void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<ID RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, keyRange, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&getInternal, index, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -215,7 +220,8 @@ void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr RefPtr<IDBIndexBackendImpl> index = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&getKeyInternal, index, keyRange, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&getKeyInternal, index, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } diff --git a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h index f841a9583..e1174579d 100644 --- a/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h @@ -61,15 +61,14 @@ public: void setId(int64_t id) { m_id = id; } bool hasValidId() const { return m_id != InvalidId; }; - // Implements IDBIndexBackendInterface. - virtual IDBIndexMetadata metadata() const; - + // IDBIndexBackendInterface virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void count(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void getKey(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); + IDBIndexMetadata metadata() const; const String& name() { return m_name; } const IDBKeyPath& keyPath() { return m_keyPath; } const bool& unique() { return m_unique; } @@ -79,8 +78,8 @@ private: IDBIndexBackendImpl(const IDBDatabaseBackendImpl*, IDBObjectStoreBackendImpl*, int64_t id, const String& name, const IDBKeyPath&, bool unique, bool multiEntry); IDBIndexBackendImpl(const IDBDatabaseBackendImpl*, IDBObjectStoreBackendImpl*, const String& name, const IDBKeyPath&, bool unique, bool multiEntry); - static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); - static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); + static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); + static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void getKeyInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); diff --git a/Source/WebCore/Modules/indexeddb/IDBKey.h b/Source/WebCore/Modules/indexeddb/IDBKey.h index 7debf0d88..8598729d7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKey.h +++ b/Source/WebCore/Modules/indexeddb/IDBKey.h @@ -148,10 +148,10 @@ public: using ThreadSafeRefCounted<IDBKey>::deref; private: - IDBKey() : m_type(InvalidType), m_number(0), m_sizeEstimate(kOverheadSize) { } - IDBKey(Type type, double number) : m_type(type), m_number(number), m_sizeEstimate(kOverheadSize + sizeof(double)) { } - explicit IDBKey(const String& value) : m_type(StringType), m_string(value), m_number(0), m_sizeEstimate(kOverheadSize + value.length() * sizeof(UChar)) { } - IDBKey(const KeyArray& keyArray, size_t arraySize) : m_type(ArrayType), m_array(keyArray), m_number(0), m_sizeEstimate(kOverheadSize + arraySize) { } + IDBKey() : m_type(InvalidType), m_number(0), m_sizeEstimate(OverheadSize) { } + IDBKey(Type type, double number) : m_type(type), m_number(number), m_sizeEstimate(OverheadSize + sizeof(double)) { } + explicit IDBKey(const String& value) : m_type(StringType), m_string(value), m_number(0), m_sizeEstimate(OverheadSize + value.length() * sizeof(UChar)) { } + IDBKey(const KeyArray& keyArray, size_t arraySize) : m_type(ArrayType), m_array(keyArray), m_number(0), m_sizeEstimate(OverheadSize + arraySize) { } const Type m_type; const KeyArray m_array; @@ -161,7 +161,7 @@ private: const size_t m_sizeEstimate; // Very rough estimate of minimum key size overhead. - enum { kOverheadSize = 16 }; + enum { OverheadSize = 16 }; }; } diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp index 832cd4c9d..32e2f6815 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp @@ -223,8 +223,8 @@ void IDBLevelDBBackingStore::getDatabaseNames(Vector<String>& foundNames) OwnPtr<LevelDBIterator> it = m_db->createIterator(); for (it->seek(startKey); it->isValid() && compareKeys(it->key(), stopKey) < 0; it->next()) { - const char *p = it->key().begin(); - const char *limit = it->key().end(); + const char* p = it->key().begin(); + const char* limit = it->key().end(); DatabaseNameKey databaseNameKey; p = DatabaseNameKey::decode(p, limit, &databaseNameKey); @@ -242,7 +242,7 @@ bool IDBLevelDBBackingStore::getIDBDatabaseMetaData(const String& name, String& if (!ok) return false; - ok = getString(m_db.get(), DatabaseMetaDataKey::encode(foundId, DatabaseMetaDataKey::kUserVersion), foundVersion); + ok = getString(m_db.get(), DatabaseMetaDataKey::encode(foundId, DatabaseMetaDataKey::UserVersion), foundVersion); if (!ok) return false; @@ -273,7 +273,7 @@ bool IDBLevelDBBackingStore::createIDBDatabaseMetaData(const String& name, const const Vector<char> key = DatabaseNameKey::encode(m_identifier, name); if (!putInt(m_db.get(), key, rowId)) return false; - if (!putString(m_db.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::kUserVersion), version)) + if (!putString(m_db.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::UserVersion), version)) return false; return true; } @@ -281,7 +281,7 @@ bool IDBLevelDBBackingStore::createIDBDatabaseMetaData(const String& name, const bool IDBLevelDBBackingStore::updateIDBDatabaseMetaData(int64_t rowId, const String& version) { ASSERT(m_currentTransaction); - if (!putString(m_currentTransaction.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::kUserVersion), version)) + if (!putString(m_currentTransaction.get(), DatabaseMetaDataKey::encode(rowId, DatabaseMetaDataKey::UserVersion), version)) return false; return true; @@ -310,8 +310,8 @@ bool IDBLevelDBBackingStore::deleteDatabase(const String& name) return true; } - const Vector<char> startKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::kOriginName); - const Vector<char> stopKey = DatabaseMetaDataKey::encode(databaseId + 1, DatabaseMetaDataKey::kOriginName); + const Vector<char> startKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::OriginName); + const Vector<char> stopKey = DatabaseMetaDataKey::encode(databaseId + 1, DatabaseMetaDataKey::OriginName); if (!deleteRange(transaction.get(), startKey, stopKey)) { transaction->rollback(); return false; @@ -351,13 +351,13 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> OwnPtr<LevelDBIterator> it = m_db->createIterator(); it->seek(startKey); while (it->isValid() && compareKeys(it->key(), stopKey) < 0) { - const char *p = it->key().begin(); - const char *limit = it->key().end(); + const char* p = it->key().begin(); + const char* limit = it->key().end(); ObjectStoreMetaDataKey metaDataKey; p = ObjectStoreMetaDataKey::decode(p, limit, &metaDataKey); ASSERT(p); - if (metaDataKey.metaDataType() != ObjectStoreMetaDataKey::kName) { + if (metaDataKey.metaDataType() != ObjectStoreMetaDataKey::Name) { LOG_ERROR("Internal Indexed DB error."); // Possible stale metadata, but don't fail the load. it->next(); @@ -370,39 +370,39 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> String objectStoreName = decodeString(it->value().begin(), it->value().end()); it->next(); - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kKeyPath)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::KeyPath)) { LOG_ERROR("Internal Indexed DB error."); return; } IDBKeyPath keyPath = decodeIDBKeyPath(it->value().begin(), it->value().end()); it->next(); - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kAutoIncrement)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::AutoIncrement)) { LOG_ERROR("Internal Indexed DB error."); return; } bool autoIncrement = decodeBool(it->value().begin(), it->value().end()); it->next(); // Is evicatble. - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kEvictable)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::Evictable)) { LOG_ERROR("Internal Indexed DB error."); return; } it->next(); // Last version. - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kLastVersion)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::LastVersion)) { LOG_ERROR("Internal Indexed DB error."); return; } it->next(); // Maximum index id allocated. - if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kMaxIndexId)) { + if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId)) { LOG_ERROR("Internal Indexed DB error."); return; } it->next(); // [optional] has key path (is not null) - if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kHasKeyPath)) { + if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::HasKeyPath)) { bool hasKeyPath = decodeBool(it->value().begin(), it->value().end()); // This check accounts for two layers of legacy coding: // (1) Initially, hasKeyPath was added to distinguish null vs. string. @@ -418,7 +418,7 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> } int64_t keyGeneratorCurrentNumber = -1; - if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber)) { + if (checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber)) { keyGeneratorCurrentNumber = decodeInt(it->value().begin(), it->value().end()); // FIXME: Return keyGeneratorCurrentNumber, cache in object store, and write lazily to backing store. // For now, just assert that if it was written it was valid. @@ -436,7 +436,7 @@ void IDBLevelDBBackingStore::getObjectStores(int64_t databaseId, Vector<int64_t> static int64_t getNewObjectStoreId(LevelDBTransaction* transaction, int64_t databaseId) { int64_t maxObjectStoreId = -1; - const Vector<char> maxObjectStoreIdKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::kMaxObjectStoreId); + const Vector<char> maxObjectStoreIdKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::MaxObjectStoreId); if (!getInt(transaction, maxObjectStoreIdKey, maxObjectStoreId)) maxObjectStoreId = 0; @@ -456,14 +456,14 @@ bool IDBLevelDBBackingStore::createObjectStore(int64_t databaseId, const String& if (objectStoreId < 0) return false; - const Vector<char> nameKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kName); - const Vector<char> keyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyPath); - const Vector<char> autoIncrementKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kAutoIncrement); - const Vector<char> evictableKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kEvictable); - const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kLastVersion); - const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kMaxIndexId); - const Vector<char> hasKeyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kHasKeyPath); - const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber); + const Vector<char> nameKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::Name); + const Vector<char> keyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyPath); + const Vector<char> autoIncrementKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::AutoIncrement); + const Vector<char> evictableKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::Evictable); + const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::LastVersion); + const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId); + const Vector<char> hasKeyPathKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::HasKeyPath); + const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); const Vector<char> namesKey = ObjectStoreNamesKey::encode(databaseId, name); bool ok = putString(m_currentTransaction.get(), nameKey, name); @@ -496,7 +496,7 @@ bool IDBLevelDBBackingStore::createObjectStore(int64_t databaseId, const String& return false; } - ok = putInt(m_currentTransaction.get(), maxIndexIdKey, kMinimumIndexId); + ok = putInt(m_currentTransaction.get(), maxIndexIdKey, MinimumIndexId); if (!ok) { LOG_ERROR("Internal Indexed DB error."); return false; @@ -530,7 +530,7 @@ void IDBLevelDBBackingStore::deleteObjectStore(int64_t databaseId, int64_t objec ASSERT(m_currentTransaction); String objectStoreName; - getString(m_currentTransaction.get(), ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kName), objectStoreName); + getString(m_currentTransaction.get(), ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::Name), objectStoreName); if (!deleteRange(m_currentTransaction.get(), ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, 0), ObjectStoreMetaDataKey::encodeMaxKey(databaseId, objectStoreId))) return; // FIXME: Report error. @@ -586,7 +586,7 @@ private: static int64_t getNewVersionNumber(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId) { - const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kLastVersion); + const Vector<char> lastVersionKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::LastVersion); int64_t lastVersion = -1; if (!getInt(transaction, lastVersionKey, lastVersion)) @@ -658,7 +658,7 @@ int64_t IDBLevelDBBackingStore::getKeyGeneratorCurrentNumber(int64_t databaseId, { ASSERT(m_currentTransaction); - const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber); + const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); int64_t keyGeneratorCurrentNumber = -1; Vector<char> data; @@ -706,7 +706,7 @@ bool IDBLevelDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(int64_t databa return true; } - const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kKeyGeneratorCurrentNumber); + const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber); bool ok = putInt(m_currentTransaction.get(), keyGeneratorCurrentNumberKey, newNumber); if (!ok) { LOG_ERROR("Internal Indexed DB error."); @@ -742,8 +742,8 @@ bool IDBLevelDBBackingStore::forEachObjectStoreRecord(int64_t databaseId, int64_ OwnPtr<LevelDBIterator> it = m_currentTransaction->createIterator(); for (it->seek(startKey); it->isValid() && compareKeys(it->key(), stopKey) < 0; it->next()) { - const char *p = it->key().begin(); - const char *limit = it->key().end(); + const char* p = it->key().begin(); + const char* limit = it->key().end(); ObjectStoreDataKey dataKey; p = ObjectStoreDataKey::decode(p, limit, &dataKey); ASSERT(p); @@ -801,7 +801,7 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI IndexMetaDataKey metaDataKey; p = IndexMetaDataKey::decode(p, limit, &metaDataKey); ASSERT(p); - if (metaDataKey.metaDataType() != IndexMetaDataKey::kName) { + if (metaDataKey.metaDataType() != IndexMetaDataKey::Name) { LOG_ERROR("Internal Indexed DB error."); // Possible stale metadata due to http://webkit.org/b/85557 but don't fail the load. it->next(); @@ -813,14 +813,14 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI String indexName = decodeString(it->value().begin(), it->value().end()); it->next(); // unique flag - if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::kUnique)) { + if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::Unique)) { LOG_ERROR("Internal Indexed DB error."); return; } bool indexUnique = decodeBool(it->value().begin(), it->value().end()); it->next(); // keyPath - if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::kKeyPath)) { + if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::KeyPath)) { LOG_ERROR("Internal Indexed DB error."); return; } @@ -828,7 +828,7 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI it->next(); // [optional] multiEntry flag bool indexMultiEntry = false; - if (checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::kMultiEntry)) { + if (checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::MultiEntry)) { indexMultiEntry = decodeBool(it->value().begin(), it->value().end()); it->next(); } @@ -844,9 +844,9 @@ void IDBLevelDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreI static int64_t getNewIndexId(LevelDBTransaction* transaction, int64_t databaseId, int64_t objectStoreId) { int64_t maxIndexId = -1; - const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::kMaxIndexId); + const Vector<char> maxIndexIdKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId); if (!getInt(transaction, maxIndexIdKey, maxIndexId)) - maxIndexId = kMinimumIndexId; + maxIndexId = MinimumIndexId; ASSERT(maxIndexId >= 0); @@ -864,10 +864,10 @@ bool IDBLevelDBBackingStore::createIndex(int64_t databaseId, int64_t objectStore if (indexId < 0) return false; - const Vector<char> nameKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kName); - const Vector<char> uniqueKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kUnique); - const Vector<char> keyPathKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kKeyPath); - const Vector<char> multiEntryKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::kMultiEntry); + const Vector<char> nameKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::Name); + const Vector<char> uniqueKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::Unique); + const Vector<char> keyPathKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::KeyPath); + const Vector<char> multiEntryKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, IndexMetaDataKey::MultiEntry); bool ok = putString(m_currentTransaction.get(), nameKey, name); if (!ok) { @@ -920,7 +920,7 @@ void IDBLevelDBBackingStore::deleteIndex(int64_t databaseId, int64_t objectStore bool IDBLevelDBBackingStore::putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const ObjectStoreRecordIdentifier* recordIdentifier) { ASSERT(key.isValid()); - ASSERT(indexId >= kMinimumIndexId); + ASSERT(indexId >= MinimumIndexId); const LevelDBRecordIdentifier* levelDBRecordIdentifier = static_cast<const LevelDBRecordIdentifier*>(recordIdentifier); ASSERT(m_currentTransaction); @@ -1422,16 +1422,16 @@ private: bool IndexCursorImpl::loadCurrentRow() { - const char *p = m_iterator->key().begin(); - const char *limit = m_iterator->key().end(); + const char* p = m_iterator->key().begin(); + const char* limit = m_iterator->key().end(); IndexDataKey indexDataKey; p = IndexDataKey::decode(p, limit, &indexDataKey); m_currentKey = indexDataKey.userKey(); - const char *q = m_iterator->value().begin(); - const char *valueLimit = m_iterator->value().end(); + const char* q = m_iterator->value().begin(); + const char* valueLimit = m_iterator->value().end(); int64_t indexDataVersion; q = decodeVarInt(q, valueLimit, indexDataVersion); diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp index 1ff45a2fd..3af454f0a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp @@ -137,33 +137,33 @@ namespace IDBLevelDBCoding { #define INT32_MAX 0x7fffffffL #endif -static const unsigned char kIDBKeyNullTypeByte = 0; -static const unsigned char kIDBKeyStringTypeByte = 1; -static const unsigned char kIDBKeyDateTypeByte = 2; -static const unsigned char kIDBKeyNumberTypeByte = 3; -static const unsigned char kIDBKeyArrayTypeByte = 4; -static const unsigned char kIDBKeyMinKeyTypeByte = 5; - -static const unsigned char kIDBKeyPathTypeCodedByte1 = 0; -static const unsigned char kIDBKeyPathTypeCodedByte2 = 0; - -static const unsigned char kObjectStoreDataIndexId = 1; -static const unsigned char kExistsEntryIndexId = 2; - -static const unsigned char kSchemaVersionTypeByte = 0; -static const unsigned char kMaxDatabaseIdTypeByte = 1; -static const unsigned char kDatabaseFreeListTypeByte = 100; -static const unsigned char kDatabaseNameTypeByte = 201; - -static const unsigned char kObjectStoreMetaDataTypeByte = 50; -static const unsigned char kIndexMetaDataTypeByte = 100; -static const unsigned char kObjectStoreFreeListTypeByte = 150; -static const unsigned char kIndexFreeListTypeByte = 151; -static const unsigned char kObjectStoreNamesTypeByte = 200; -static const unsigned char kIndexNamesKeyTypeByte = 201; - -static const int64_t kObjectMetaDataTypeMaximum = INT64_MAX; -static const unsigned char kIndexMetaDataTypeMaximum = 255; +static const unsigned char IDBKeyNullTypeByte = 0; +static const unsigned char IDBKeyStringTypeByte = 1; +static const unsigned char IDBKeyDateTypeByte = 2; +static const unsigned char IDBKeyNumberTypeByte = 3; +static const unsigned char IDBKeyArrayTypeByte = 4; +static const unsigned char IDBKeyMinKeyTypeByte = 5; + +static const unsigned char IDBKeyPathTypeCodedByte1 = 0; +static const unsigned char IDBKeyPathTypeCodedByte2 = 0; + +static const unsigned char ObjectStoreDataIndexId = 1; +static const unsigned char ExistsEntryIndexId = 2; + +static const unsigned char SchemaVersionTypeByte = 0; +static const unsigned char MaxDatabaseIdTypeByte = 1; +static const unsigned char DatabaseFreeListTypeByte = 100; +static const unsigned char DatabaseNameTypeByte = 201; + +static const unsigned char ObjectStoreMetaDataTypeByte = 50; +static const unsigned char IndexMetaDataTypeByte = 100; +static const unsigned char ObjectStoreFreeListTypeByte = 150; +static const unsigned char IndexFreeListTypeByte = 151; +static const unsigned char ObjectStoreNamesTypeByte = 200; +static const unsigned char IndexNamesKeyTypeByte = 201; + +static const int64_t ObjectMetaDataTypeMaximum = INT64_MAX; +static const unsigned char IndexMetaDataTypeMaximum = 255; Vector<char> encodeByte(unsigned char c) { @@ -174,12 +174,12 @@ Vector<char> encodeByte(unsigned char c) Vector<char> maxIDBKey() { - return encodeByte(kIDBKeyNullTypeByte); + return encodeByte(IDBKeyNullTypeByte); } Vector<char> minIDBKey() { - return encodeByte(kIDBKeyMinKeyTypeByte); + return encodeByte(IDBKeyMinKeyTypeByte); } Vector<char> encodeBool(bool b) @@ -255,7 +255,7 @@ Vector<char> encodeVarInt(int64_t nParam) return ret; } -const char* decodeVarInt(const char *p, const char* limit, int64_t& foundInt) +const char* decodeVarInt(const char* p, const char* limit, int64_t& foundInt) { ASSERT(limit >= p); foundInt = 0; @@ -396,10 +396,10 @@ void encodeIDBKey(const IDBKey& key, Vector<char>& into) case IDBKey::InvalidType: case IDBKey::MinType: ASSERT_NOT_REACHED(); - into.append(encodeByte(kIDBKeyNullTypeByte)); + into.append(encodeByte(IDBKeyNullTypeByte)); return; case IDBKey::ArrayType: { - into.append(encodeByte(kIDBKeyArrayTypeByte)); + into.append(encodeByte(IDBKeyArrayTypeByte)); size_t length = key.array().size(); into.append(encodeVarInt(length)); for (size_t i = 0; i < length; ++i) @@ -408,17 +408,17 @@ void encodeIDBKey(const IDBKey& key, Vector<char>& into) return; } case IDBKey::StringType: - into.append(encodeByte(kIDBKeyStringTypeByte)); + into.append(encodeByte(IDBKeyStringTypeByte)); into.append(encodeStringWithLength(key.string())); ASSERT_UNUSED(previousSize, into.size() > previousSize); return; case IDBKey::DateType: - into.append(encodeByte(kIDBKeyDateTypeByte)); + into.append(encodeByte(IDBKeyDateTypeByte)); into.append(encodeDouble(key.date())); ASSERT_UNUSED(previousSize, into.size() - previousSize == 9); return; case IDBKey::NumberType: - into.append(encodeByte(kIDBKeyNumberTypeByte)); + into.append(encodeByte(IDBKeyNumberTypeByte)); into.append(encodeDouble(key.number())); ASSERT_UNUSED(previousSize, into.size() - previousSize == 9); return; @@ -437,11 +437,11 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found unsigned char type = *p++; switch (type) { - case kIDBKeyNullTypeByte: + case IDBKeyNullTypeByte: foundKey = IDBKey::createInvalid(); return p; - case kIDBKeyArrayTypeByte: { + case IDBKeyArrayTypeByte: { int64_t length; p = decodeVarInt(p, limit, length); if (!p) @@ -459,7 +459,7 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found foundKey = IDBKey::createArray(array); return p; } - case kIDBKeyStringTypeByte: { + case IDBKeyStringTypeByte: { String s; p = decodeStringWithLength(p, limit, s); if (!p) @@ -467,7 +467,7 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found foundKey = IDBKey::createString(s); return p; } - case kIDBKeyDateTypeByte: { + case IDBKeyDateTypeByte: { double d; p = decodeDouble(p, limit, &d); if (!p) @@ -475,7 +475,7 @@ const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found foundKey = IDBKey::createDate(d); return p; } - case kIDBKeyNumberTypeByte: { + case IDBKeyNumberTypeByte: { double d; p = decodeDouble(p, limit, &d); if (!p) @@ -499,11 +499,11 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch unsigned char type = *p++; switch (type) { - case kIDBKeyNullTypeByte: - case kIDBKeyMinKeyTypeByte: + case IDBKeyNullTypeByte: + case IDBKeyMinKeyTypeByte: *result = encodeByte(type); return p; - case kIDBKeyArrayTypeByte: { + case IDBKeyArrayTypeByte: { int64_t length; p = decodeVarInt(p, limit, length); if (!p) @@ -521,7 +521,7 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch } return p; } - case kIDBKeyStringTypeByte: { + case IDBKeyStringTypeByte: { int64_t length; p = decodeVarInt(p, limit, length); if (!p) @@ -532,8 +532,8 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch result->append(start, p - start + length * 2); return p + length * 2; } - case kIDBKeyDateTypeByte: - case kIDBKeyNumberTypeByte: + case IDBKeyDateTypeByte: + case IDBKeyNumberTypeByte: if (p + sizeof(double) > limit) return 0; result->clear(); @@ -547,17 +547,17 @@ const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch static IDBKey::Type keyTypeByteToKeyType(unsigned char type) { switch (type) { - case kIDBKeyNullTypeByte: + case IDBKeyNullTypeByte: return IDBKey::InvalidType; - case kIDBKeyArrayTypeByte: + case IDBKeyArrayTypeByte: return IDBKey::ArrayType; - case kIDBKeyStringTypeByte: + case IDBKeyStringTypeByte: return IDBKey::StringType; - case kIDBKeyDateTypeByte: + case IDBKeyDateTypeByte: return IDBKey::DateType; - case kIDBKeyNumberTypeByte: + case IDBKeyNumberTypeByte: return IDBKey::NumberType; - case kIDBKeyMinKeyTypeByte: + case IDBKeyMinKeyTypeByte: return IDBKey::MinType; } @@ -577,11 +577,11 @@ int compareEncodedIDBKeys(const char*& p, const char* limitA, const char*& q, co return x; switch (typeA) { - case kIDBKeyNullTypeByte: - case kIDBKeyMinKeyTypeByte: + case IDBKeyNullTypeByte: + case IDBKeyMinKeyTypeByte: // Null type or max type; no payload to compare. return 0; - case kIDBKeyArrayTypeByte: { + case IDBKeyArrayTypeByte: { int64_t lengthA, lengthB; p = decodeVarInt(p, limitA, lengthA); if (!p) @@ -601,10 +601,10 @@ int compareEncodedIDBKeys(const char*& p, const char* limitA, const char*& q, co return 1; return 0; } - case kIDBKeyStringTypeByte: + case IDBKeyStringTypeByte: return compareEncodedStringsWithLength(p, limitA, q, limitB); - case kIDBKeyDateTypeByte: - case kIDBKeyNumberTypeByte: { + case IDBKeyDateTypeByte: + case IDBKeyNumberTypeByte: { double d, e; p = decodeDouble(p, limitA, &d); ASSERT(p); @@ -641,8 +641,8 @@ Vector<char> encodeIDBKeyPath(const IDBKeyPath& keyPath) // byte is used to identify typed coding. New records are // always written as typed. Vector<char> ret; - ret.append(kIDBKeyPathTypeCodedByte1); - ret.append(kIDBKeyPathTypeCodedByte2); + ret.append(IDBKeyPathTypeCodedByte1); + ret.append(IDBKeyPathTypeCodedByte2); ret.append(static_cast<char>(keyPath.type())); switch (keyPath.type()) { case IDBKeyPath::NullType: @@ -667,7 +667,7 @@ IDBKeyPath decodeIDBKeyPath(const char* p, const char* limit) // May be typed, or may be a raw string. An invalid leading // byte sequence is used to identify typed coding. New records are // always written as typed. - if (p == limit || (limit - p >= 2 && (*p != kIDBKeyPathTypeCodedByte1 || *(p + 1) != kIDBKeyPathTypeCodedByte2))) + if (p == limit || (limit - p >= 2 && (*p != IDBKeyPathTypeCodedByte1 || *(p + 1) != IDBKeyPathTypeCodedByte2))) return IDBKeyPath(decodeString(p, limit)); p += 2; @@ -737,7 +737,7 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) if (int x = prefixA.compare(prefixB)) return x; - if (prefixA.type() == KeyPrefix::kGlobalMetaData) { + if (prefixA.type() == KeyPrefix::GlobalMetaData) { ASSERT(ptrA != endA); ASSERT(ptrB != endB); @@ -749,13 +749,13 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) if (typeByteA <= 1) return 0; - if (typeByteA == kDatabaseFreeListTypeByte) + if (typeByteA == DatabaseFreeListTypeByte) return decodeAndCompare<DatabaseFreeListKey>(a, b); - if (typeByteA == kDatabaseNameTypeByte) + if (typeByteA == DatabaseNameTypeByte) return decodeAndCompare<DatabaseNameKey>(a, b); } - if (prefixA.type() == KeyPrefix::kDatabaseMetaData) { + if (prefixA.type() == KeyPrefix::DatabaseMetaData) { ASSERT(ptrA != endA); ASSERT(ptrB != endB); @@ -768,24 +768,24 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) if (typeByteA <= 3) return 0; - if (typeByteA == kObjectStoreMetaDataTypeByte) + if (typeByteA == ObjectStoreMetaDataTypeByte) return decodeAndCompare<ObjectStoreMetaDataKey>(a, b); - if (typeByteA == kIndexMetaDataTypeByte) + if (typeByteA == IndexMetaDataTypeByte) return decodeAndCompare<IndexMetaDataKey>(a, b); - if (typeByteA == kObjectStoreFreeListTypeByte) + if (typeByteA == ObjectStoreFreeListTypeByte) return decodeAndCompare<ObjectStoreFreeListKey>(a, b); - if (typeByteA == kIndexFreeListTypeByte) + if (typeByteA == IndexFreeListTypeByte) return decodeAndCompare<IndexFreeListKey>(a, b); - if (typeByteA == kObjectStoreNamesTypeByte) + if (typeByteA == ObjectStoreNamesTypeByte) return decodeAndCompare<ObjectStoreNamesKey>(a, b); - if (typeByteA == kIndexNamesKeyTypeByte) + if (typeByteA == IndexNamesKeyTypeByte) return decodeAndCompare<IndexNamesKey>(a, b); return 0; ASSERT_NOT_REACHED(); } - if (prefixA.type() == KeyPrefix::kObjectStoreData) { + if (prefixA.type() == KeyPrefix::ObjectStoreData) { if (ptrA == endA && ptrB == endB) return 0; if (ptrA == endA) @@ -795,7 +795,7 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) return decodeAndCompare<ObjectStoreDataKey>(a, b); } - if (prefixA.type() == KeyPrefix::kExistsEntry) { + if (prefixA.type() == KeyPrefix::ExistsEntry) { if (ptrA == endA && ptrB == endB) return 0; if (ptrA == endA) @@ -805,7 +805,7 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) return decodeAndCompare<ExistsEntryKey>(a, b); } - if (prefixA.type() == KeyPrefix::kIndexData) { + if (prefixA.type() == KeyPrefix::IndexData) { if (ptrA == endA && ptrB == endB) return 0; if (ptrA == endA) @@ -831,9 +831,9 @@ int compare(const LevelDBSlice& a, const LevelDBSlice& b, bool indexKeys) KeyPrefix::KeyPrefix() - : m_databaseId(kInvalidType) - , m_objectStoreId(kInvalidType) - , m_indexId(kInvalidType) + : m_databaseId(InvalidType) + , m_objectStoreId(InvalidType) + , m_indexId(InvalidType) { } @@ -870,9 +870,9 @@ const char* KeyPrefix::decode(const char* start, const char* limit, KeyPrefix* r Vector<char> KeyPrefix::encode() const { - ASSERT(m_databaseId != kInvalidId); - ASSERT(m_objectStoreId != kInvalidId); - ASSERT(m_indexId != kInvalidId); + ASSERT(m_databaseId != InvalidId); + ASSERT(m_objectStoreId != InvalidId); + ASSERT(m_indexId != InvalidId); Vector<char> databaseIdString = encodeInt(m_databaseId); Vector<char> objectStoreIdString = encodeInt(m_objectStoreId); @@ -895,9 +895,9 @@ Vector<char> KeyPrefix::encode() const int KeyPrefix::compare(const KeyPrefix& other) const { - ASSERT(m_databaseId != kInvalidId); - ASSERT(m_objectStoreId != kInvalidId); - ASSERT(m_indexId != kInvalidId); + ASSERT(m_databaseId != InvalidId); + ASSERT(m_objectStoreId != InvalidId); + ASSERT(m_indexId != InvalidId); if (m_databaseId != other.m_databaseId) return compareInts(m_databaseId, other.m_databaseId); @@ -910,30 +910,30 @@ int KeyPrefix::compare(const KeyPrefix& other) const KeyPrefix::Type KeyPrefix::type() const { - ASSERT(m_databaseId != kInvalidId); - ASSERT(m_objectStoreId != kInvalidId); - ASSERT(m_indexId != kInvalidId); + ASSERT(m_databaseId != InvalidId); + ASSERT(m_objectStoreId != InvalidId); + ASSERT(m_indexId != InvalidId); if (!m_databaseId) - return kGlobalMetaData; + return GlobalMetaData; if (!m_objectStoreId) - return kDatabaseMetaData; - if (m_indexId == kObjectStoreDataIndexId) - return kObjectStoreData; - if (m_indexId == kExistsEntryIndexId) - return kExistsEntry; - if (m_indexId >= kMinimumIndexId) - return kIndexData; + return DatabaseMetaData; + if (m_indexId == ObjectStoreDataIndexId) + return ObjectStoreData; + if (m_indexId == ExistsEntryIndexId) + return ExistsEntry; + if (m_indexId >= MinimumIndexId) + return IndexData; ASSERT_NOT_REACHED(); - return kInvalidType; + return InvalidType; } Vector<char> SchemaVersionKey::encode() { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kSchemaVersionTypeByte)); + ret.append(encodeByte(SchemaVersionTypeByte)); return ret; } @@ -941,7 +941,7 @@ Vector<char> MaxDatabaseIdKey::encode() { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kMaxDatabaseIdTypeByte)); + ret.append(encodeByte(MaxDatabaseIdTypeByte)); return ret; } @@ -953,7 +953,7 @@ DatabaseFreeListKey::DatabaseFreeListKey() const char* DatabaseFreeListKey::decode(const char* start, const char* limit, DatabaseFreeListKey* result) { KeyPrefix prefix; - const char *p = KeyPrefix::decode(start, limit, &prefix); + const char* p = KeyPrefix::decode(start, limit, &prefix); if (!p) return 0; ASSERT(!prefix.m_databaseId); @@ -962,7 +962,7 @@ const char* DatabaseFreeListKey::decode(const char* start, const char* limit, Da if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kDatabaseFreeListTypeByte); + ASSERT_UNUSED(typeByte, typeByte == DatabaseFreeListTypeByte); if (p == limit) return 0; return decodeVarInt(p, limit, result->m_databaseId); @@ -972,7 +972,7 @@ Vector<char> DatabaseFreeListKey::encode(int64_t databaseId) { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kDatabaseFreeListTypeByte)); + ret.append(encodeByte(DatabaseFreeListTypeByte)); ret.append(encodeVarInt(databaseId)); return ret; } @@ -1006,7 +1006,7 @@ const char* DatabaseNameKey::decode(const char* start, const char* limit, Databa if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kDatabaseNameTypeByte); + ASSERT_UNUSED(typeByte, typeByte == DatabaseNameTypeByte); if (p == limit) return 0; p = decodeStringWithLength(p, limit, result->m_origin); @@ -1019,7 +1019,7 @@ Vector<char> DatabaseNameKey::encode(const String& origin, const String& databas { KeyPrefix prefix(0, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kDatabaseNameTypeByte)); + ret.append(encodeByte(DatabaseNameTypeByte)); ret.append(encodeStringWithLength(origin)); ret.append(encodeStringWithLength(databaseName)); return ret; @@ -1069,7 +1069,7 @@ const char* ObjectStoreMetaDataKey::decode(const char* start, const char* limit, if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kObjectStoreMetaDataTypeByte); + ASSERT_UNUSED(typeByte, typeByte == ObjectStoreMetaDataTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1085,7 +1085,7 @@ Vector<char> ObjectStoreMetaDataKey::encode(int64_t databaseId, int64_t objectSt { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kObjectStoreMetaDataTypeByte)); + ret.append(encodeByte(ObjectStoreMetaDataTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeVarInt(metaDataType)); return ret; @@ -1093,12 +1093,12 @@ Vector<char> ObjectStoreMetaDataKey::encode(int64_t databaseId, int64_t objectSt Vector<char> ObjectStoreMetaDataKey::encodeMaxKey(int64_t databaseId) { - return encode(databaseId, INT64_MAX, kObjectMetaDataTypeMaximum); + return encode(databaseId, INT64_MAX, ObjectMetaDataTypeMaximum); } Vector<char> ObjectStoreMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId) { - return encode(databaseId, objectStoreId, kObjectMetaDataTypeMaximum); + return encode(databaseId, objectStoreId, ObjectMetaDataTypeMaximum); } int64_t ObjectStoreMetaDataKey::objectStoreId() const @@ -1143,7 +1143,7 @@ const char* IndexMetaDataKey::decode(const char* start, const char* limit, Index if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kIndexMetaDataTypeByte); + ASSERT_UNUSED(typeByte, typeByte == IndexMetaDataTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1162,7 +1162,7 @@ Vector<char> IndexMetaDataKey::encode(int64_t databaseId, int64_t objectStoreId, { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kIndexMetaDataTypeByte)); + ret.append(encodeByte(IndexMetaDataTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeVarInt(indexId)); ret.append(encodeByte(metaDataType)); @@ -1171,12 +1171,12 @@ Vector<char> IndexMetaDataKey::encode(int64_t databaseId, int64_t objectStoreId, Vector<char> IndexMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId) { - return encode(databaseId, objectStoreId, INT64_MAX, kIndexMetaDataTypeMaximum); + return encode(databaseId, objectStoreId, INT64_MAX, IndexMetaDataTypeMaximum); } Vector<char> IndexMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId, int64_t indexId) { - return encode(databaseId, objectStoreId, indexId, kIndexMetaDataTypeMaximum); + return encode(databaseId, objectStoreId, indexId, IndexMetaDataTypeMaximum); } int IndexMetaDataKey::compare(const IndexMetaDataKey& other) @@ -1205,7 +1205,7 @@ ObjectStoreFreeListKey::ObjectStoreFreeListKey() const char* ObjectStoreFreeListKey::decode(const char* start, const char* limit, ObjectStoreFreeListKey* result) { KeyPrefix prefix; - const char *p = KeyPrefix::decode(start, limit, &prefix); + const char* p = KeyPrefix::decode(start, limit, &prefix); if (!p) return 0; ASSERT(prefix.m_databaseId); @@ -1214,7 +1214,7 @@ const char* ObjectStoreFreeListKey::decode(const char* start, const char* limit, if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kObjectStoreFreeListTypeByte); + ASSERT_UNUSED(typeByte, typeByte == ObjectStoreFreeListTypeByte); if (p == limit) return 0; return decodeVarInt(p, limit, result->m_objectStoreId); @@ -1224,7 +1224,7 @@ Vector<char> ObjectStoreFreeListKey::encode(int64_t databaseId, int64_t objectSt { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kObjectStoreFreeListTypeByte)); + ret.append(encodeByte(ObjectStoreFreeListTypeByte)); ret.append(encodeVarInt(objectStoreId)); return ret; } @@ -1267,7 +1267,7 @@ const char* IndexFreeListKey::decode(const char* start, const char* limit, Index if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kIndexFreeListTypeByte); + ASSERT_UNUSED(typeByte, typeByte == IndexFreeListTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1280,7 +1280,7 @@ Vector<char> IndexFreeListKey::encode(int64_t databaseId, int64_t objectStoreId, { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kIndexFreeListTypeByte)); + ret.append(encodeByte(IndexFreeListTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeVarInt(indexId)); return ret; @@ -1327,7 +1327,7 @@ const char* ObjectStoreNamesKey::decode(const char* start, const char* limit, Ob if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kObjectStoreNamesTypeByte); + ASSERT_UNUSED(typeByte, typeByte == ObjectStoreNamesTypeByte); return decodeStringWithLength(p, limit, result->m_objectStoreName); } @@ -1335,7 +1335,7 @@ Vector<char> ObjectStoreNamesKey::encode(int64_t databaseId, const String& objec { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kObjectStoreNamesTypeByte)); + ret.append(encodeByte(ObjectStoreNamesTypeByte)); ret.append(encodeStringWithLength(objectStoreName)); return ret; } @@ -1364,7 +1364,7 @@ const char* IndexNamesKey::decode(const char* start, const char* limit, IndexNam if (p == limit) return 0; unsigned char typeByte = *p++; - ASSERT_UNUSED(typeByte, typeByte == kIndexNamesKeyTypeByte); + ASSERT_UNUSED(typeByte, typeByte == IndexNamesKeyTypeByte); if (p == limit) return 0; p = decodeVarInt(p, limit, result->m_objectStoreId); @@ -1377,7 +1377,7 @@ Vector<char> IndexNamesKey::encode(int64_t databaseId, int64_t objectStoreId, co { KeyPrefix prefix(databaseId, 0, 0); Vector<char> ret = prefix.encode(); - ret.append(encodeByte(kIndexNamesKeyTypeByte)); + ret.append(encodeByte(IndexNamesKeyTypeByte)); ret.append(encodeVarInt(objectStoreId)); ret.append(encodeStringWithLength(indexName)); return ret; @@ -1399,7 +1399,7 @@ const char* ObjectStoreDataKey::decode(const char* start, const char* end, Objec return 0; ASSERT(prefix.m_databaseId); ASSERT(prefix.m_objectStoreId); - ASSERT(prefix.m_indexId == kSpecialIndexNumber); + ASSERT(prefix.m_indexId == SpecialIndexNumber); if (p == end) return 0; return extractEncodedIDBKey(p, end, &result->m_encodedUserKey); @@ -1407,7 +1407,7 @@ const char* ObjectStoreDataKey::decode(const char* start, const char* end, Objec Vector<char> ObjectStoreDataKey::encode(int64_t databaseId, int64_t objectStoreId, const Vector<char> encodedUserKey) { - KeyPrefix prefix(databaseId, objectStoreId, kSpecialIndexNumber); + KeyPrefix prefix(databaseId, objectStoreId, SpecialIndexNumber); Vector<char> ret = prefix.encode(); ret.append(encodedUserKey); @@ -1431,7 +1431,7 @@ PassRefPtr<IDBKey> ObjectStoreDataKey::userKey() const return key; } -const int64_t ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId; +const int64_t ObjectStoreDataKey::SpecialIndexNumber = ObjectStoreDataIndexId; const char* ExistsEntryKey::decode(const char* start, const char* end, ExistsEntryKey* result) { @@ -1441,7 +1441,7 @@ const char* ExistsEntryKey::decode(const char* start, const char* end, ExistsEnt return 0; ASSERT(prefix.m_databaseId); ASSERT(prefix.m_objectStoreId); - ASSERT(prefix.m_indexId == kSpecialIndexNumber); + ASSERT(prefix.m_indexId == SpecialIndexNumber); if (p == end) return 0; return extractEncodedIDBKey(p, end, &result->m_encodedUserKey); @@ -1449,7 +1449,7 @@ const char* ExistsEntryKey::decode(const char* start, const char* end, ExistsEnt Vector<char> ExistsEntryKey::encode(int64_t databaseId, int64_t objectStoreId, const Vector<char>& encodedKey) { - KeyPrefix prefix(databaseId, objectStoreId, kSpecialIndexNumber); + KeyPrefix prefix(databaseId, objectStoreId, SpecialIndexNumber); Vector<char> ret = prefix.encode(); ret.append(encodedKey); return ret; @@ -1472,7 +1472,7 @@ PassRefPtr<IDBKey> ExistsEntryKey::userKey() const return key; } -const int64_t ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId; +const int64_t ExistsEntryKey::SpecialIndexNumber = ExistsEntryIndexId; IndexDataKey::IndexDataKey() : m_databaseId(-1) @@ -1490,7 +1490,7 @@ const char* IndexDataKey::decode(const char* start, const char* limit, IndexData return 0; ASSERT(prefix.m_databaseId); ASSERT(prefix.m_objectStoreId); - ASSERT(prefix.m_indexId >= kMinimumIndexId); + ASSERT(prefix.m_indexId >= MinimumIndexId); result->m_databaseId = prefix.m_databaseId; result->m_objectStoreId = prefix.m_objectStoreId; result->m_indexId = prefix.m_indexId; diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h index a23a29274..3113e7d8a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h +++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h @@ -41,7 +41,7 @@ class LevelDBSlice; namespace IDBLevelDBCoding { -const unsigned char kMinimumIndexId = 30; +const unsigned char MinimumIndexId = 30; Vector<char> encodeByte(unsigned char); Vector<char> maxIDBKey(); @@ -51,7 +51,7 @@ bool decodeBool(const char* begin, const char* end); Vector<char> encodeInt(int64_t); int64_t decodeInt(const char* begin, const char* end); Vector<char> encodeVarInt(int64_t); -const char* decodeVarInt(const char *p, const char* limit, int64_t& foundInt); +const char* decodeVarInt(const char* p, const char* limit, int64_t& foundInt); Vector<char> encodeString(const String&); String decodeString(const char* p, const char* end); Vector<char> encodeStringWithLength(const String&); @@ -79,12 +79,12 @@ public: int compare(const KeyPrefix& other) const; enum Type { - kGlobalMetaData, - kDatabaseMetaData, - kObjectStoreData, - kExistsEntry, - kIndexData, - kInvalidType + GlobalMetaData, + DatabaseMetaData, + ObjectStoreData, + ExistsEntry, + IndexData, + InvalidType }; Type type() const; @@ -93,7 +93,7 @@ public: int64_t m_objectStoreId; int64_t m_indexId; - static const int64_t kInvalidId = -1; + static const int64_t InvalidId = -1; }; class SchemaVersionKey { @@ -137,10 +137,10 @@ private: class DatabaseMetaDataKey { public: enum MetaDataType { - kOriginName = 0, - kDatabaseName = 1, - kUserVersion = 2, - kMaxObjectStoreId = 3 + OriginName = 0, + DatabaseName = 1, + UserVersion = 2, + MaxObjectStoreId = 3 }; static Vector<char> encode(int64_t databaseId, MetaDataType); @@ -149,14 +149,14 @@ public: class ObjectStoreMetaDataKey { public: enum MetaDataType { - kName = 0, - kKeyPath = 1, - kAutoIncrement = 2, - kEvictable = 3, - kLastVersion = 4, - kMaxIndexId = 5, - kHasKeyPath = 6, - kKeyGeneratorCurrentNumber = 7 + Name = 0, + KeyPath = 1, + AutoIncrement = 2, + Evictable = 3, + LastVersion = 4, + MaxIndexId = 5, + HasKeyPath = 6, + KeyGeneratorCurrentNumber = 7 }; ObjectStoreMetaDataKey(); @@ -176,10 +176,10 @@ private: class IndexMetaDataKey { public: enum MetaDataType { - kName = 0, - kUnique = 1, - kKeyPath = 2, - kMultiEntry = 3 + Name = 0, + Unique = 1, + KeyPath = 2, + MultiEntry = 3 }; IndexMetaDataKey(); @@ -261,7 +261,7 @@ public: static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const IDBKey& userKey); int compare(const ObjectStoreDataKey& other); PassRefPtr<IDBKey> userKey() const; - static const int64_t kSpecialIndexNumber; + static const int64_t SpecialIndexNumber; private: Vector<char> m_encodedUserKey; @@ -275,7 +275,7 @@ public: int compare(const ExistsEntryKey& other); PassRefPtr<IDBKey> userKey() const; - static const int64_t kSpecialIndexNumber; + static const int64_t SpecialIndexNumber; private: Vector<char> m_encodedUserKey; diff --git a/Source/WebCore/Modules/indexeddb/IDBMetadata.h b/Source/WebCore/Modules/indexeddb/IDBMetadata.h index 247e84d0f..dd230620c 100644 --- a/Source/WebCore/Modules/indexeddb/IDBMetadata.h +++ b/Source/WebCore/Modules/indexeddb/IDBMetadata.h @@ -42,12 +42,24 @@ struct IDBObjectStoreMetadata; struct IDBIndexMetadata; struct IDBDatabaseMetadata { - IDBDatabaseMetadata() { } - IDBDatabaseMetadata(const String& name, const String& version) + enum { + NoIntVersion = -1 + }; + + IDBDatabaseMetadata() + : intVersion(NoIntVersion) + { + } + IDBDatabaseMetadata(const String& name, const String& version, int64_t intVersion) : name(name) - , version(version) { } + , version(version) + , intVersion(intVersion) + { + } + String name; String version; + int64_t intVersion; typedef HashMap<String, IDBObjectStoreMetadata> ObjectStoreMap; ObjectStoreMap objectStores; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp index dae83c590..e27ca827b 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp @@ -272,7 +272,7 @@ PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const IDBKe return 0; } if (name.isNull()) { - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return 0; } if (m_metadata.indexes.contains(name)) { @@ -389,7 +389,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* contex PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::openCursor"); - DEFINE_STATIC_LOCAL(String, consoleMessage, ("Numeric direction values are deprecated in IDBObjectStore.openCursor. Use\"next\", \"nextunique\", \"prev\", or \"prevunique\".")); + DEFINE_STATIC_LOCAL(String, consoleMessage, ("Numeric direction values are deprecated in IDBObjectStore.openCursor. Use \"next\", \"nextunique\", \"prev\", or \"prevunique\".")); context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, consoleMessage); const String& directionString = IDBCursor::directionToString(direction, ec); if (ec) @@ -403,7 +403,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* contex RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec); if (ec) return 0; - return openCursor(context, keyRange.release(), ec); + return openCursor(context, keyRange.release(), direction, ec); } PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, unsigned short direction, ExceptionCode& ec) diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp index ccad88920..8d3b803cb 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp @@ -78,13 +78,15 @@ IDBObjectStoreMetadata IDBObjectStoreBackendImpl::metadata() const return metadata; } -void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::get"); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, keyRange, callbacks))) + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + if (!transaction->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -145,13 +147,12 @@ void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, IDB_TRACE("IDBObjectStoreBackendImpl::put"); IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); - ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); - RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<SerializedScriptValue> value = prpValue; RefPtr<IDBKey> key = prpKey; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); // Null pointers here signify that index keys should be generated as a part of this put. OwnPtr<Vector<String> > nullIndexNames; @@ -165,13 +166,12 @@ void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValu { IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); - ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); - RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<SerializedScriptValue> value = prpValue; RefPtr<IDBKey> key = prpKey; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); OwnPtr<Vector<String> > newIndexNames = adoptPtr(new Vector<String>(indexNames)); OwnPtr<Vector<IndexKeys> > newIndexKeys = adoptPtr(new Vector<IndexKeys>(indexKeys)); @@ -271,7 +271,7 @@ private: }; } -void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> > popIndexKeys) +void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> > popIndexKeys) { IDB_TRACE("IDBObjectStoreBackendImpl::putInternal"); ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); @@ -388,13 +388,14 @@ void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> prpKeyRan { IDB_TRACE("IDBObjectStoreBackendImpl::delete"); - ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); + ASSERT(IDBTransactionBackendImpl::from(transaction)->mode() != IDBTransaction::READ_ONLY); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> keyRange = prpKeyRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::deleteInternal, objectStore, keyRange, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::deleteInternal, objectStore, keyRange, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -431,12 +432,13 @@ void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDB { IDB_TRACE("IDBObjectStoreBackendImpl::clear"); - ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); + ASSERT(IDBTransactionBackendImpl::from(transaction)->mode() != IDBTransaction::READ_ONLY); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::clearInternal, objectStore, callbacks))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::clearInternal, objectStore, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } @@ -484,21 +486,20 @@ bool IDBObjectStoreBackendImpl::populateIndex(IDBBackingStore& backingStore, int return true; } -PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(!m_indexes.contains(name)); RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_database, this, name, keyPath, unique, multiEntry); ASSERT(index->name() == name); + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + RefPtr<IDBObjectStoreBackendImpl> objectStore = this; - RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction; if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, - objectStore, index, transactionPtr), - createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexFromMap, - objectStore, index))) { + createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, objectStore, index, transaction), + createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexFromMap, objectStore, index))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return 0; } @@ -507,7 +508,7 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(cons return index.release(); } -void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction) { int64_t id; if (!objectStore->backingStore()->createIndex(objectStore->databaseId(), objectStore->id(), index->name(), index->keyPath(), index->unique(), index->multiEntry(), id)) { @@ -535,46 +536,44 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const Stri return index.release(); } -void IDBObjectStoreBackendImpl::deleteIndex(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +void IDBObjectStoreBackendImpl::deleteIndex(const String& name, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { - ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); ASSERT(m_indexes.contains(name)); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBIndexBackendImpl> index = m_indexes.get(name); - RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); + ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE); + if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::deleteIndexInternal, - objectStore, index, transactionPtr), - createCallbackTask(&IDBObjectStoreBackendImpl::addIndexToMap, - objectStore, index))) { + createCallbackTask(&IDBObjectStoreBackendImpl::deleteIndexInternal, objectStore, index, transaction), + createCallbackTask(&IDBObjectStoreBackendImpl::addIndexToMap, objectStore, index))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return; } m_indexes.remove(name); } -void IDBObjectStoreBackendImpl::deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBObjectStoreBackendImpl::deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction) { objectStore->backingStore()->deleteIndex(objectStore->databaseId(), objectStore->id(), index->id()); transaction->didCompleteTaskEvents(); } -void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::openCursor"); RefPtr<IDBObjectStoreBackendImpl> objectStore = this; RefPtr<IDBKeyRange> range = prpRange; RefPtr<IDBCallbacks> callbacks = prpCallbacks; - RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction; + RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); if (!transaction->scheduleTask( - createCallbackTask(&IDBObjectStoreBackendImpl::openCursorInternal, - objectStore, range, direction, callbacks, transactionPtr))) { + createCallbackTask(&IDBObjectStoreBackendImpl::openCursorInternal, objectStore, range, direction, callbacks, transaction))) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } } -void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) +void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction) { IDB_TRACE("IDBObjectStoreBackendImpl::openCursorInternal"); IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(tmpDirection); @@ -592,11 +591,12 @@ void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, Pass void IDBObjectStoreBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { IDB_TRACE("IDBObjectStoreBackendImpl::count"); - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::countInternal, this, range, callbacks, transaction))) + if (!IDBTransactionBackendImpl::from(transaction)->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::countInternal, this, range, callbacks))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } -void IDBObjectStoreBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface>) +void IDBObjectStoreBackendImpl::countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks) { IDB_TRACE("IDBObjectStoreBackendImpl::countInternal"); uint32_t count = 0; diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h index a37c67e7f..647bc2978 100644 --- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h @@ -39,6 +39,7 @@ namespace WebCore { class IDBDatabaseBackendImpl; class IDBIndexBackendImpl; +class IDBTransactionBackendImpl; class IDBTransactionBackendInterface; class ScriptExecutionContext; struct IDBObjectStoreMetadata; @@ -63,8 +64,7 @@ public: } void setId(int64_t id) { m_id = id; } - virtual IDBObjectStoreMetadata metadata() const; - + // IDBObjectStoreBackendInterface virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&); virtual void putWithIndexKeys(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, const Vector<String>&, const Vector<IndexKeys>&, ExceptionCode&); @@ -80,6 +80,7 @@ public: static bool populateIndex(IDBBackingStore&, int64_t databaseId, int64_t objectStoreId, PassRefPtr<IDBIndexBackendImpl>); + IDBObjectStoreMetadata metadata() const; const String& name() { return m_name; } const IDBKeyPath& keyPath() const { return m_keyPath; } const bool& autoIncrement() const { return m_autoIncrement; } @@ -93,13 +94,13 @@ private: void updateKeyGenerator(const IDBKey*, bool checkCurrent); static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); - static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >); + static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>, PassOwnPtr<Vector<String> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >); static void deleteInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); static void clearInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBCallbacks>); - static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>); - static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); - static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); + static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>); + static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>); + static void countInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>); // These are used as setVersion transaction abort tasks. static void removeIndexFromMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>); diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index 54afe03a6..a1eaf2930 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -58,12 +58,11 @@ IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc , m_transaction(transaction) , m_readyState(PENDING) , m_requestAborted(false) - , m_requestFinished(false) , m_cursorFinished(false) , m_contextStopped(false) , m_cursorType(IDBCursorBackendInterface::InvalidCursorType) , m_cursorDirection(IDBCursor::NEXT) - , m_cursor(0) + , m_pendingCursor(0) { if (m_transaction) { m_transaction->registerRequest(this); @@ -141,40 +140,14 @@ void IDBRequest::markEarlyDeath() m_transaction->unregisterRequest(this); } -bool IDBRequest::resetReadyState(IDBTransaction* transaction) -{ - ASSERT(!m_requestFinished); - ASSERT(scriptExecutionContext()); - ASSERT_UNUSED(transaction, transaction == m_transaction); - if (m_readyState != DONE) - return false; - - m_readyState = PENDING; - m_result.clear(); - m_errorCode = 0; - m_error.clear(); - m_errorMessage = String(); - ASSERT(m_transaction); - m_transaction->registerRequest(this); - - return true; -} - -IDBAny* IDBRequest::source() -{ - return m_source.get(); -} - void IDBRequest::abort() { + ASSERT(m_readyState == PENDING || m_readyState == DONE); ASSERT(!m_requestAborted); if (m_contextStopped || !scriptExecutionContext()) return; - - if (m_readyState != PENDING) { - ASSERT(m_readyState == DONE); + if (m_readyState == DONE) return; - } EventQueue* eventQueue = scriptExecutionContext()->eventQueue(); for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { @@ -193,34 +166,68 @@ void IDBRequest::abort() void IDBRequest::setCursorDetails(IDBCursorBackendInterface::CursorType cursorType, IDBCursor::Direction direction) { + ASSERT(m_readyState == PENDING); ASSERT(m_cursorType == IDBCursorBackendInterface::InvalidCursorType); m_cursorType = cursorType; m_cursorDirection = direction; } -void IDBRequest::setCursor(PassRefPtr<IDBCursor> cursor) +void IDBRequest::setPendingCursor(PassRefPtr<IDBCursor> cursor) { - ASSERT(!m_cursor); - m_cursor = cursor; + ASSERT(m_readyState == DONE); + ASSERT(scriptExecutionContext()); + ASSERT(m_transaction); + ASSERT(!m_pendingCursor); + ASSERT(cursor == getResultCursor()); + + m_pendingCursor = cursor; + m_result.clear(); + m_readyState = PENDING; + m_errorCode = 0; + m_error.clear(); + m_errorMessage = String(); + m_transaction->registerRequest(this); +} + +PassRefPtr<IDBCursor> IDBRequest::getResultCursor() +{ + if (!m_result) + return 0; + if (m_result->type() == IDBAny::IDBCursorType) + return m_result->idbCursor(); + if (m_result->type() == IDBAny::IDBCursorWithValueType) + return m_result->idbCursorWithValue(); + return 0; +} + +void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> prpCursor) +{ + ASSERT(m_readyState == PENDING); + if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor) { + m_result = IDBAny::create(prpCursor); + return; + } + + m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor)); } void IDBRequest::finishCursor() { + ASSERT(m_readyState == PENDING || m_readyState == DONE); m_cursorFinished = true; - if (m_readyState != PENDING) - m_requestFinished = true; } void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error) { + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; - ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result); + ASSERT(m_readyState == PENDING); + ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_errorCode = error->code(); - ASSERT(!m_error); - m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode())); m_errorMessage = error->message(); - m_cursor.clear(); + m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode())); + m_pendingCursor.clear(); enqueueEvent(Event::create(eventNames().errorEvent, true, true)); } @@ -232,8 +239,10 @@ static PassRefPtr<Event> createSuccessEvent() void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) { IDB_TRACE("IDBRequest::onSuccess(DOMStringList)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_result = IDBAny::create(domStringList); enqueueEvent(createSuccessEvent()); @@ -242,8 +251,10 @@ void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList) void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) { IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType); RefPtr<IDBCursor> cursor; @@ -251,7 +262,7 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.get(), m_transaction.get()); else cursor = IDBCursorWithValue::create(backend, m_cursorDirection, this, m_source.get(), m_transaction.get()); - setResultCursor(cursor, m_cursorType); + setResultCursor(cursor); enqueueEvent(createSuccessEvent()); } @@ -259,8 +270,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend) void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) { IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); if (m_contextStopped || !scriptExecutionContext()) return; @@ -275,8 +288,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) { IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); if (idbKey && idbKey->isValid()) m_result = IDBAny::create(idbKey); @@ -288,8 +303,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend) { IDB_TRACE("IDBRequest::onSuccess(IDBTransaction)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); RefPtr<IDBTransactionBackendInterface> backend = prpBackend; @@ -312,11 +329,13 @@ void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue) { IDB_TRACE("IDBRequest::onSuccess(SerializedScriptValue)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); m_result = IDBAny::create(serializedScriptValue); - m_cursor.clear(); + m_pendingCursor.clear(); enqueueEvent(createSuccessEvent()); } @@ -324,8 +343,10 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScriptValue, PassRefPtr<IDBKey> prpPrimaryKey, const IDBKeyPath& keyPath) { LOG_ERROR("CHECKING: onSuccess(value, key, keypath)"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; + ASSERT(m_readyState == PENDING); RefPtr<SerializedScriptValue> serializedScriptValue = prpSerializedScriptValue; #ifndef NDEBUG // FIXME: Assert until we can actually inject the right value. @@ -341,12 +362,12 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScript void IDBRequest::onSuccessWithContinuation() { IDB_TRACE("IDBRequest::onSuccessWithContinuation"); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_requestAborted) return; ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result); - ASSERT(m_cursor); - setResultCursor(m_cursor, m_cursorType); - m_cursor.clear(); + ASSERT(m_pendingCursor); + setResultCursor(m_pendingCursor.release()); enqueueEvent(createSuccessEvent()); } @@ -355,7 +376,7 @@ bool IDBRequest::hasPendingActivity() const // FIXME: In an ideal world, we should return true as long as anyone has a or can // get a handle to us and we have event listeners. This is order to handle // user generated events properly. - return !m_requestFinished || ActiveDOMObject::hasPendingActivity(); + return m_readyState == PENDING || ActiveDOMObject::hasPendingActivity(); } void IDBRequest::stop() @@ -387,12 +408,13 @@ ScriptExecutionContext* IDBRequest::scriptExecutionContext() const bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) { IDB_TRACE("IDBRequest::dispatchEvent"); - ASSERT(!m_requestFinished); + ASSERT(m_readyState == PENDING); ASSERT(!m_contextStopped); ASSERT(m_enqueuedEvents.size()); ASSERT(scriptExecutionContext()); ASSERT(event->target() == this); ASSERT_WITH_MESSAGE(m_readyState < DONE, "m_readyState < DONE(%d), was %d", DONE, m_readyState); + if (event->type() != eventNames().blockedEvent) m_readyState = DONE; @@ -412,12 +434,10 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) targets.append(m_transaction->db()); } + // Cursor properties should not updated until the success event is being dispatched. RefPtr<IDBCursor> cursorToNotify; - if (m_result) { - if (m_result->type() == IDBAny::IDBCursorType) - cursorToNotify = m_result->idbCursor(); - else if (m_result->type() == IDBAny::IDBCursorWithValueType) - cursorToNotify = m_result->idbCursorWithValue(); + if (event->type() == eventNames().successEvent) { + cursorToNotify = getResultCursor(); if (cursorToNotify) cursorToNotify->setValueReady(); } @@ -432,15 +452,11 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) if (setTransactionActive) m_transaction->setActive(false); - // If the result was of type IDBCursor, or a onBlocked event, then we'll fire again. - if (event->type() != eventNames().blockedEvent && (!cursorToNotify || m_cursorFinished)) - m_requestFinished = true; - if (cursorToNotify) cursorToNotify->postSuccessHandlerCallback(); if (m_transaction) { - if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) { + if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) { m_transaction->setError(m_error); m_transaction->abort(); } @@ -465,12 +481,12 @@ void IDBRequest::uncaughtExceptionInEventHandler() void IDBRequest::enqueueEvent(PassRefPtr<Event> event) { - ASSERT(!m_requestFinished); + ASSERT(m_readyState == PENDING || m_readyState == DONE); if (m_contextStopped || !scriptExecutionContext()) return; - ASSERT(m_readyState < DONE); + ASSERT(m_readyState == PENDING); EventQueue* eventQueue = scriptExecutionContext()->eventQueue(); event->setTarget(this); @@ -489,16 +505,6 @@ EventTargetData* IDBRequest::ensureEventTargetData() return &m_eventTargetData; } -void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> prpCursor, IDBCursorBackendInterface::CursorType type) -{ - if (type == IDBCursorBackendInterface::IndexKeyCursor) { - m_result = IDBAny::create(prpCursor); - return; - } - - m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor)); -} - } // namespace WebCore #endif diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 06ca9db9a..aa9b3f58e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -73,11 +73,9 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(error); void markEarlyDeath(); - bool resetReadyState(IDBTransaction*); void setCursorDetails(IDBCursorBackendInterface::CursorType, IDBCursor::Direction); - void setCursor(PassRefPtr<IDBCursor>); + void setPendingCursor(PassRefPtr<IDBCursor>); void finishCursor(); - IDBAny* source(); void abort(); // IDBCallbacks @@ -122,14 +120,14 @@ private: virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); - void setResultCursor(PassRefPtr<IDBCursor>, IDBCursorBackendInterface::CursorType); + PassRefPtr<IDBCursor> getResultCursor(); + void setResultCursor(PassRefPtr<IDBCursor>); RefPtr<IDBAny> m_source; RefPtr<IDBTransaction> m_transaction; ReadyState m_readyState; bool m_requestAborted; // May be aborted by transaction then receive async onsuccess; ignore vs. assert. - bool m_requestFinished; // Is it possible that we'll fire any more events? If not, we're finished. bool m_cursorFinished; bool m_contextStopped; Vector<RefPtr<Event> > m_enqueuedEvents; @@ -137,7 +135,7 @@ private: // Only used if the result type will be a cursor. IDBCursorBackendInterface::CursorType m_cursorType; IDBCursor::Direction m_cursorDirection; - RefPtr<IDBCursor> m_cursor; + RefPtr<IDBCursor> m_pendingCursor; EventTargetData m_eventTargetData; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp index 5c2b0ecba..f5e761e6a 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp @@ -318,7 +318,7 @@ IDBTransaction::Mode IDBTransaction::stringToMode(const String& modeString, Exce return IDBTransaction::READ_ONLY; if (modeString == IDBTransaction::modeReadWrite()) return IDBTransaction::READ_WRITE; - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBTransaction::READ_ONLY; } @@ -338,7 +338,7 @@ const AtomicString& IDBTransaction::modeToString(IDBTransaction::Mode mode, Exce break; default: - ec = IDBDatabaseException::IDB_TYPE_ERR; + ec = NATIVE_TYPE_ERR; return IDBTransaction::modeReadOnly(); } } diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp index 94d30dc93..70f3367ab 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp @@ -32,6 +32,7 @@ #include "IDBCursorBackendImpl.h" #include "IDBDatabaseBackendImpl.h" #include "IDBDatabaseException.h" +#include "IDBObjectStoreBackendImpl.h" #include "IDBTracing.h" #include "IDBTransactionCoordinator.h" @@ -76,7 +77,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStor return 0; } - RefPtr<IDBObjectStoreBackendInterface> objectStore = m_database->objectStore(name); + RefPtr<IDBObjectStoreBackendImpl> objectStore = m_database->objectStore(name); // FIXME: This is only necessary right now beacuse a setVersion transaction could modify things // between its creation (where another check occurs) and the .objectStore call. // There's a bug to make this impossible in the spec. When we make it impossible here, we diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h index 4ea3bfd43..daa39e1c3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h @@ -44,19 +44,24 @@ class IDBDatabaseBackendImpl; class IDBTransactionBackendImpl : public IDBTransactionBackendInterface { public: static PassRefPtr<IDBTransactionBackendImpl> create(DOMStringList* objectStores, unsigned short mode, IDBDatabaseBackendImpl*); + static IDBTransactionBackendImpl* from(IDBTransactionBackendInterface* interface) + { + return static_cast<IDBTransactionBackendImpl*>(interface); + } virtual ~IDBTransactionBackendImpl(); + // IDBTransactionBackendInterface virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, ExceptionCode&); - virtual unsigned short mode() const { return m_mode; } - virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask); virtual void didCompleteTaskEvents(); virtual void abort(); virtual void setCallbacks(IDBTransactionCallbacks* callbacks) { m_callbacks = callbacks; } - virtual void registerOpenCursor(IDBCursorBackendImpl*); - virtual void unregisterOpenCursor(IDBCursorBackendImpl*); - virtual void addPendingEvents(int); void run(); + unsigned short mode() const { return m_mode; } + bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr); + void registerOpenCursor(IDBCursorBackendImpl*); + void unregisterOpenCursor(IDBCursorBackendImpl*); + void addPendingEvents(int); private: IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, IDBDatabaseBackendImpl*); diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h index d8f48ab50..bdc52ffe3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h +++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h @@ -50,15 +50,10 @@ public: virtual ~IDBTransactionBackendInterface() { } virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, ExceptionCode&) = 0; - virtual unsigned short mode() const = 0; - virtual bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr) = 0; virtual void didCompleteTaskEvents() = 0; virtual void commit() = 0; virtual void abort() = 0; virtual void setCallbacks(IDBTransactionCallbacks*) = 0; - virtual void registerOpenCursor(IDBCursorBackendImpl*) = 0; - virtual void unregisterOpenCursor(IDBCursorBackendImpl*) = 0; - virtual void addPendingEvents(int) = 0; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/webaudio/DelayNode.cpp b/Source/WebCore/Modules/webaudio/DelayNode.cpp index 51cc71e8b..680c29f79 100644 --- a/Source/WebCore/Modules/webaudio/DelayNode.cpp +++ b/Source/WebCore/Modules/webaudio/DelayNode.cpp @@ -30,9 +30,13 @@ namespace WebCore { +// FIXME: What should be the maximum allowed delay? Arbitrarily set to 300 sec (5 minutes). +const double maximumAllowedDelayTime = 300; + DelayNode::DelayNode(AudioContext* context, float sampleRate, double maxDelayTime) : AudioBasicProcessorNode(context, sampleRate) { + maxDelayTime = std::max(std::min(maxDelayTime, maximumAllowedDelayTime), 0.0); m_processor = adoptPtr(new DelayProcessor(context, sampleRate, 1, maxDelayTime)); setNodeType(NodeTypeDelay); } diff --git a/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp b/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp index 10b08a2b7..0344ca8f6 100644 --- a/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp +++ b/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp @@ -30,10 +30,10 @@ #include "config.h" #include "QuotaTracker.h" -#include "PlatformSupport.h" #if ENABLE(SQL_DATABASE) +#include <public/Platform.h> #include <wtf/StdLibExtras.h> namespace WebCore { @@ -48,7 +48,7 @@ void QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin( const String& originIdentifier, const String& databaseName, unsigned long long* databaseSize, unsigned long long* spaceAvailable) { - // Extra scope to unlock prior to potentially calling PlatformSupport. + // Extra scope to unlock prior to potentially calling WebKit::Platform. { MutexLocker lockData(m_dataGuard); ASSERT(m_databaseSizes.contains(originIdentifier)); @@ -63,7 +63,7 @@ void QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin( } // The embedder hasn't pushed this value to us, so we pull it as needed. - *spaceAvailable = PlatformSupport::databaseGetSpaceAvailableForOrigin(originIdentifier); + *spaceAvailable = WebKit::Platform::current()->databaseGetSpaceAvailableForOrigin(originIdentifier); } void QuotaTracker::updateDatabaseSize( diff --git a/Source/WebCore/PlatformBlackBerry.cmake b/Source/WebCore/PlatformBlackBerry.cmake index 587ede3d0..20048510a 100644 --- a/Source/WebCore/PlatformBlackBerry.cmake +++ b/Source/WebCore/PlatformBlackBerry.cmake @@ -312,7 +312,7 @@ ENDFOREACH () # FIXME: We need to add the IDLs for SQL storage and Web Workers. See PR #123484. SET(WebCore_NO_CPP_IDL_FILES - ${SVG_IDL_FILES} + ${WebCore_SVG_IDL_FILES} dom/CustomEvent.idl dom/PopStateEvent.idl inspector/ScriptProfile.idl diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index 32a31b606..a9a4f1122 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -33,6 +33,7 @@ LIST(APPEND WebCore_SOURCES platform/efl/DragImageEfl.cpp platform/efl/EflKeyboardUtilities.cpp platform/efl/EflScreenUtilities.cpp + platform/efl/ErrorsEfl.cpp platform/efl/EventLoopEfl.cpp platform/efl/FileSystemEfl.cpp platform/efl/GamepadsEfl.cpp @@ -84,6 +85,7 @@ LIST(APPEND WebCore_SOURCES platform/network/soup/CredentialStorageSoup.cpp platform/network/soup/DNSSoup.cpp platform/network/soup/GOwnPtrSoup.cpp + platform/network/soup/ProxyResolverSoup.cpp platform/network/soup/ProxyServerSoup.cpp platform/network/soup/ResourceHandleSoup.cpp platform/network/soup/ResourceRequestSoup.cpp @@ -263,24 +265,30 @@ IF (ENABLE_VIDEO) ) ENDIF () -IF (ENABLE_WEBGL) +IF (WTF_USE_3D_GRAPHICS) + SET(WTF_USE_OPENGL 1) + ADD_DEFINITIONS(-DWTF_USE_OPENGL=1) + LIST(APPEND WebCore_INCLUDE_DIRECTORIES - ${OPENGL_INCLUDE_DIR} "${WEBCORE_DIR}/platform/graphics/cairo" - "${WEBCORE_DIR}/platform/graphics/glx" "${WEBCORE_DIR}/platform/graphics/opengl" + "${WEBCORE_DIR}/platform/graphics/texmap" ) LIST(APPEND WebCore_LIBRARIES ${OPENGL_gl_LIBRARY} ) LIST(APPEND WebCore_SOURCES + platform/graphics/OpenGLShims.cpp platform/graphics/cairo/DrawingBufferCairo.cpp + platform/graphics/cairo/GLContext.cpp platform/graphics/cairo/GraphicsContext3DCairo.cpp - platform/graphics/glx/GraphicsContext3DPrivate.cpp - platform/graphics/OpenGLShims.cpp + platform/graphics/cairo/GraphicsContext3DPrivate.cpp platform/graphics/opengl/Extensions3DOpenGL.cpp + platform/graphics/opengl/Extensions3DOpenGLCommon.cpp platform/graphics/opengl/GraphicsContext3DOpenGL.cpp platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp + platform/graphics/texmap/TextureMapperGL.cpp + platform/graphics/texmap/TextureMapperShaderManager.cpp ) ENDIF () diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 3244bbc04..23bc2d0e2 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -3679,6 +3679,8 @@ contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { platform/graphics/Extensions3D.h \ platform/graphics/GraphicsContext3D.h \ platform/graphics/gpu/DrawingBuffer.h \ + platform/graphics/gpu/Texture.h \ + platform/graphics/gpu/TilingData.h \ platform/graphics/opengl/Extensions3DOpenGL.h \ platform/graphics/texmap/TextureMapperGL.h \ platform/graphics/texmap/TextureMapperShaderManager.h @@ -3688,6 +3690,8 @@ contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { platform/graphics/GraphicsContext3D.cpp \ platform/graphics/gpu/DrawingBuffer.cpp \ platform/graphics/gpu/qt/DrawingBufferQt.cpp \ + platform/graphics/gpu/Texture.cpp \ + platform/graphics/gpu/TilingData.cpp \ platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp \ platform/graphics/opengl/Extensions3DOpenGLCommon.cpp \ platform/graphics/qt/GraphicsContext3DQt.cpp \ diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 9efb2c77a..98843d634 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -1029,6 +1029,7 @@ __ZN7WebCore9TimerBase4stopEv __ZN7WebCore9TimerBase5startEdd __ZN7WebCore9TimerBaseC2Ev __ZN7WebCore9TimerBaseD2Ev +__ZN7WebCore9TreeScope12nullInstanceEv __ZN7WebCore9closeFileERi __ZN7WebCore9endOfWordERKNS_15VisiblePositionENS_9EWordSideE __ZN7WebCore9fontCacheEv @@ -1273,7 +1274,6 @@ __ZNK7WebCore4Node20traversePreviousNodeEPKS0_ __ZNK7WebCore4Node27traverseNextAncestorSiblingEv __ZNK7WebCore4Node31numberOfScopedHTMLStyleChildrenEv __ZNK7WebCore4Node9nodeIndexEv -__ZNK7WebCore4Node9treeScopeEv __ZNK7WebCore4Page10pluginDataEv __ZNK7WebCore4Page14renderTreeSizeEv __ZNK7WebCore4Page15backForwardListEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index 2b4df7a61..70243cc54 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -283,7 +283,7 @@ 'cflags!': ['-g'], }, }], - ['os_posix==1 and OS!="mac" and gcc_version==46', { + ['os_posix==1 and OS!="mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict # with upcoming c++0x types. @@ -511,6 +511,17 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp', ], + 'conditions': [ + ['OS=="win"', { + 'variables': { + # Using cl instead of cygwin gcc cuts the processing time from + # 1m58s to 0m52s. + 'preprocessor': '--preprocessor "cl.exe /nologo /EP /TP"', + }, + }, { + 'variables': { 'preprocessor': '', } + }], + ], 'action': [ 'perl', '-w', @@ -524,6 +535,7 @@ '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp', '--idlAttributesFile', '../bindings/scripts/IDLAttributes.txt', + '<@(preprocessor)', ], 'message': 'Resolving [Supplemental=XXX] dependencies in all IDL files', } @@ -1429,7 +1441,7 @@ ], }, }], - ['OS != "android" and "WTF_USE_WEBAUDIO_FFMPEG=1" in feature_defines', { + ['"WTF_USE_WEBAUDIO_FFMPEG=1" in feature_defines', { # This directory needs to be on the include path for multiple sub-targets of webcore. 'direct_dependent_settings': { 'include_dirs': [ diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 09d970f1f..a172d5e5b 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -2162,6 +2162,8 @@ 'bindings/v8/IsolatedWorld.h', 'bindings/v8/JavaScriptCallFrame.cpp', 'bindings/v8/JavaScriptCallFrame.h', + 'bindings/v8/NPObjectWrapper.cpp', + 'bindings/v8/NPObjectWrapper.h', 'bindings/v8/NPV8Object.cpp', 'bindings/v8/NPV8Object.h', 'bindings/v8/Dictionary.cpp', @@ -3723,6 +3725,7 @@ 'platform/graphics/filters/skia/FEColorMatrixSkia.cpp', 'platform/graphics/filters/skia/FEGaussianBlurSkia.cpp', 'platform/graphics/filters/skia/FEMorphologySkia.cpp', + 'platform/graphics/filters/skia/FELightingSkia.cpp', 'platform/graphics/freetype/FontCacheFreeType.cpp', 'platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp', 'platform/graphics/freetype/FontPlatformData.h', @@ -3786,7 +3789,6 @@ 'platform/graphics/mac/ColorMac.mm', 'platform/graphics/mac/ComplexTextController.cpp', 'platform/graphics/mac/ComplexTextController.h', - 'platform/graphics/mac/ComplexTextControllerATSUI.cpp', 'platform/graphics/mac/ComplexTextControllerCoreText.mm', 'platform/graphics/mac/FloatPointMac.mm', 'platform/graphics/mac/FloatRectMac.mm', @@ -3806,7 +3808,6 @@ 'platform/graphics/mac/IntSizeMac.mm', 'platform/graphics/mac/MediaPlayerPrivateQTKit.h', 'platform/graphics/mac/MediaPlayerPrivateQTKit.mm', - 'platform/graphics/mac/SimpleFontDataATSUI.mm', 'platform/graphics/mac/SimpleFontDataCoreText.cpp', 'platform/graphics/mac/SimpleFontDataMac.mm', 'platform/graphics/mac/WebGLLayer.h', @@ -4443,8 +4444,6 @@ 'platform/text/mac/LocaleMac.mm', 'platform/text/mac/LocalizedDateMac.cpp', 'platform/text/mac/LocalizedNumberMac.mm', - 'platform/text/mac/ShapeArabic.c', - 'platform/text/mac/ShapeArabic.h', 'platform/text/mac/StringImplMac.mm', 'platform/text/mac/StringMac.mm', 'platform/text/mac/TextBoundaries.mm', @@ -6295,6 +6294,7 @@ 'inspector/front-end/ExtensionPanel.js', 'inspector/front-end/ExtensionRegistryStub.js', 'inspector/front-end/ExtensionServer.js', + 'inspector/front-end/ExtensionView.js', 'inspector/front-end/FileManager.js', 'inspector/front-end/FileContentView.js', 'inspector/front-end/FileSystemModel.js', @@ -6320,7 +6320,6 @@ 'inspector/front-end/InspectorFrontendAPI.js', 'inspector/front-end/InspectorFrontendHostStub.js', 'inspector/front-end/InspectorView.js', - 'inspector/front-end/InjectedFakeWorker.js', 'inspector/front-end/inspector.js', 'inspector/front-end/JavaScriptContextManager.js', 'inspector/front-end/JavaScriptFormatter.js', @@ -8282,14 +8281,11 @@ 'platform/graphics/chromium/TextureCopier.h', 'platform/graphics/chromium/TextureLayerChromium.cpp', 'platform/graphics/chromium/TextureLayerChromium.h', - 'platform/graphics/chromium/TextureAllocator.h', 'platform/graphics/chromium/TextureUploader.h', 'platform/graphics/chromium/ThrottledTextureUploader.cpp', 'platform/graphics/chromium/ThrottledTextureUploader.h', 'platform/graphics/chromium/TiledLayerChromium.cpp', 'platform/graphics/chromium/TiledLayerChromium.h', - 'platform/graphics/chromium/TrackingTextureAllocator.cpp', - 'platform/graphics/chromium/TrackingTextureAllocator.h', 'platform/graphics/chromium/TreeSynchronizer.cpp', 'platform/graphics/chromium/TreeSynchronizer.h', 'platform/graphics/chromium/VideoLayerChromium.cpp', @@ -8360,6 +8356,7 @@ 'platform/graphics/chromium/cc/CCPriorityCalculator.h', 'platform/graphics/chromium/cc/CCProxy.cpp', 'platform/graphics/chromium/cc/CCProxy.h', + 'platform/graphics/chromium/cc/CCQuadSink.h', 'platform/graphics/chromium/cc/CCQuadCuller.cpp', 'platform/graphics/chromium/cc/CCQuadCuller.h', 'platform/graphics/chromium/cc/CCRenderPass.cpp', @@ -8371,6 +8368,8 @@ 'platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp', 'platform/graphics/chromium/cc/CCRenderSurfaceFilters.h', 'platform/graphics/chromium/cc/CCRenderingStats.h', + 'platform/graphics/chromium/cc/CCResourceProvider.cpp', + 'platform/graphics/chromium/cc/CCResourceProvider.h', 'platform/graphics/chromium/cc/CCScheduler.cpp', 'platform/graphics/chromium/cc/CCScheduler.h', 'platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index e1abbec66..357ea4624 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -18745,7 +18745,6 @@ __ZN7WebCore22WorkerScriptController28scheduleExecutionTerminationEv __ZN7WebCore15DatabaseTracker31interruptAllDatabasesForContextEPKNS_22ScriptExecutionContextE __ZN7WebCore14AbstractWorkerD2Ev __ZN7WebCore29WorkerThreadShutdownStartTask11performTaskEPNS_22ScriptExecutionContextE -__ZN7WebCore14AbstractWorker15onDestroyWorkerEv __ZN7WebCore24DatabaseTaskSynchronizerC1Ev __ZN7WebCore24DatabaseTaskSynchronizer13taskCompletedEv __ZN7WebCore13WorkerContext21notifyObserversOfStopEv @@ -27869,8 +27868,6 @@ __ZN7WebCore26InspectorBackendDispatcher17Debugger_stepOverElPNS_15InspectorObje __ZN7WebCore22InspectorDebuggerAgent8stepOverEPN3WTF6StringE __ZN7WebCore17ScriptDebugServer17stepOverStatementEv __ZSt4swapIN7WebCore22InspectorDebuggerAgent6ScriptEEvRT_S4_ -__ZN7WebCore24InspectorInstrumentation19didCreateWorkerImplEPNS_19InstrumentingAgentsElRKN3WTF6StringEb -__ZN7WebCore14InspectorAgent15didCreateWorkerElRKN3WTF6StringEb __ZN3WTF7HashMapIlNS_6RefPtrIN7WebCore23InspectorWorkerResourceEEENS_7IntHashImEENS_10HashTraitsIlEENS7_IS4_EEE3setERKlRKS4_ __ZN3WTF17HashMapTranslatorISt4pairIlNS_6RefPtrIN7WebCore23InspectorWorkerResourceEEEENS_14PairHashTraitsINS_10HashTraitsIlEENS8_IS5_EEEENS_7IntHashImEEE9translateERS6_RKlRKS5_ __ZN7WebCore26InspectorBackendDispatcher14DOM_removeNodeElPNS_15InspectorObjectE diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 49522f304..513d261a4 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -193,8 +193,7 @@ contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { contains(QT_CONFIG, opengles2): LIBS += -lEGL mac: LIBS += -framework IOSurface -framework CoreFoundation linux-*:contains(DEFINES, HAVE_XCOMPOSITE=1): LIBS += -lXcomposite - # Only WebKit1 needs the opengl module, so it's optional for Qt5. - haveQt(4)|contains(QT_CONFIG, opengl): QT *= opengl + haveQt(4): QT *= opengl } !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) { diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 19be056d1..14123fea1 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -75106,6 +75106,10 @@ > </File> <File + RelativePath="..\inspector\front-end\ExtensionView.js" + > + </File> + <File RelativePath="..\inspector\front-end\FileContentView.js" > </File> @@ -75206,10 +75210,6 @@ > </File> <File - RelativePath="..\inspector\front-end\InjectedFakeWorker.js" - > - </File> - <File RelativePath="..\inspector\front-end\inspector.css" > </File> diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 93be27504..67e6bc5d8 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -351,7 +351,6 @@ 15D17D21147231EB005EBCA6 /* InspectorFileSystemAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15D17D1E147231EB005EBCA6 /* InspectorFileSystemAgent.cpp */; }; 15D17D22147231EB005EBCA6 /* InspectorFileSystemAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 15D17D1F147231EB005EBCA6 /* InspectorFileSystemAgent.h */; }; 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */; }; - 163E8B13118B3ADD00ED9231 /* SimpleFontDataATSUI.mm in Sources */ = {isa = PBXBuildFile; fileRef = 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */; }; 185BCF280F3279CE000EA262 /* ThreadTimers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 185BCF260F3279CE000EA262 /* ThreadTimers.cpp */; }; 185BCF290F3279CE000EA262 /* ThreadTimers.h in Headers */ = {isa = PBXBuildFile; fileRef = 185BCF270F3279CE000EA262 /* ThreadTimers.h */; }; 188604B30F2E654A000B6443 /* DOMTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 188604B10F2E654A000B6443 /* DOMTimer.cpp */; }; @@ -992,7 +991,6 @@ 37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; }; 37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */; }; 37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */; }; - 37C238211098C84200EF9F72 /* ComplexTextControllerATSUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2381F1098C84200EF9F72 /* ComplexTextControllerATSUI.cpp */; }; 37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */; }; 37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */; }; @@ -4863,8 +4861,6 @@ B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */; }; B2AFFC800D00A5C10030074D /* FontMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC780D00A5C10030074D /* FontMac.mm */; }; B2AFFC830D00A5C10030074D /* GlyphPageTreeNodeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC7B0D00A5C10030074D /* GlyphPageTreeNodeMac.cpp */; }; - B2AFFC930D00A5DF0030074D /* ShapeArabic.c in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC880D00A5DF0030074D /* ShapeArabic.c */; }; - B2AFFC940D00A5DF0030074D /* ShapeArabic.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AFFC890D00A5DF0030074D /* ShapeArabic.h */; }; B2AFFC950D00A5DF0030074D /* StringImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8A0D00A5DF0030074D /* StringImplMac.mm */; }; B2AFFC960D00A5DF0030074D /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8B0D00A5DF0030074D /* StringMac.mm */; }; B2AFFC970D00A5DF0030074D /* TextBoundaries.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */; }; @@ -7335,7 +7331,6 @@ 15D17D1E147231EB005EBCA6 /* InspectorFileSystemAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFileSystemAgent.cpp; sourceTree = "<group>"; }; 15D17D1F147231EB005EBCA6 /* InspectorFileSystemAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFileSystemAgent.h; sourceTree = "<group>"; }; 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontDataCoreText.cpp; sourceTree = "<group>"; }; - 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleFontDataATSUI.mm; sourceTree = "<group>"; }; 185BCF260F3279CE000EA262 /* ThreadTimers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadTimers.cpp; sourceTree = "<group>"; }; 185BCF270F3279CE000EA262 /* ThreadTimers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadTimers.h; sourceTree = "<group>"; }; 188604B10F2E654A000B6443 /* DOMTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTimer.cpp; sourceTree = "<group>"; }; @@ -8034,7 +8029,6 @@ 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = "<group>"; }; 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; }; 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = "<group>"; }; - 37C2381F1098C84200EF9F72 /* ComplexTextControllerATSUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextControllerATSUI.cpp; sourceTree = "<group>"; }; 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ComplexTextControllerCoreText.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypesettingFeatures.h; sourceTree = "<group>"; }; 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringKeyedMRUCache.h; sourceTree = "<group>"; }; @@ -12061,8 +12055,6 @@ B2AFFC850D00A5DF0030074D /* character-sets.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "character-sets.txt"; sourceTree = "<group>"; }; B2AFFC860D00A5DF0030074D /* mac-encodings.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "mac-encodings.txt"; sourceTree = "<group>"; }; B2AFFC870D00A5DF0030074D /* make-charset-table.pl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.perl; path = "make-charset-table.pl"; sourceTree = "<group>"; }; - B2AFFC880D00A5DF0030074D /* ShapeArabic.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ShapeArabic.c; sourceTree = "<group>"; }; - B2AFFC890D00A5DF0030074D /* ShapeArabic.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ShapeArabic.h; sourceTree = "<group>"; }; B2AFFC8A0D00A5DF0030074D /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplMac.mm; sourceTree = "<group>"; }; B2AFFC8B0D00A5DF0030074D /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = StringMac.mm; sourceTree = "<group>"; }; B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = TextBoundaries.mm; sourceTree = "<group>"; }; @@ -19574,7 +19566,6 @@ B275354A0B053814002CE64F /* ColorMac.mm */, 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */, 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */, - 37C2381F1098C84200EF9F72 /* ComplexTextControllerATSUI.cpp */, 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */, 49AF2D6B14435D210016A784 /* DisplayRefreshMonitorMac.cpp */, B275354B0B053814002CE64F /* FloatPointMac.mm */, @@ -19596,7 +19587,6 @@ E4B41E100CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.h */, E4B41E110CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.mm */, 0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */, - 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */, 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */, B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */, 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */, @@ -19847,8 +19837,6 @@ F5CC42DB12F801CA00D5F7E3 /* LocalizedNumberMac.mm */, B2AFFC860D00A5DF0030074D /* mac-encodings.txt */, B2AFFC870D00A5DF0030074D /* make-charset-table.pl */, - B2AFFC880D00A5DF0030074D /* ShapeArabic.c */, - B2AFFC890D00A5DF0030074D /* ShapeArabic.h */, B2AFFC8A0D00A5DF0030074D /* StringImplMac.mm */, B2AFFC8B0D00A5DF0030074D /* StringMac.mm */, B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */, @@ -24609,7 +24597,6 @@ BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */, A6D169641346B4C1000EB770 /* ShadowRoot.h in Headers */, A80E6CE80A1989CA007FB8C5 /* ShadowValue.h in Headers */, - B2AFFC940D00A5DF0030074D /* ShapeArabic.h in Headers */, 1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */, 97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */, 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */, @@ -25761,7 +25748,6 @@ B27535770B053814002CE64F /* ColorMac.mm in Sources */, 6550B6A1099DF0270090D781 /* Comment.cpp in Sources */, 37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */, - 37C238211098C84200EF9F72 /* ComplexTextControllerATSUI.cpp in Sources */, 37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.mm in Sources */, 4A6A0C5B15232F2400B09C6E /* ComposedShadowTreeWalker.cpp in Sources */, 316FE1150E6E1DA700BF6088 /* CompositeAnimation.cpp in Sources */, @@ -27791,7 +27777,6 @@ BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */, A6D169621346B49B000EB770 /* ShadowRoot.cpp in Sources */, A80E6CF40A1989CA007FB8C5 /* ShadowValue.cpp in Sources */, - B2AFFC930D00A5DF0030074D /* ShapeArabic.c in Sources */, 1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */, 512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */, 97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */, @@ -27801,7 +27786,6 @@ 41D168E710226E89009BC827 /* SharedWorkerContext.cpp in Sources */, 41D168ED10226E89009BC827 /* SharedWorkerThread.cpp in Sources */, B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */, - 163E8B13118B3ADD00ED9231 /* SimpleFontDataATSUI.mm in Sources */, 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */, B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */, C5A1EA7C152BCF04004D00B6 /* SimplifyMarkupCommand.cpp in Sources */, diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp index 71a2214ea..04d3687cf 100644 --- a/Source/WebCore/accessibility/AXObjectCache.cpp +++ b/Source/WebCore/accessibility/AXObjectCache.cpp @@ -238,7 +238,7 @@ static PassRefPtr<AccessibilityObject> createFromRenderer(RenderObject* renderer if (cssBox->isTableCell()) return AccessibilityTableCell::create(toRenderTableCell(cssBox)); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // progress bar if (cssBox->isProgress()) return AccessibilityProgressIndicator::create(toRenderProgress(cssBox)); diff --git a/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp b/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp index c7202f09d..494d1c20b 100644 --- a/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp +++ b/Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(PROGRESS_TAG) - #include "AccessibilityProgressIndicator.h" +#if ENABLE(PROGRESS_ELEMENT) #include "FloatConversion.h" #include "HTMLNames.h" #include "HTMLProgressElement.h" @@ -75,4 +73,4 @@ HTMLProgressElement* AccessibilityProgressIndicator::element() const } // namespace WebCore -#endif // ENABLE(PROGRESS_TAG) +#endif // ENABLE(PROGRESS_ELEMENT) diff --git a/Source/WebCore/accessibility/AccessibilityProgressIndicator.h b/Source/WebCore/accessibility/AccessibilityProgressIndicator.h index b52a619ae..af8bc2086 100644 --- a/Source/WebCore/accessibility/AccessibilityProgressIndicator.h +++ b/Source/WebCore/accessibility/AccessibilityProgressIndicator.h @@ -21,8 +21,7 @@ #ifndef AccessibilityProgressIndicator_h #define AccessibilityProgressIndicator_h -#if ENABLE(PROGRESS_TAG) - +#if ENABLE(PROGRESS_ELEMENT) #include "AccessibilityRenderObject.h" namespace WebCore { @@ -52,6 +51,6 @@ private: } // namespace WebCore -#endif // ENABLE(PROGRESS_TAG) +#endif // ENABLE(PROGRESS_ELEMENT) #endif // AccessibilityProgressIndicator_h diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 74c2b03fa..31e64e7dc 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1363,7 +1363,7 @@ String AccessibilityRenderObject::title() const if (isInputTag) { HTMLInputElement* input = static_cast<HTMLInputElement*>(node); if (input->isTextButton()) - return input->value(); + return input->valueWithDefault(); } if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl()) { @@ -1413,6 +1413,53 @@ String AccessibilityRenderObject::ariaAccessibilityDescription() const return String(); } +String AccessibilityRenderObject::webAreaAccessibilityDescription() const +{ + // The WebArea description should follow this order: + // aria-label on the <html> + // title on the <html> + // <title> inside the <head> (of it was set through JS) + // name on the <html> + // For iframes: + // aria-label on the <iframe> + // title on the <iframe> + // name on the <iframe> + + if (!m_renderer) + return String(); + + Document* document = m_renderer->document(); + + // Check if the HTML element has an aria-label for the webpage. + if (Element* documentElement = document->documentElement()) { + const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr); + if (!ariaLabel.isEmpty()) + return ariaLabel; + } + + Node* owner = document->ownerElement(); + if (owner) { + if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) { + const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr); + if (!title.isEmpty()) + return title; + return static_cast<HTMLFrameElementBase*>(owner)->getNameAttribute(); + } + if (owner->isHTMLElement()) + return toHTMLElement(owner)->getNameAttribute(); + } + + String documentTitle = document->title(); + if (!documentTitle.isEmpty()) + return documentTitle; + + owner = document->body(); + if (owner && owner->isHTMLElement()) + return toHTMLElement(owner)->getNameAttribute(); + + return String(); +} + String AccessibilityRenderObject::accessibilityDescription() const { if (!m_renderer) @@ -1441,33 +1488,9 @@ String AccessibilityRenderObject::accessibilityDescription() const return getAttribute(MathMLNames::alttextAttr); #endif - if (isWebArea()) { - Document* document = m_renderer->document(); - - // Check if the HTML element has an aria-label for the webpage. - Element* documentElement = document->documentElement(); - if (documentElement) { - const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr); - if (!ariaLabel.isEmpty()) - return ariaLabel; - } - - Node* owner = document->ownerElement(); - if (owner) { - if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) { - const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr); - if (!title.isEmpty()) - return title; - return static_cast<HTMLFrameElementBase*>(owner)->getNameAttribute(); - } - if (owner->isHTMLElement()) - return toHTMLElement(owner)->getNameAttribute(); - } - owner = document->body(); - if (owner && owner->isHTMLElement()) - return toHTMLElement(owner)->getNameAttribute(); - } - + if (isWebArea()) + return webAreaAccessibilityDescription(); + return String(); } diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.h b/Source/WebCore/accessibility/AccessibilityRenderObject.h index 4d66e5596..a43b71d55 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.h +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.h @@ -318,7 +318,8 @@ private: String accessibilityDescriptionForElements(Vector<Element*> &elements) const; void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const; String ariaAccessibilityDescription() const; - + String webAreaAccessibilityDescription() const; + virtual ESpeak speakProperty() const; virtual const AtomicString& ariaLiveRegionStatus() const; diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index fc179907a..cf21aae66 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -198,6 +198,11 @@ void setDOMException(ExecState* exec, ExceptionCode ec) if (!ec || exec->hadException()) return; + if (ec == NATIVE_TYPE_ERR) { + throwTypeError(exec); + return; + } + // FIXME: All callers to setDOMException need to pass in the right global object // for now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this: // frames[0].document.createElement(null, null); // throws an exception which should have the subframes prototypes. diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp index f18a05e3b..d4a06e563 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp @@ -32,6 +32,7 @@ #include "JSNode.h" #include "Logging.h" #include "Page.h" +#include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" #include "WebCoreJSClientData.h" @@ -208,6 +209,7 @@ JSGlobalData* JSDOMWindowBase::commonJSGlobalData() static JSGlobalData* globalData = 0; if (!globalData) { + ScriptController::initializeThreading(); globalData = JSGlobalData::createLeaked(ThreadStackTypeLarge, LargeHeap).leakRef(); globalData->timeoutChecker.setTimeoutInterval(10000); // 10 seconds #ifndef NDEBUG diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp index 4967107df..938867ff8 100644 --- a/Source/WebCore/bindings/js/JSDictionary.cpp +++ b/Source/WebCore/bindings/js/JSDictionary.cpp @@ -163,7 +163,7 @@ void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& re } #endif -#if ENABLE(MUTATION_OBSERVERS) +#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS) void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result) { result.clear(); diff --git a/Source/WebCore/bindings/js/JSDictionary.h b/Source/WebCore/bindings/js/JSDictionary.h index bd1754dd8..3e7ee55b2 100644 --- a/Source/WebCore/bindings/js/JSDictionary.h +++ b/Source/WebCore/bindings/js/JSDictionary.h @@ -102,7 +102,7 @@ private: #if ENABLE(VIDEO_TRACK) static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<TrackBase>& result); #endif -#if ENABLE(MUTATION_OBSERVERS) +#if ENABLE(MUTATION_OBSERVERS) || ENABLE(WEB_INTENTS) static void convertValue(JSC::ExecState*, JSC::JSValue, HashSet<AtomicString>& result); #endif diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 147c3d986..7ac3e562a 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -409,7 +409,6 @@ END END } - my @enabledAtRuntime; my @enabledPerContext; foreach my $function (@{$dataNode->functions}) { my $name = $function->signature->name; @@ -423,10 +422,6 @@ END END push(@headerContent, "#endif // ${conditionalString}\n") if $conditionalString; } - - if ($attrExt->{"V8EnabledAtRuntime"}) { - push(@enabledAtRuntime, $function); - } } if (IsConstructable($dataNode)) { @@ -457,10 +452,6 @@ END END push(@headerContent, "#endif // ${conditionalString}\n") if $conditionalString; } - if ($attrExt->{"V8EnabledAtRuntime"}) { - push(@enabledAtRuntime, $attribute); - } - if ($attrExt->{"V8EnabledPerContext"}) { push(@enabledPerContext, $attribute); } @@ -901,9 +892,11 @@ END return value; END } - push(@implContentDecls, <<END); + if (!$attribute->isStatic) { + push(@implContentDecls, <<END); ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END + } } # Generate security checks if necessary @@ -926,8 +919,10 @@ END if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; AddToImplIncludes("${implementedBy}.h"); - unshift(@arguments, "imp"); + unshift(@arguments, "imp") if !$attribute->isStatic; $functionName = "${implementedBy}::${functionName}"; + } elsif ($attribute->isStatic) { + $functionName = "${implClassName}::${functionName}"; } else { $functionName = "imp->${functionName}"; } @@ -1081,6 +1076,32 @@ END push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; } +sub GenerateReplaceableAttrSetter +{ + my $dataNode = shift; + my $implClassName = shift; + + push(@implContentDecls, <<END); +static void ${implClassName}ReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.$implClassName.replaceable._set"); +END + + if ($implClassName eq "DOMWindow" || $dataNode->extendedAttributes->{"CheckSecurity"}) { + push(@implContentDecls, <<END); + ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); + if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) + return; +END + } + + push(@implContentDecls, <<END); + info.This()->ForceSet(name, value); +} + +END +} + sub GenerateNormalAttrSetter { my $attribute = shift; @@ -1152,9 +1173,11 @@ END # Skip the rest of the function! } - push(@implContentDecls, <<END); + if (!$attribute->isStatic) { + push(@implContentDecls, <<END); ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END + } } my $nativeType = GetNativeTypeFromSignature($attribute->signature, 0); @@ -1218,8 +1241,10 @@ END if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; AddToImplIncludes("${implementedBy}.h"); - unshift(@arguments, "imp"); + unshift(@arguments, "imp") if !$attribute->isStatic; $functionName = "${implementedBy}::${functionName}"; + } elsif ($attribute->isStatic) { + $functionName = "${interfaceName}::${functionName}"; } else { $functionName = "imp->${functionName}"; } @@ -1468,10 +1493,10 @@ END # Check domain security if needed if (($dataNode->extendedAttributes->{"CheckSecurity"} - || $interfaceName eq "DOMWindow") - && !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) { - # We have not find real use cases yet. - push(@implContentDecls, <<END); + || $interfaceName eq "DOMWindow") + && !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) { + # We have not find real use cases yet. + push(@implContentDecls, <<END); if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) return v8::Handle<v8::Value>(); END @@ -2113,14 +2138,16 @@ sub GenerateSingleBatchedAttribute $data = "&V8${constructorType}::info"; $getter = "${interfaceName}V8Internal::${interfaceName}ConstructorGetter"; } - $setter = "0"; - $propAttr = "v8::ReadOnly"; - + $setter = "${interfaceName}V8Internal::${interfaceName}ReplaceableAttrSetter"; } else { # Default Getter and Setter $getter = "${interfaceName}V8Internal::${attrName}AttrGetter"; $setter = "${interfaceName}V8Internal::${attrName}AttrSetter"; + if ($attrExt->{"Replaceable"}) { + $setter = "${interfaceName}V8Internal::${interfaceName}ReplaceableAttrSetter"; + } + # Custom Setter if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { $hasCustomSetter = 1; @@ -2133,17 +2160,6 @@ sub GenerateSingleBatchedAttribute } } - # Replaceable - if ($attrExt->{"Replaceable"} && !$hasCustomSetter) { - $setter = "0"; - # Handle the special case of window.top being marked as Replaceable. - # FIXME: Investigate whether we could treat window.top as replaceable - # and allow shadowing without it being a security hole. - if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) { - $propAttr .= " | v8::ReadOnly"; - } - } - # Read only attributes if ($attribute->type =~ /^readonly/ || $attrExt->{"V8ReadOnly"}) { $setter = "0"; @@ -2502,6 +2518,8 @@ sub GenerateImplementation push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n"); my $hasConstructors = 0; + my $hasReplaceable = 0; + # Generate property accessors for attributes. for (my $index = 0; $index < @{$dataNode->attributes}; $index++) { my $attribute = @{$dataNode->attributes}[$index]; @@ -2537,9 +2555,11 @@ sub GenerateImplementation $attribute->signature->extendedAttributes->{"V8CustomGetter"})) { GenerateNormalAttrGetter($attribute, $dataNode, $implClassName, $interfaceName); } - if (!$attribute->signature->extendedAttributes->{"CustomSetter"} && + + if ($attribute->signature->extendedAttributes->{"Replaceable"}) { + $hasReplaceable = 1; + } elsif (!$attribute->signature->extendedAttributes->{"CustomSetter"} && !$attribute->signature->extendedAttributes->{"V8CustomSetter"} && - !$attribute->signature->extendedAttributes->{"Replaceable"} && $attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) { GenerateNormalAttrSetter($attribute, $dataNode, $implClassName, $interfaceName); @@ -2550,6 +2570,10 @@ sub GenerateImplementation GenerateConstructorGetter($dataNode, $implClassName); } + if ($hasConstructors || $hasReplaceable) { + GenerateReplaceableAttrSetter($dataNode, $implClassName); + } + if (NeedsToVisitDOMWrapper($dataNode)) { GenerateVisitDOMWrapper($dataNode, $implClassName); } diff --git a/Source/WebCore/bindings/scripts/preprocessor.pm b/Source/WebCore/bindings/scripts/preprocessor.pm index 86a7e382c..3b4cec191 100644 --- a/Source/WebCore/bindings/scripts/preprocessor.pm +++ b/Source/WebCore/bindings/scripts/preprocessor.pm @@ -23,6 +23,7 @@ use warnings; use Config; use IPC::Open2; +use IPC::Open3; BEGIN { use Exporter (); @@ -66,7 +67,10 @@ sub applyPreprocessor # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds. for (my $tries = 0; !$pid && ($tries < 20); $tries++) { eval { - $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), @args, @macros, $fileName); + # Suppress STDERR so that if we're using cl.exe, the output + # name isn't needlessly echoed. + use Symbol 'gensym'; my $err = gensym; + $pid = open3(\*PP_IN, \*PP_OUT, $err, split(' ', $preprocessor), @args, @macros, $fileName); 1; } or do { sleep 1; diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index cb61197ed..013f9097f 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -645,6 +645,14 @@ WebDOMString WebDOMTestObj::hash() const return static_cast<const WTF::String&>(impl()->hash()); } +int WebDOMTestObj::replaceableAttribute() const +{ + if (!impl()) + return 0; + + return impl()->replaceableAttribute(); +} + void WebDOMTestObj::voidMethod() { if (!impl()) diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index a5cf99e59..fc7da9bca 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -142,6 +142,7 @@ public: int id() const; void setId(int); WebDOMString hash() const; + int replaceableAttribute() const; void voidMethod(); void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 34a807551..3b6253cbe 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -144,6 +144,7 @@ enum { PROP_DESCRIPTION, PROP_ID, PROP_HASH, + PROP_REPLACEABLE_ATTRIBUTE, }; static void webkit_dom_test_obj_finalize(GObject* object) @@ -517,6 +518,10 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint propertyId, g_value_take_string(value, convertToUTF8String(coreSelf->hash())); break; } + case PROP_REPLACEABLE_ATTRIBUTE: { + g_value_set_long(value, coreSelf->replaceableAttribute()); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); break; @@ -885,6 +890,15 @@ G_MAXLONG, /* max */ "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_REPLACEABLE_ATTRIBUTE, + g_param_spec_long("replaceable-attribute", /* name */ + "test_obj_replaceable-attribute", /* short description */ + "read-write glong TestObj.replaceable-attribute", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); } @@ -2383,3 +2397,13 @@ webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) return result; } +glong +webkit_dom_test_obj_get_replaceable_attribute(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj* item = WebKit::core(self); + glong result = item->replaceableAttribute(); + return result; +} + diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index 9fa9aadee..727a534e5 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -1345,6 +1345,16 @@ webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value); WEBKIT_API gchar* webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self); +/** + * webkit_dom_test_obj_get_replaceable_attribute: + * @self: A #WebKitDOMTestObj + * + * Returns: + * +**/ +WEBKIT_API glong +webkit_dom_test_obj_get_replaceable_attribute(WebKitDOMTestObj* self); + G_END_DECLS #endif /* WebKitDOMTestObj_h */ diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index afdb3b1ff..c3c829c22 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -81,12 +81,18 @@ static const HashTableValue JSTestInterfaceConstructorTableValues[] = { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic }, #endif #if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalStaticReadOnlyAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr), (intptr_t)0, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalStaticAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructorSupplementalStaticAttr), (intptr_t)setJSTestInterfaceConstructorSupplementalStaticAttr, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) { "supplementalMethod4", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfaceConstructorFunctionSupplementalMethod4), (intptr_t)0, NoIntrinsic }, #endif { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfaceConstructorTable = { 4, 3, JSTestInterfaceConstructorTableValues, 0 }; +static const HashTable JSTestInterfaceConstructorTable = { 5, 3, JSTestInterfaceConstructorTableValues, 0 }; #if ENABLE(Condition11) || ENABLE(Condition12) COMPILE_ASSERT(1 == TestSupplemental::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants); @@ -236,6 +242,30 @@ bool JSTestInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec } #if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec, JSValue, PropertyName) +{ + ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return jsUndefined(); + JSC::JSValue result = jsNumber(TestInterface::supplementalStaticReadOnlyAttr(scriptContext)); + return result; +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSValue, PropertyName) +{ + ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return jsUndefined(); + JSC::JSValue result = jsString(exec, TestInterface::supplementalStaticAttr(scriptContext)); + return result; +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) JSValue jsTestInterfaceSupplementalStr1(ExecState* exec, JSValue slotBase, PropertyName) { JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase)); @@ -296,6 +326,17 @@ void JSTestInterface::put(JSCell* cell, ExecState* exec, PropertyName propertyNa } #if ENABLE(Condition11) || ENABLE(Condition12) +void setJSTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSObject*, JSValue value) +{ + ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return; + TestInterface::setSupplementalStaticAttr(scriptContext, ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec))); +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) void setJSTestInterfaceSupplementalStr2(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h index d7963a2e9..8baaa731d 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -170,6 +170,13 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplemental // Attributes #if ENABLE(Condition11) || ENABLE(Condition12) +JSC::JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) +JSC::JSValue jsTestInterfaceConstructorSupplementalStaticAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +void setJSTestInterfaceConstructorSupplementalStaticAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) JSC::JSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); #endif #if ENABLE(Condition11) || ENABLE(Condition12) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index ecb2174d4..e69da7ebb 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -142,11 +142,12 @@ static const HashTableValue JSTestObjTableValues[] = { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0, NoIntrinsic }, { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId, NoIntrinsic }, { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0, NoIntrinsic }, + { "replaceableAttribute", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReplaceableAttribute), (intptr_t)setJSTestObjReplaceableAttribute, NoIntrinsic }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0, NoIntrinsic }, { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjTable = { 138, 127, JSTestObjTableValues, 0 }; +static const HashTable JSTestObjTable = { 139, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestObjConstructorTableValues[] = @@ -923,6 +924,16 @@ JSValue jsTestObjHash(ExecState* exec, JSValue slotBase, PropertyName) } +JSValue jsTestObjReplaceableAttribute(ExecState* exec, JSValue slotBase, PropertyName) +{ + JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(impl->replaceableAttribute()); + return result; +} + + JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, PropertyName) { JSTestObj* domObject = jsCast<JSTestObj*>(asObject(slotBase)); @@ -1360,6 +1371,14 @@ void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) } +void setJSTestObjReplaceableAttribute(ExecState* exec, JSObject* thisObject, JSValue value) +{ + UNUSED_PARAM(exec); + // Shadowing a built-in object + jsCast<JSTestObj*>(thisObject)->putDirect(exec->globalData(), Identifier(exec, "replaceableAttribute"), value); +} + + JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestObjConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h index 13d72cbf0..306fad8f4 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -324,6 +324,8 @@ JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, JSC::PropertyNa JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjHash(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +JSC::JSValue jsTestObjReplaceableAttribute(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); +void setJSTestObjReplaceableAttribute(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, JSC::PropertyName); // Constants diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 831a50fe9..1c42af006 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -167,6 +167,8 @@ enum { - (int)idName; - (void)setIdName:(int)newIdName; - (NSString *)hashName; +- (int)replaceableAttribute; +- (void)setReplaceableAttribute:(int)newReplaceableAttribute; - (void)voidMethod; - (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (int)intMethod; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 53e459643..fc0937f84 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -707,6 +707,18 @@ return IMPL->hash(); } +- (int)replaceableAttribute +{ + WebCore::JSMainThreadNullState state; + return IMPL->replaceableAttribute(); +} + +- (void)setReplaceableAttribute:(int)newReplaceableAttribute +{ + WebCore::JSMainThreadNullState state; + IMPL->setReplaceableAttribute(newReplaceableAttribute); +} + - (void)voidMethod { WebCore::JSMainThreadNullState state; diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index 34265b2e2..c1ea6f564 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -38,7 +38,7 @@ module test { readonly attribute long readOnlyIntAttr; readonly attribute DOMString readOnlyStringAttr; readonly attribute TestObj readOnlyTestObjAttr; -#if defined(TESTING_JS) +#if defined(TESTING_JS) || defined(TESTING_V8) static readonly attribute long staticReadOnlyIntAttr; static attribute DOMString staticStringAttr; #endif @@ -251,5 +251,7 @@ module test { const unsigned short CONST_VALUE_13 = 0X20; const unsigned short CONST_VALUE_14 = 0x1abc; [Reflect=CONST_IMPL] const unsigned short CONST_JAVASCRIPT = 15; + + attribute [Replaceable] long replaceableAttribute; }; } diff --git a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl index 60514124b..524515bf0 100644 --- a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl +++ b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl @@ -33,6 +33,10 @@ module test { Conditional=Condition11|Condition12, Supplemental=TestInterface ] TestSupplemental { +#if defined(TESTING_JS) || defined(TESTING_V8) + static readonly attribute long supplementalStaticReadOnlyAttr; + static attribute DOMString supplementalStaticAttr; +#endif readonly attribute DOMString supplementalStr1; attribute DOMString supplementalStr2; attribute [CustomGetter, CustomSetter] DOMString supplementalStr3; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index b828d54bc..1d7dcb534 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -50,6 +50,38 @@ template <typename T> void V8_USE(T) { } #if ENABLE(Condition11) || ENABLE(Condition12) +static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalStaticReadOnlyAttr._get"); + return v8Integer(TestSupplemental::supplementalStaticReadOnlyAttr(), info.GetIsolate()); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + +static v8::Handle<v8::Value> supplementalStaticAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalStaticAttr._get"); + return v8String(TestSupplemental::supplementalStaticAttr(), info.GetIsolate()); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + +static void supplementalStaticAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestInterface.supplementalStaticAttr._set"); + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value); + TestSupplemental::setSupplementalStaticAttr(v); + return; +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + static v8::Handle<v8::Value> supplementalStr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestInterface.supplementalStr1._get"); @@ -160,6 +192,14 @@ static v8::Handle<v8::Value> supplementalMethod4Callback(const v8::Arguments& ar static const BatchedAttribute TestInterfaceAttrs[] = { #if ENABLE(Condition11) || ENABLE(Condition12) + // Attribute 'supplementalStaticReadOnlyAttr' (Type: 'readonly attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalStaticReadOnlyAttr", TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition11) || ENABLE(Condition12) +#if ENABLE(Condition11) || ENABLE(Condition12) + // Attribute 'supplementalStaticAttr' (Type: 'attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalStaticAttr", TestInterfaceV8Internal::supplementalStaticAttrAttrGetter, TestInterfaceV8Internal::supplementalStaticAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition11) || ENABLE(Condition12) +#if ENABLE(Condition11) || ENABLE(Condition12) // Attribute 'supplementalStr1' (Type: 'readonly attribute' ExtAttr: 'Conditional ImplementedBy') {"supplementalStr1", TestInterfaceV8Internal::supplementalStr1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index adf5562d6..c47e6ae6c 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -109,6 +109,26 @@ static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> return wrapper; } +static v8::Handle<v8::Value> staticReadOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.staticReadOnlyIntAttr._get"); + return v8Integer(TestObj::staticReadOnlyIntAttr(), info.GetIsolate()); +} + +static v8::Handle<v8::Value> staticStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.staticStringAttr._get"); + return v8String(TestObj::staticStringAttr(), info.GetIsolate()); +} + +static void staticStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.staticStringAttr._set"); + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value); + TestObj::setStaticStringAttr(v); + return; +} + static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.shortAttr._get"); @@ -1010,6 +1030,13 @@ static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8 return v8String(imp->hash(), info.GetIsolate()); } +static v8::Handle<v8::Value> replaceableAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.replaceableAttribute._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8Integer(imp->replaceableAttribute(), info.GetIsolate()); +} + static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.constructors._get"); @@ -1018,6 +1045,12 @@ static v8::Handle<v8::Value> TestObjConstructorGetter(v8::Local<v8::String> name WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); return v8::Handle<v8::Value>();} +static void TestObjReplaceableAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.replaceable._set"); + info.This()->ForceSet(name, value); +} + static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.voidMethod"); @@ -1839,6 +1872,10 @@ static const BatchedAttribute TestObjAttrs[] = { {"readOnlyStringAttr", TestObjV8Internal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '') {"readOnlyTestObjAttr", TestObjV8Internal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'staticReadOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '') + {"staticReadOnlyIntAttr", TestObjV8Internal::staticReadOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'staticStringAttr' (Type: 'attribute' ExtAttr: '') + {"staticStringAttr", TestObjV8Internal::staticStringAttrAttrGetter, TestObjV8Internal::staticStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '') {"shortAttr", TestObjV8Internal::shortAttrAttrGetter, TestObjV8Internal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '') @@ -1915,15 +1952,15 @@ static const BatchedAttribute TestObjAttrs[] = { #endif // ENABLE(Condition1) || ENABLE(Condition2) #if ENABLE(Condition1) // Attribute 'conditionalAttr4' (Type: 'attribute' ExtAttr: 'Conditional') - {"conditionalAttr4", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */}, + {"conditionalAttr4", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectA::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition1) #if ENABLE(Condition1) && ENABLE(Condition2) // Attribute 'conditionalAttr5' (Type: 'attribute' ExtAttr: 'Conditional') - {"conditionalAttr5", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */}, + {"conditionalAttr5", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectB::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition1) && ENABLE(Condition2) #if ENABLE(Condition1) || ENABLE(Condition2) // Attribute 'conditionalAttr6' (Type: 'attribute' ExtAttr: 'Conditional') - {"conditionalAttr6", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::ReadOnly), 0 /* on instance */}, + {"conditionalAttr6", TestObjV8Internal::TestObjConstructorGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, &V8TestObjectC::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition1) || ENABLE(Condition2) // Attribute 'cachedAttribute1' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute') {"cachedAttribute1", TestObjV8Internal::cachedAttribute1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, @@ -1949,6 +1986,8 @@ static const BatchedAttribute TestObjAttrs[] = { {"id", TestObjV8Internal::idAttrGetter, TestObjV8Internal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '') {"hash", TestObjV8Internal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'replaceableAttribute' (Type: 'attribute' ExtAttr: 'Replaceable') + {"replaceableAttribute", TestObjV8Internal::replaceableAttributeAttrGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; static const BatchedCallback TestObjCallbacks[] = { diff --git a/Source/WebCore/bindings/v8/NPObjectWrapper.cpp b/Source/WebCore/bindings/v8/NPObjectWrapper.cpp new file mode 100644 index 000000000..7c73b2f03 --- /dev/null +++ b/Source/WebCore/bindings/v8/NPObjectWrapper.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "NPObjectWrapper.h" + +namespace WebCore { + +struct NPProxyObject { + NPObject object; + NPObjectWrapper* wrapper; +}; + +NPClass NPObjectWrapper::m_npClassWrapper = { + NP_CLASS_STRUCT_VERSION, + NPObjectWrapper::NPAllocate, + NPObjectWrapper::NPDeallocate, + NPObjectWrapper::NPPInvalidate, + NPObjectWrapper::NPHasMethod, + NPObjectWrapper::NPInvoke, + NPObjectWrapper::NPInvokeDefault, + NPObjectWrapper::NPHasProperty, + NPObjectWrapper::NPGetProperty, + NPObjectWrapper::NPSetProperty, + NPObjectWrapper::NPRemoveProperty, + NPObjectWrapper::NPNEnumerate, + NPObjectWrapper::NPNConstruct +}; + +NPObjectWrapper::NPObjectWrapper(NPObject* obj) + : m_wrappedNPObject(obj) +{ +} + +NPObject* NPObjectWrapper::create(NPObject* object) +{ + ASSERT(object); + NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(_NPN_CreateObject(0, &m_npClassWrapper)); + proxyObject->wrapper = new NPObjectWrapper(object); + return reinterpret_cast<NPObject*>(proxyObject); +} + +void NPObjectWrapper::clear() +{ + m_wrappedNPObject = 0; +} + +NPObjectWrapper* NPObjectWrapper::getWrapper(NPObject* obj) +{ + if (&m_npClassWrapper == obj->_class) { + NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(obj); + return proxyObject->wrapper; + } + return 0; +} + +NPObject* NPObjectWrapper::getUnderlyingNPObject(NPObject* obj) +{ + NPObjectWrapper* wrapper = getWrapper(obj); + return wrapper ? wrapper->m_wrappedNPObject : 0; +} + +NPObject* NPObjectWrapper::getObjectForCall(NPObject* obj) +{ + NPObject* actualObject = getUnderlyingNPObject(obj); + return actualObject ? actualObject : 0; +} + +NPObject* NPObjectWrapper::NPAllocate(NPP, NPClass*) +{ + return reinterpret_cast<NPObject*>(new NPProxyObject); +} + +void NPObjectWrapper::NPDeallocate(NPObject* obj) +{ + NPProxyObject* proxyObject = reinterpret_cast<NPProxyObject*>(obj); + delete proxyObject->wrapper; + delete proxyObject; +} + +void NPObjectWrapper::NPPInvalidate(NPObject* obj) +{ + NPObject* actualObject = getObjectForCall(obj); + if (actualObject && actualObject->_class->invalidate) + actualObject->_class->invalidate(actualObject); +} + +bool NPObjectWrapper::NPHasMethod(NPObject* obj, NPIdentifier name) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_HasMethod(0, actualObject, name) : false; +} + +bool NPObjectWrapper::NPInvoke(NPObject* obj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_Invoke(0, actualObject, name, args, argCount, result) : false; +} + +bool NPObjectWrapper::NPInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_InvokeDefault(0, actualObject, args, argCount, result) : false; +} + +bool NPObjectWrapper::NPHasProperty(NPObject* obj, NPIdentifier name) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_HasProperty(0, actualObject, name) : false; +} + +bool NPObjectWrapper::NPGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_GetProperty(0, actualObject, name, result) : false; +} + +bool NPObjectWrapper::NPSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* value) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_SetProperty(0, actualObject, name, value) : false; +} + +bool NPObjectWrapper::NPRemoveProperty(NPObject* obj, NPIdentifier name) { + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_RemoveProperty(0, actualObject, name) : false; +} + +bool NPObjectWrapper::NPNEnumerate(NPObject* obj, NPIdentifier** value, uint32_t* count) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_Enumerate(0, actualObject, value, count) : false; +} + +bool NPObjectWrapper::NPNConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + return actualObject ? _NPN_Construct(0, actualObject, args, argCount, result) : false; +} + +bool NPObjectWrapper::NPInvokePrivate(NPP npp, NPObject* obj, bool isDefault, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + NPObject* actualObject = getObjectForCall(obj); + if (!actualObject) + return false; + + if (isDefault) { + return _NPN_InvokeDefault(0, actualObject, args, argCount, result); + } else { + return _NPN_Invoke(0, actualObject, name, args, argCount, result); + } +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/v8/NPObjectWrapper.h b/Source/WebCore/bindings/v8/NPObjectWrapper.h new file mode 100644 index 000000000..6fdf90b4a --- /dev/null +++ b/Source/WebCore/bindings/v8/NPObjectWrapper.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NPObjectWrapper_h +#define NPObjectWrapper_h + +#include "npruntime_impl.h" + +namespace WebCore { + +// This class wraps a NPObject and provides functionality for the wrapped +// object to be cleared out when this object is destroyed. This is to ensure +// that callers trying to access the underlying object don't crash while +// invoking methods on the NPObject. +class NPObjectWrapper { +public: + // Creates an instance of the NPObjectWrapper class and wraps the object + // passed in. + static NPObject* create(NPObject* object); + + // This method should be called to invalidate the underlying NPObject pointer. + void clear(); + + // Returns a pointer to NPObjectWrapper if the object passed in was wrapped by us. + static NPObjectWrapper* getWrapper(NPObject* obj); + + // Returns a pointer to the underlying raw NPObject pointer or 0 if the object + // passed in was not wrapped. + static NPObject* getUnderlyingNPObject(NPObject* obj); + + // NPObject functions implemented by the wrapper. + static NPObject* NPAllocate(NPP, NPClass*); + static void NPDeallocate(NPObject* obj); + static void NPPInvalidate(NPObject *obj); + static bool NPHasMethod(NPObject* obj, NPIdentifier name); + static bool NPInvoke(NPObject* obj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result); + static bool NPInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result); + static bool NPHasProperty(NPObject* obj, NPIdentifier name); + static bool NPGetProperty(NPObject* obj, NPIdentifier name, NPVariant* result); + static bool NPSetProperty(NPObject* obj, NPIdentifier name, const NPVariant *value); + static bool NPRemoveProperty(NPObject* obj, NPIdentifier name); + static bool NPNEnumerate(NPObject* obj, NPIdentifier **value, uint32_t* count); + static bool NPNConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result); + static bool NPInvokePrivate(NPP npp, NPObject* obj,bool isDefault, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result); + +private: + NPObjectWrapper(NPObject* obj); + + // Returns the underlying NPObject if the object passed in was wrapped. Otherwise + // just returns the object passed in. + static NPObject* getObjectForCall(NPObject* obj); + + static NPClass m_npClassWrapper; + // Weak NPObject poointer. + NPObject* m_wrappedNPObject; +}; + +} // namespace WebCore + +#endif // NPObjectWrapper_h + diff --git a/Source/WebCore/bindings/v8/NPV8Object.cpp b/Source/WebCore/bindings/v8/NPV8Object.cpp index 6a76bfff5..a3790da00 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.cpp +++ b/Source/WebCore/bindings/v8/NPV8Object.cpp @@ -31,6 +31,7 @@ #include "PlatformSupport.h" #include "DOMWindow.h" #include "Frame.h" +#include "NPObjectWrapper.h" #include <wtf/OwnArrayPtr.h> #include "PlatformString.h" #include "ScriptSourceCode.h" @@ -75,7 +76,29 @@ static NPObject* allocV8NPObject(NPP, NPClass*) static void freeV8NPObject(NPObject* npObject) { V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - disposeUnderlyingV8Object(npObject); + if (int v8ObjectHash = v8NpObject->v8Object->GetIdentityHash()) { + V8NPObjectMap::iterator iter = staticV8NPObjectMap()->find(v8ObjectHash); + if (iter != staticV8NPObjectMap()->end()) { + V8NPObjectVector& objects = iter->second; + for (size_t index = 0; index < objects.size(); ++index) { + if (objects.at(index) == v8NpObject) { + objects.remove(index); + break; + } + } + if (objects.isEmpty()) + staticV8NPObjectMap()->remove(v8ObjectHash); + } else + ASSERT_NOT_REACHED(); + } else { + ASSERT(!v8::Context::InContext()); + staticV8NPObjectMap()->clear(); + } + +#ifndef NDEBUG + V8GCController::unregisterGlobalHandle(v8NpObject, v8NpObject->v8Object); +#endif + v8NpObject->v8Object.Dispose(); free(v8NpObject); } @@ -156,39 +179,6 @@ NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWind return reinterpret_cast<NPObject*>(v8npObject); } -void disposeUnderlyingV8Object(NPObject* npObject) -{ - ASSERT(npObject->_class == npScriptObjectClass); - V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return; - if (int v8ObjectHash = v8NpObject->v8Object->GetIdentityHash()) { - V8NPObjectMap::iterator iter = staticV8NPObjectMap()->find(v8ObjectHash); - if (iter != staticV8NPObjectMap()->end()) { - V8NPObjectVector& objects = iter->second; - for (size_t index = 0; index < objects.size(); ++index) { - if (objects.at(index) == v8NpObject) { - objects.remove(index); - break; - } - } - if (objects.isEmpty()) - staticV8NPObjectMap()->remove(v8ObjectHash); - } else - ASSERT_NOT_REACHED(); - } else { - ASSERT(!v8::Context::InContext()); - staticV8NPObjectMap()->clear(); - } - -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(v8NpObject, v8NpObject->v8Object); -#endif - v8NpObject->v8Object.Dispose(); - v8NpObject->v8Object.Clear(); - v8NpObject->rootObject = 0; -} - } // namespace WebCore bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) @@ -205,8 +195,6 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV } V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return false; PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(methodName); if (!identifier->isString) @@ -271,8 +259,6 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments, } V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return false; VOID_TO_NPVARIANT(*result); @@ -319,11 +305,13 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (!npObject) return false; - if (npObject->_class != npScriptObjectClass) - return false; - V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); - if (v8NpObject->v8Object.IsEmpty()) - return false; + if (npObject->_class != npScriptObjectClass) { + // Check if the object passed in is wrapped. If yes, then we need to invoke on the underlying object. + NPObject* actualObject = NPObjectWrapper::getUnderlyingNPObject(npObject); + if (!actualObject) + return false; + npObject = actualObject; + } v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -361,8 +349,6 @@ bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NP if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -398,8 +384,6 @@ bool _NPN_SetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, co if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -429,8 +413,6 @@ bool _NPN_RemoveProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName) return false; V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -452,8 +434,6 @@ bool _NPN_HasProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName) if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -478,8 +458,6 @@ bool _NPN_HasMethod(NPP npp, NPObject* npObject, NPIdentifier methodName) if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -524,8 +502,6 @@ bool _NPN_Enumerate(NPP npp, NPObject* npObject, NPIdentifier** identifier, uint if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); @@ -581,8 +557,6 @@ bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uin if (npObject->_class == npScriptObjectClass) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); - if (object->v8Object.IsEmpty()) - return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); diff --git a/Source/WebCore/bindings/v8/NPV8Object.h b/Source/WebCore/bindings/v8/NPV8Object.h index b7e0464a1..f72ba8bd1 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.h +++ b/Source/WebCore/bindings/v8/NPV8Object.h @@ -54,9 +54,8 @@ WrapperTypeInfo* npObjectTypeInfo(); extern NPClass* npScriptObjectClass; -// A V8NPObject is a NPObject which carries additional V8-specific information. -// It is created with npCreateV8ScriptObject() and deallocated via the deallocate -// method in the same way as other NPObjects. +// A V8NPObject is a NPObject which carries additional V8-specific information. It is allocated and deallocated by +// AllocV8NPObject() and FreeV8NPObject() methods. struct V8NPObject { NPObject object; v8::Persistent<v8::Object> v8Object; @@ -75,8 +74,6 @@ NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, DOMWindow*); NPObject* v8ObjectToNPObject(v8::Handle<v8::Object>); -void disposeUnderlyingV8Object(NPObject*); - } // namespace WebCore #endif // NPV8Object_h diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 0a84a1cea..14c050a76 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -45,6 +45,7 @@ #include "FrameLoaderClient.h" #include "Node.h" #include "NotImplemented.h" +#include "NPObjectWrapper.h" #include "npruntime_impl.h" #include "npruntime_priv.h" #include "NPV8Object.h" @@ -105,7 +106,7 @@ ScriptController::ScriptController(Frame* frame) , m_paused(false) , m_proxy(adoptPtr(new V8Proxy(frame))) #if ENABLE(NETSCAPE_PLUGIN_API) - , m_windowScriptNPObject(0) + , m_wrappedWindowScriptNPObject(0) #endif { } @@ -124,14 +125,21 @@ void ScriptController::clearScriptObjects() m_pluginObjects.clear(); #if ENABLE(NETSCAPE_PLUGIN_API) - if (m_windowScriptNPObject) { - // Dispose of the underlying V8 object before releasing our reference - // to it, so that if the plugin fails to release it properly we will - // only leak the NPObject wrapper, not the object, its document, or - // anything else they reference. - disposeUnderlyingV8Object(m_windowScriptNPObject); - _NPN_ReleaseObject(m_windowScriptNPObject); - m_windowScriptNPObject = 0; + if (m_wrappedWindowScriptNPObject) { + NPObjectWrapper* windowScriptObjectWrapper = NPObjectWrapper::getWrapper(m_wrappedWindowScriptNPObject); + ASSERT(windowScriptObjectWrapper); + + NPObject* windowScriptNPObject = NPObjectWrapper::getUnderlyingNPObject(m_wrappedWindowScriptNPObject); + ASSERT(windowScriptNPObject); + // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window + // script object properly. + // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point. + _NPN_DeallocateObject(windowScriptNPObject); + + // Clear out the wrapped window script object pointer held by the wrapper. + windowScriptObjectWrapper->clear(); + _NPN_ReleaseObject(m_wrappedWindowScriptNPObject); + m_wrappedWindowScriptNPObject = 0; } #endif } @@ -379,21 +387,24 @@ static NPObject* createScriptObject(Frame* frame) NPObject* ScriptController::windowScriptNPObject() { - if (m_windowScriptNPObject) - return m_windowScriptNPObject; + if (m_wrappedWindowScriptNPObject) + return m_wrappedWindowScriptNPObject; + NPObject* windowScriptNPObject = 0; if (canExecuteScripts(NotAboutToExecuteScript)) { // JavaScript is enabled, so there is a JavaScript window object. // Return an NPObject bound to the window object. - m_windowScriptNPObject = createScriptObject(m_frame); - _NPN_RegisterObject(m_windowScriptNPObject, 0); + windowScriptNPObject = createScriptObject(m_frame); + _NPN_RegisterObject(windowScriptNPObject, 0); } else { // JavaScript is not enabled, so we cannot bind the NPObject to the // JavaScript window object. Instead, we create an NPObject of a // different class, one which is not bound to a JavaScript object. - m_windowScriptNPObject = createNoScriptObject(); + windowScriptNPObject = createNoScriptObject(); } - return m_windowScriptNPObject; + + m_wrappedWindowScriptNPObject = NPObjectWrapper::create(windowScriptNPObject); + return m_wrappedWindowScriptNPObject; } NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement* plugin) diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index 32cb33513..622e833b5 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -191,9 +191,14 @@ private: // invalidate all sub-objects which are associated with that plugin. // The frame keeps a NPObject reference for each item on the list. PluginObjectMap m_pluginObjects; -#if ENABLE(NETSCAPE_PLUGIN_API) - NPObject* m_windowScriptNPObject; -#endif + // The window script object can get destroyed while there are outstanding + // references to it. Please refer to ScriptController::clearScriptObjects + // for more information as to why this is necessary. To avoid crashes due + // to calls on the destroyed window object, we return a proxy NPObject + // which wraps the underlying window object. The wrapped window object + // pointer in this object is cleared out when the window object is + // destroyed. + NPObject* m_wrappedWindowScriptNPObject; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp index 616107361..de22e29ee 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -2201,6 +2201,7 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValue::release() } SerializedScriptValue::SerializedScriptValue() + : m_externallyAllocatedMemory(0) { } @@ -2252,6 +2253,7 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow, v8::Isolate* isolate) + : m_externallyAllocatedMemory(0) { didThrow = false; Writer writer(isolate); @@ -2298,6 +2300,7 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, } SerializedScriptValue::SerializedScriptValue(const String& wireData) + : m_externallyAllocatedMemory(0) { m_data = wireData.isolatedCopy(); } @@ -2322,4 +2325,23 @@ ScriptValue SerializedScriptValue::deserializeForInspector(ScriptState* scriptSt } #endif +void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() +{ + if (m_externallyAllocatedMemory) + return; + m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(m_externallyAllocatedMemory); +} + +SerializedScriptValue::~SerializedScriptValue() +{ + // If the allocated memory was not registered before, then this class is likely + // used in a context other then Worker's onmessage environment and the presence of + // current v8 context is not guaranteed. Avoid calling v8 then. + if (m_externallyAllocatedMemory) { + ASSERT(v8::Isolate::GetCurrent()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemory); + } +} + } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.h b/Source/WebCore/bindings/v8/SerializedScriptValue.h index 84d122489..cb66384d4 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.h +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.h @@ -45,6 +45,8 @@ typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray; class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> { public: + virtual ~SerializedScriptValue(); + // If a serialization error occurs (e.g., cyclic input value) this // function returns an empty representation, schedules a V8 exception to // be thrown using v8::ThrowException(), and sets |didThrow|. In this case @@ -77,6 +79,12 @@ public: const Vector<String>& blobURLs() const { return m_blobURLs; } + // Informs the V8 about external memory allocated and owned by this object. Large values should contribute + // to GC counters to eventually trigger a GC, otherwise flood of postMessage() can cause OOM. + // Ok to invoke multiple times (only adds memory once). + // The memory registration is revoked automatically in destructor. + void registerMemoryAllocatedWithCurrentScriptContext(); + private: enum StringDataMode { StringValue, @@ -93,6 +101,7 @@ private: String m_data; OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; Vector<String> m_blobURLs; + intptr_t m_externallyAllocatedMemory; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index bdbe4e1c5..056239b4f 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -300,10 +300,6 @@ bool V8DOMWindowShell::initContextIfNeeded() #endif V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); - // FIXME: Remove the following 2 lines when V8 default has changed. - const char es52GlobalsFlag[] = "--es52_globals"; - v8::V8::SetFlagsFromString(es52GlobalsFlag, sizeof(es52GlobalsFlag)); - isV8Initialized = true; } diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index ae039e3b6..e4079cdd1 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -593,6 +593,11 @@ v8::Handle<v8::Value> V8Proxy::setDOMException(int ec, v8::Isolate* isolate) if (ec <= 0) return v8::Handle<v8::Value>(); + if (ec == NATIVE_TYPE_ERR) { + const char* message = 0; + return throwTypeError(message, isolate); + } + ExceptionCodeDescription description(ec); v8::Handle<v8::Value> exception; diff --git a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index 139be5191..1f4848bad 100644 --- a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -122,10 +122,6 @@ void WorkerContextExecutionProxy::initIsolate() v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); - // FIXME: Remove the following 2 lines when V8 default has changed. - const char es52GlobalsFlag[] = "--es52_globals"; - v8::V8::SetFlagsFromString(es52GlobalsFlag, sizeof(es52GlobalsFlag)); - v8::ResourceConstraints resource_constraints; uint32_t here; resource_constraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*)); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index bf7d52217..4bd9778ad 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -69,6 +69,7 @@ #include "Rect.h" #include "RenderTheme.h" #include "RuntimeEnabledFeatures.h" +#include "SVGParserUtilities.h" #include "Settings.h" #include "ShadowValue.h" #include "StylePropertySet.h" @@ -4464,7 +4465,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeRectangle(CSSParserValueL unsigned argumentNumber = 0; CSSParserValue* argument = args->current(); while (argument) { - if (!validUnit(argument, FLength)) + if (!validUnit(argument, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); @@ -4491,7 +4492,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeRectangle(CSSParserValueL } argument = args->next(); if (argument) { - if (argument->unit != CSSParserValue::Operator || argument->iValue != ',') + if (!isComma(argument)) return 0; argument = args->next(); @@ -4517,7 +4518,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeCircle(CSSParserValueList unsigned argumentNumber = 0; CSSParserValue* argument = args->current(); while (argument) { - if (!validUnit(argument, FLength)) + if (!validUnit(argument, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); @@ -4536,7 +4537,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeCircle(CSSParserValueList argument = args->next(); if (argument) { - if (argument->unit != CSSParserValue::Operator || argument->iValue != ',') + if (!isComma(argument)) return 0; argument = args->next(); } @@ -4560,7 +4561,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeEllipse(CSSParserValueLis unsigned argumentNumber = 0; CSSParserValue* argument = args->current(); while (argument) { - if (!validUnit(argument, FLength)) + if (!validUnit(argument, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> length = createPrimitiveNumericValue(argument); @@ -4582,7 +4583,7 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapeEllipse(CSSParserValueLis argument = args->next(); if (argument) { - if (argument->unit != CSSParserValue::Operator || argument->iValue != ',') + if (!isComma(argument)) return 0; argument = args->next(); } @@ -4621,11 +4622,11 @@ PassRefPtr<CSSWrapShape> CSSParser::parseExclusionShapePolygon(CSSParserValueLis CSSParserValue* argumentX = argument; while (argumentX) { - if (!validUnit(argumentX, FLength)) + if (!validUnit(argumentX, FLength | FPercent)) return 0; CSSParserValue* argumentY = args->next(); - if (!argumentY || !validUnit(argumentY, FLength)) + if (!argumentY || !validUnit(argumentY, FLength | FPercent)) return 0; RefPtr<CSSPrimitiveValue> xLength = createPrimitiveNumericValue(argumentX); @@ -8967,8 +8968,29 @@ restartAfterComment: break; } - yylval->number = charactersToDouble(m_tokenStart, m_currentCharacter - m_tokenStart); - +#if ENABLE(SVG) + // Use SVG parser for numbers on SVG presentation attributes. + if (m_context.mode == SVGAttributeMode) { + // We need to take care of units like 'em' or 'ex'. + UChar* currentCharacter = m_currentCharacter; + if (isASCIIAlphaCaselessEqual(*currentCharacter, 'e')) { + ASSERT(currentCharacter - m_tokenStart > 0); + ++currentCharacter; + if (*currentCharacter == '-' || *currentCharacter == '+' || isASCIIDigit(*currentCharacter)) { + ++currentCharacter; + while (isASCIIDigit(*currentCharacter)) + ++currentCharacter; + // Use FLOATTOKEN if the string contains exponents. + dotSeen = true; + m_currentCharacter = currentCharacter; + } + } + if (!parseSVGNumber(m_tokenStart, currentCharacter - m_tokenStart, yylval->number)) + break; + } else +#endif + yylval->number = charactersToDouble(m_tokenStart, m_currentCharacter - m_tokenStart); + // Type of the function. if (isIdentifierStart()) { UChar* type = m_currentCharacter; diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index a370112e0..97e0b63b1 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -465,12 +465,12 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) m_value.ident = CSSValueRatingLevelIndicator; break; case ProgressBarPart: -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) m_value.ident = CSSValueProgressBar; #endif break; case ProgressBarValuePart: -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) m_value.ident = CSSValueProgressBarValue; #endif break; diff --git a/Source/WebCore/css/SelectorChecker.cpp b/Source/WebCore/css/SelectorChecker.cpp index d959f6715..66dc5874b 100644 --- a/Source/WebCore/css/SelectorChecker.cpp +++ b/Source/WebCore/css/SelectorChecker.cpp @@ -1103,7 +1103,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P { if (!element) break; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) if (element->hasTagName(progressTag)) { HTMLProgressElement* progress = static_cast<HTMLProgressElement*>(element); if (progress && !progress->isDeterminate()) diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index b4cbd8a21..4ee464a4c 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -1420,7 +1420,7 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const return false; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) if (element->hasTagName(progressTag)) { if (!m_element->hasTagName(progressTag)) return false; @@ -1801,7 +1801,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(const RenderStyle* eleme loadPendingResources(); // Add all the animating properties to the keyframe. - if (StylePropertySet* styleDeclaration = keyframe->properties()) { + if (const StylePropertySet* styleDeclaration = keyframe->properties()) { unsigned propertyCount = styleDeclaration->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { CSSPropertyID property = styleDeclaration->propertyAt(i).id(); @@ -2607,17 +2607,17 @@ void RuleSet::addRegionRule(StyleRuleRegion* regionRule, bool hasDocumentSecurit m_regionSelectorsAndRuleSets.append(RuleSetSelectorPair(regionRule->selectorList().first(), regionRuleSet.release())); } -void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* styleSelector, const ContainerNode* scope) +void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver, const ContainerNode* scope) { ASSERT(sheet); const Vector<RefPtr<StyleRuleImport> >& importRules = sheet->importRules(); for (unsigned i = 0; i < importRules.size(); ++i) { StyleRuleImport* importRule = importRules[i].get(); - if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), styleSelector))) - addRulesFromSheet(importRule->styleSheet(), medium, styleSelector, scope); + if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), resolver))) + addRulesFromSheet(importRule->styleSheet(), medium, resolver, scope); } - bool hasDocumentSecurityOrigin = styleSelector && styleSelector->document()->securityOrigin()->canRequest(sheet->baseURL()); + bool hasDocumentSecurityOrigin = resolver && resolver->document()->securityOrigin()->canRequest(sheet->baseURL()); const Vector<RefPtr<StyleRuleBase> >& rules = sheet->childRules(); for (unsigned i = 0; i < rules.size(); ++i) { @@ -2631,7 +2631,7 @@ void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu else if (rule->isMediaRule()) { StyleRuleMedia* mediaRule = static_cast<StyleRuleMedia*>(rule); - if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), styleSelector))) { + if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), resolver))) { // Traverse child elements of the @media rule. const Vector<RefPtr<StyleRuleBase> >& childRules = mediaRule->childRules(); for (unsigned j = 0; j < childRules.size(); ++j) { @@ -2640,39 +2640,39 @@ void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu addStyleRule(static_cast<StyleRule*>(childRule), hasDocumentSecurityOrigin, !scope); else if (childRule->isPageRule()) addPageRule(static_cast<StyleRulePage*>(childRule)); - else if (childRule->isFontFaceRule() && styleSelector) { + else if (childRule->isFontFaceRule() && resolver) { // Add this font face to our set. // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment. if (scope) continue; const StyleRuleFontFace* fontFaceRule = static_cast<StyleRuleFontFace*>(childRule); - styleSelector->fontSelector()->addFontFaceRule(fontFaceRule); - styleSelector->invalidateMatchedPropertiesCache(); - } else if (childRule->isKeyframesRule() && styleSelector) { + resolver->fontSelector()->addFontFaceRule(fontFaceRule); + resolver->invalidateMatchedPropertiesCache(); + } else if (childRule->isKeyframesRule() && resolver) { // Add this keyframe rule to our set. // FIXME(BUG 72462): We don't add @keyframe rules of scoped style sheets for the moment. if (scope) continue; - styleSelector->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(childRule)); + resolver->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(childRule)); } } // for rules } // if rules - } else if (rule->isFontFaceRule() && styleSelector) { + } else if (rule->isFontFaceRule() && resolver) { // Add this font face to our set. // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment. if (scope) continue; const StyleRuleFontFace* fontFaceRule = static_cast<StyleRuleFontFace*>(rule); - styleSelector->fontSelector()->addFontFaceRule(fontFaceRule); - styleSelector->invalidateMatchedPropertiesCache(); - } else if (rule->isKeyframesRule() && styleSelector) { + resolver->fontSelector()->addFontFaceRule(fontFaceRule); + resolver->invalidateMatchedPropertiesCache(); + } else if (rule->isKeyframesRule() && resolver) { // FIXME (BUG 72462): We don't add @keyframe rules of scoped style sheets for the moment. if (scope) continue; - styleSelector->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(rule)); + resolver->addKeyframeStyle(static_cast<StyleRuleKeyframes*>(rule)); } #if ENABLE(CSS_REGIONS) - else if (rule->isRegionRule() && styleSelector) { + else if (rule->isRegionRule() && resolver) { // FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment. if (scope) continue; @@ -4560,7 +4560,9 @@ float StyleResolver::getComputedSizeFromSpecifiedSize(Document* document, float if (useSmartMinimumForFontSize && zoomedSize < minLogicalSize && (specifiedSize >= minLogicalSize || !isAbsoluteSize)) zoomedSize = minLogicalSize; - return zoomedSize; + // Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various + // platforms (I'm looking at you, Windows.) + return min(1000000.0f, zoomedSize); } const int fontSizeTableMax = 16; diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp index 7692086d0..0577b46f0 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp @@ -31,6 +31,13 @@ #include "WebKitCSSKeyframesRule.h" namespace WebCore { + +StylePropertySet* StyleKeyframe::mutableProperties() +{ + if (!m_properties->isMutable()) + m_properties = m_properties->copy(); + return m_properties.get(); +} void StyleKeyframe::setProperties(PassRefPtr<StylePropertySet> properties) { @@ -94,7 +101,7 @@ WebKitCSSKeyframeRule::~WebKitCSSKeyframeRule() CSSStyleDeclaration* WebKitCSSKeyframeRule::style() const { if (!m_propertiesCSSOMWrapper) - m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->properties(), const_cast<WebKitCSSKeyframeRule*>(this)); + m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->mutableProperties(), const_cast<WebKitCSSKeyframeRule*>(this)); return m_propertiesCSSOMWrapper.get(); } diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.h b/Source/WebCore/css/WebKitCSSKeyframeRule.h index cfa2001e2..444b64820 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.h +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.h @@ -49,7 +49,8 @@ public: void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } - StylePropertySet* properties() const { return m_properties.get(); } + const StylePropertySet* properties() const { return m_properties.get(); } + StylePropertySet* mutableProperties(); void setProperties(PassRefPtr<StylePropertySet>); String cssText() const; diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index 5aab06fc7..9f61bafa2 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -140,6 +140,19 @@ map { display: inline } +#if defined(ENABLE_DIALOG_ELEMENT) && ENABLE_DIALOG_ELEMENT +dialog:not([open]) { display: none; } +dialog { + position: absolute; + left: 0; right: 0; + margin: auto; + border: solid; + padding: 1em; + background: white; + color: black; +} +#endif + /* heading elements */ h1 { @@ -452,7 +465,7 @@ input[type="search"]::-webkit-search-results-button { -webkit-box-flex: 0; } -#if defined(ENABLE_DATALIST) && ENABLE_DATALIST +#if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT datalist { display: none; } @@ -645,7 +658,7 @@ input[type="color"]::-webkit-color-swatch { -webkit-box-flex: 1; } -#if defined(ENABLE_DATALIST) && ENABLE_DATALIST +#if defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT input[type="color"][list] { -webkit-appearance: menulist; @@ -662,7 +675,7 @@ input[type="color"][list]::-webkit-color-swatch { border-color: #000000; } -#endif // defined(ENABLE_DATALIST) && ENABLE_DATALIST +#endif // defined(ENABLE_DATALIST_ELEMENT) && ENABLE_DATALIST_ELEMENT #endif // defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR @@ -784,7 +797,7 @@ output { height: 16px; } -#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG +#if defined(ENABLE_METER_ELEMENT) && ENABLE_METER_ELEMENT /* meter */ meter { @@ -822,7 +835,7 @@ meter::-webkit-meter-even-less-good-value { } #endif -#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG +#if defined(ENABLE_PROGRESS_ELEMENT) && ENABLE_PROGRESS_ELEMENT /* progress */ progress { diff --git a/Source/WebCore/css/mediaControlsChromium.css b/Source/WebCore/css/mediaControlsChromium.css index 6290d3dc3..3a9f1455a 100644 --- a/Source/WebCore/css/mediaControlsChromium.css +++ b/Source/WebCore/css/mediaControlsChromium.css @@ -79,7 +79,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { -webkit-appearance: media-mute-button; - display: inline; + display: -webkit-box; border: none; box-sizing: border-box; width: 35px; @@ -91,7 +91,7 @@ audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-bu audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { -webkit-appearance: media-play-button; - display: inline; + display: -webkit-box; border: none; box-sizing: border-box; width: 30px; @@ -118,6 +118,7 @@ audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-contr font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; + font-style: normal; color: white; letter-spacing: normal; @@ -179,7 +180,7 @@ input[type="range"]::-webkit-media-slider-thumb { audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { -webkit-appearance: media-enter-fullscreen-button; - display: inline; + display: -webkit-box; border: none; box-sizing: border-box; width: 30px; diff --git a/Source/WebCore/dom/ChildNodeList.cpp b/Source/WebCore/dom/ChildNodeList.cpp index 86fab6f30..fe55892b2 100644 --- a/Source/WebCore/dom/ChildNodeList.cpp +++ b/Source/WebCore/dom/ChildNodeList.cpp @@ -28,7 +28,7 @@ namespace WebCore { ChildNodeList::ChildNodeList(PassRefPtr<Node> node) - : DynamicNodeList(node, NodeListIsRootedAtNode, DoNotInvalidateOnAttributeChanges) + : DynamicNodeList(node, ChildNodeListType, NodeListIsRootedAtNode, DoNotInvalidateOnAttributeChanges) { } @@ -37,73 +37,9 @@ ChildNodeList::~ChildNodeList() ownerNode()->removeCachedChildNodeList(); } -unsigned ChildNodeList::length() const -{ - if (isLengthCacheValid()) - return cachedLength(); - - unsigned len = 0; - for (Node* n = rootNode()->firstChild(); n; n = n->nextSibling()) - len++; - - setLengthCache(len); - - return len; -} - -Node* ChildNodeList::item(unsigned index) const -{ - unsigned int pos = 0; - Node* n = rootNode()->firstChild(); - - if (isItemCacheValid()) { - if (index == cachedItemOffset()) - return cachedItem(); - - int diff = index - cachedItemOffset(); - unsigned dist = abs(diff); - if (dist < index) { - n = cachedItem(); - pos = cachedItemOffset(); - } - } - - if (isLengthCacheValid()) { - if (index >= cachedLength()) - return 0; - - int diff = index - pos; - unsigned dist = abs(diff); - if (dist > cachedLength() - 1 - index) { - n = rootNode()->lastChild(); - pos = cachedLength() - 1; - } - } - - if (pos <= index) { - while (n && pos < index) { - n = n->nextSibling(); - ++pos; - } - } else { - while (n && pos > index) { - n = n->previousSibling(); - --pos; - } - } - - if (n) { - setItemCache(n, pos); - return n; - } - - return 0; -} - bool ChildNodeList::nodeMatches(Element* testNode) const { - // Note: Due to the overrides of the length and item functions above, - // this function will be called only by DynamicNodeList::itemWithName, + // This function will be called only by DynamicNodeList::itemWithName, // for an element that was located with getElementById. return testNode->parentNode() == rootNode(); } diff --git a/Source/WebCore/dom/ChildNodeList.h b/Source/WebCore/dom/ChildNodeList.h index df3d67bfa..243e897d3 100644 --- a/Source/WebCore/dom/ChildNodeList.h +++ b/Source/WebCore/dom/ChildNodeList.h @@ -38,9 +38,6 @@ namespace WebCore { virtual ~ChildNodeList(); - virtual unsigned length() const; - virtual Node* item(unsigned index) const; - protected: ChildNodeList(PassRefPtr<Node> rootNode); diff --git a/Source/WebCore/dom/ClassNodeList.cpp b/Source/WebCore/dom/ClassNodeList.cpp index 14db32478..c0ce6d2e0 100644 --- a/Source/WebCore/dom/ClassNodeList.cpp +++ b/Source/WebCore/dom/ClassNodeList.cpp @@ -37,7 +37,7 @@ namespace WebCore { ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames) - : DynamicSubtreeNodeList(rootNode, InvalidateOnClassAttrChange) + : DynamicSubtreeNodeList(rootNode, ClassNodeListType, InvalidateOnClassAttrChange) , m_classNames(classNames, document()->inQuirksMode()) , m_originalClassNames(classNames) { diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index fc8e1b537..3449ff0ec 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -421,7 +421,7 @@ uint64_t Document::s_globalTreeVersion = 0; Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) : ContainerNode(0, CreateDocument) - , TreeScope(this) + , TreeScope(this, this) , m_guardRefCount(0) , m_contextFeatures(ContextFeatures::defaultSwitch()) , m_compatibilityMode(NoQuirksMode) @@ -493,7 +493,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) , m_didDispatchViewportPropertiesChanged(false) #endif { - m_document = this; + setTreeScope(this); m_pageGroupUserSheetCacheValid = false; @@ -585,6 +585,19 @@ static void histogramMutationEventUsage(const unsigned short& listenerTypes) HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARACTERDATAMODIFIED_LISTENER), 2); } +#if ENABLE(FULLSCREEN_API) +static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const HTMLFrameOwnerElement* owner) +{ + if (!owner) + return true; + do { + if (!owner->hasAttribute(attribute)) + return false; + } while ((owner = owner->document()->ownerElement())); + return true; +} +#endif + Document::~Document() { ASSERT(!renderer()); @@ -663,7 +676,7 @@ Document::~Document() for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_collections); i++) ASSERT(!m_collections[i]); - m_document = 0; + setTreeScope(0); InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); } @@ -1337,13 +1350,14 @@ void Document::setContent(const String& content) String Document::suggestedMIMEType() const { - if (m_document->isXHTMLDocument()) + Document* doc = document(); + if (doc->isXHTMLDocument()) return "application/xhtml+xml"; - if (m_document->isSVGDocument()) + if (doc->isSVGDocument()) return "image/svg+xml"; - if (m_document->xmlStandalone()) + if (doc->xmlStandalone()) return "text/xml"; - if (m_document->isHTMLDocument()) + if (doc->isHTMLDocument()) return "text/html"; if (DocumentLoader* documentLoader = loader()) @@ -3868,7 +3882,7 @@ void Document::setCSSTarget(Element* n) void Document::registerNodeListCache(DynamicNodeListCacheBase* list) { - if (list->type() != InvalidCollectionType) + if (list->type() != NodeListCollectionType) m_nodeListCounts[InvalidateOnIdNameAttrChange]++; m_nodeListCounts[list->invalidationType()]++; if (list->isRootedAtDocument()) @@ -3877,7 +3891,7 @@ void Document::registerNodeListCache(DynamicNodeListCacheBase* list) void Document::unregisterNodeListCache(DynamicNodeListCacheBase* list) { - if (list->type() != InvalidCollectionType) + if (list->type() != NodeListCollectionType) m_nodeListCounts[InvalidateOnIdNameAttrChange]--; m_nodeListCounts[list->invalidationType()]--; if (list->isRootedAtDocument()) { @@ -3886,31 +3900,6 @@ void Document::unregisterNodeListCache(DynamicNodeListCacheBase* list) } } -bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const -{ - if (attrName) { - for (int type = DoNotInvalidateOnAttributeChanges + 1; type < numNodeListInvalidationTypes; type++) { - if (m_nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), *attrName)) - return true; - } - return false; - } - - for (int type = 0; type < numNodeListInvalidationTypes; type++) { - if (m_nodeListCounts[type]) - return true; - } - - return false; -} - -void Document::invalidateNodeListCaches(const QualifiedName* attrName) -{ - HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end(); - for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) - (*it)->invalidateCache(attrName); -} - void Document::attachNodeIterator(NodeIterator* ni) { m_nodeIterators.add(ni); @@ -5365,15 +5354,7 @@ MediaCanStartListener* Document::takeAnyMediaCanStartListener() bool Document::fullScreenIsAllowedForElement(Element* element) const { ASSERT(element); - while (HTMLFrameOwnerElement* ownerElement = element->document()->ownerElement()) { - if (!ownerElement->isFrameElementBase()) - continue; - - if (!static_cast<HTMLFrameElementBase*>(ownerElement)->allowFullScreen()) - return false; - element = ownerElement; - } - return true; + return isAttributeOnAllOwners(webkitallowfullscreenAttr, element->document()->ownerElement()); } void Document::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType) @@ -5582,19 +5563,7 @@ bool Document::webkitFullscreenEnabled() const // browsing context's documents have their fullscreen enabled flag set, or false otherwise. // Top-level browsing contexts are implied to have their allowFullScreen attribute set. - HTMLFrameOwnerElement* owner = ownerElement(); - if (!owner) - return true; - - do { - if (!owner->isFrameElementBase()) - continue; - - if (!static_cast<HTMLFrameElementBase*>(owner)->allowFullScreen()) - return false; - } while ((owner = owner->document()->ownerElement())); - - return true; + return isAttributeOnAllOwners(webkitallowfullscreenAttr, ownerElement()); } void Document::webkitWillEnterFullScreenForElement(Element* element) diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index b63618492..2014dcd84 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -1539,20 +1539,48 @@ private: // Put these methods here, because they require the Document definition, but we really want to inline them. +inline TreeScope* Node::treeScope() const +{ + return m_treeScope == TreeScope::nullInstance() ? 0 : m_treeScope; +} + +inline void Node::setTreeScope(TreeScope* scope) +{ + m_treeScope = scope ? scope : TreeScope::nullInstance(); + setFlag(!m_treeScope->isDocumentScope(), InShadowTree); +} + +inline Document* Node::documentInternal() const +{ + if (getFlag(InShadowTree)) + return m_treeScope->rootDocument(); + return static_cast<Document*>(m_treeScope); +} + +inline Document* Node::document() const +{ + Document* document = documentInternal(); + // FIXME: below ASSERT is useful, but prevents the use of document() in the constructor or destructor + // due to the virtual function call to nodeType(). + ASSERT(document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); + return document; +} + inline bool Node::isDocumentNode() const { - return this == m_document; + return this == documentInternal(); } inline Node::Node(Document* document, ConstructionType type) : m_nodeFlags(type) - , m_document(document) + , m_treeScope(0) , m_previous(0) , m_next(0) , m_renderer(0) { if (document) document->guardRef(); + setTreeScope(document); #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) trackForDebugging(); #endif diff --git a/Source/WebCore/dom/DynamicNodeList.cpp b/Source/WebCore/dom/DynamicNodeList.cpp index 25a4504e3..96e0082cf 100644 --- a/Source/WebCore/dom/DynamicNodeList.cpp +++ b/Source/WebCore/dom/DynamicNodeList.cpp @@ -36,7 +36,7 @@ void DynamicNodeListCacheBase::invalidateCache() const m_isLengthCacheValid = false; m_isItemCacheValid = false; m_isNameCacheValid = false; - if (type() == InvalidCollectionType) + if (type() == NodeListCollectionType) return; const HTMLCollectionCacheBase* cacheBase = static_cast<const HTMLCollectionCacheBase*>(this); @@ -51,72 +51,14 @@ void DynamicNodeListCacheBase::invalidateCache() const #endif } -unsigned DynamicSubtreeNodeList::length() const +unsigned DynamicNodeList::length() const { - if (isLengthCacheValid()) - return cachedLength(); - - unsigned length = 0; - Node* rootNode = this->rootNode(); - - for (Node* n = rootNode->firstChild(); n; n = n->traverseNextNode(rootNode)) - length += n->isElementNode() && nodeMatches(static_cast<Element*>(n)); - - setLengthCache(length); - - return length; + return lengthCommon(); } -Node* DynamicSubtreeNodeList::itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const +Node* DynamicNodeList::item(unsigned offset) const { - ASSERT(remainingOffset >= 0); - Node* rootNode = this->rootNode(); - for (Node* n = start; n; n = n->traverseNextNode(rootNode)) { - if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) { - if (!remainingOffset) { - setItemCache(n, offset); - return n; - } - --remainingOffset; - } - } - - return 0; // no matching node in this subtree -} - -Node* DynamicSubtreeNodeList::itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const -{ - ASSERT(remainingOffset < 0); - Node* rootNode = this->rootNode(); - for (Node* n = start; n; n = n->traversePreviousNode(rootNode)) { - if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) { - if (!remainingOffset) { - setItemCache(n, offset); - return n; - } - ++remainingOffset; - } - } - - return 0; // no matching node in this subtree -} - -Node* DynamicSubtreeNodeList::item(unsigned offset) const -{ - int remainingOffset = offset; - Node* start = rootNode()->firstChild(); - if (isItemCacheValid()) { - if (offset == cachedItemOffset()) - return cachedItem(); - if (offset > cachedItemOffset() || cachedItemOffset() - offset < offset) { - start = cachedItem(); - remainingOffset -= cachedItemOffset(); - } - } - - if (remainingOffset < 0) - return itemBackwardsFromCurrent(start, offset, remainingOffset); - return itemForwardsFromCurrent(start, offset, remainingOffset); + return itemCommon(offset); } Node* DynamicNodeList::itemWithName(const AtomicString& elementId) const diff --git a/Source/WebCore/dom/DynamicNodeList.h b/Source/WebCore/dom/DynamicNodeList.h index c1c05f4c5..a5cd269b1 100644 --- a/Source/WebCore/dom/DynamicNodeList.h +++ b/Source/WebCore/dom/DynamicNodeList.h @@ -43,31 +43,34 @@ enum NodeListRootType { class DynamicNodeListCacheBase { public: - enum ItemBeforeSupportType { - DoNotSupportItemBefore, - SupportItemBefore, + enum ItemAfterOverrideType { + OverridesItemAfter, + DoesNotOverrideItemAfter, }; - DynamicNodeListCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, - CollectionType collectionType = InvalidCollectionType, ItemBeforeSupportType itemBeforeSupportType = DoNotSupportItemBefore) - : m_cachedItem(0) + DynamicNodeListCacheBase(Node* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType, + bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType) + : m_ownerNode(ownerNode) + , m_cachedItem(0) , m_isLengthCacheValid(false) , m_isItemCacheValid(false) , m_rootedAtDocument(rootType == NodeListIsRootedAtDocument) , m_invalidationType(invalidationType) + , m_shouldOnlyIncludeDirectChildren(shouldOnlyIncludeDirectChildren) , m_isNameCacheValid(false) , m_collectionType(collectionType) - , m_supportsItemBefore(itemBeforeSupportType == SupportItemBefore) + , m_overridesItemAfter(itemAfterOverrideType == OverridesItemAfter) { ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType)); ASSERT(m_collectionType == static_cast<unsigned>(collectionType)); + ASSERT(!m_overridesItemAfter || m_collectionType != NodeListCollectionType); } public: ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootedAtDocument; } ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); } ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); } - + Node* ownerNode() const { return m_ownerNode.get(); } ALWAYS_INLINE void invalidateCache(const QualifiedName* attrName) const { if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName)) @@ -78,11 +81,19 @@ public: static bool shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType, const QualifiedName&); protected: - bool supportsItemBefore() const { return m_supportsItemBefore; } + Document* document() const { return m_ownerNode->document(); } + Node* rootNode() const + { + if (isRootedAtDocument() && m_ownerNode->inDocument()) + return m_ownerNode->document(); + return m_ownerNode.get(); + } + bool overridesItemAfter() const { return m_overridesItemAfter; } ALWAYS_INLINE bool isItemCacheValid() const { return m_isItemCacheValid; } ALWAYS_INLINE Node* cachedItem() const { return m_cachedItem; } ALWAYS_INLINE unsigned cachedItemOffset() const { return m_cachedItemOffset; } + unsigned cachedElementsArrayOffset() const; ALWAYS_INLINE bool isLengthCacheValid() const { return m_isLengthCacheValid; } ALWAYS_INLINE unsigned cachedLength() const { return m_cachedLength; } @@ -98,11 +109,25 @@ protected: m_cachedItemOffset = offset; m_isItemCacheValid = true; } + void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const; bool hasNameCache() const { return m_isNameCacheValid; } void setHasNameCache() const { m_isNameCacheValid = true; } + unsigned lengthCommon() const; + Node* itemCommon(unsigned offset) const; + Node* itemBeforeOrAfterCachedItem(unsigned offset) const; + Node* itemAfter(unsigned&, Node* previousItem) const; + private: + bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDirectChildren; } + bool isLastItemCloserThanLastOrCachedItem(unsigned offset) const; + bool isFirstItemCloserThanCachedItem(unsigned offset) const; + template <bool forward> Node* iterateForNextNode(Node* current) const; + template<bool forward> Node* itemBeforeOrAfter(Node* previousItem) const; + Node* itemBefore(Node* previousItem) const; + + RefPtr<Node> m_ownerNode; mutable Node* m_cachedItem; mutable unsigned m_cachedLength; mutable unsigned m_cachedItemOffset; @@ -110,11 +135,12 @@ private: mutable unsigned m_isItemCacheValid : 1; const unsigned m_rootedAtDocument : 1; const unsigned m_invalidationType : 4; + const unsigned m_shouldOnlyIncludeDirectChildren : 1; // From HTMLCollection mutable unsigned m_isNameCacheValid : 1; const unsigned m_collectionType : 5; - const unsigned m_supportsItemBefore : 1; + const unsigned m_overridesItemAfter : 1; }; ALWAYS_INLINE bool DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType type, const QualifiedName& attrName) @@ -156,33 +182,21 @@ public: LabelsNodeListType, MicroDataItemListType, }; - DynamicNodeList(PassRefPtr<Node> ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType) - : DynamicNodeListCacheBase(rootType, invalidationType) - , m_ownerNode(ownerNode) + DynamicNodeList(PassRefPtr<Node> ownerNode, NodeListType type, NodeListRootType rootType, NodeListInvalidationType invalidationType) + : DynamicNodeListCacheBase(ownerNode.get(), rootType, invalidationType, type == ChildNodeListType, NodeListCollectionType, DoesNotOverrideItemAfter) { } virtual ~DynamicNodeList() { } // DOM methods & attributes for NodeList - virtual unsigned length() const = 0; - virtual Node* item(unsigned index) const = 0; + virtual unsigned length() const OVERRIDE; + virtual Node* item(unsigned offset) const OVERRIDE; virtual Node* itemWithName(const AtomicString&) const; // Other methods (not part of DOM) - Node* ownerNode() const { return m_ownerNode.get(); } - -protected: - Node* rootNode() const - { - if (isRootedAtDocument() && m_ownerNode->inDocument()) - return m_ownerNode->document(); - return m_ownerNode.get(); - } - Document* document() const { return m_ownerNode->document(); } virtual bool nodeMatches(Element*) const = 0; private: virtual bool isDynamicNodeList() const OVERRIDE { return true; } - RefPtr<Node> m_ownerNode; }; class DynamicSubtreeNodeList : public DynamicNodeList { @@ -191,12 +205,10 @@ public: { document()->unregisterNodeListCache(this); } - virtual unsigned length() const OVERRIDE; - virtual Node* item(unsigned index) const OVERRIDE; protected: - DynamicSubtreeNodeList(PassRefPtr<Node> node, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) - : DynamicNodeList(node, rootType, invalidationType) + DynamicSubtreeNodeList(PassRefPtr<Node> node, NodeListType type, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) + : DynamicNodeList(node, type, rootType, invalidationType) { document()->registerNodeListCache(this); } diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 42b468f98..3499447ed 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -1185,6 +1185,18 @@ ElementShadow* Element::ensureShadow() return elementRareData()->m_shadow.get(); } +ShadowRoot* Element::userAgentShadowRoot() const +{ + if (ElementShadow* elementShadow = shadow()) { + if (ShadowRoot* shadowRoot = elementShadow->oldestShadowRoot()) { + ASSERT(shadowRoot->type() == ShadowRoot::UserAgentShadowRoot); + return shadowRoot; + } + } + + return 0; +} + ShadowRoot* Element::ensureShadowRoot() { if (ElementShadow* shadow = this->shadow()) diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 80a1b3cab..b5b22512f 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -270,6 +270,8 @@ public: ElementShadow* ensureShadow(); virtual void willAddAuthorShadowRoot() { } + ShadowRoot* userAgentShadowRoot() const; + // FIXME: Remove Element::ensureShadowRoot // https://bugs.webkit.org/show_bug.cgi?id=77608 ShadowRoot* ensureShadowRoot(); diff --git a/Source/WebCore/dom/EventDispatcher.cpp b/Source/WebCore/dom/EventDispatcher.cpp index 62541d8b5..a75aab0e3 100644 --- a/Source/WebCore/dom/EventDispatcher.cpp +++ b/Source/WebCore/dom/EventDispatcher.cpp @@ -228,7 +228,7 @@ void EventDispatcher::ensureEventAncestors(Event* event) last = node; if (!node->isShadowRoot()) continue; - if (determineDispatchBehavior(event, toShadowRoot(node)) == StayInsideShadowDOM) + if (determineDispatchBehavior(event, toShadowRoot(node), targetStack.last()) == StayInsideShadowDOM) return; if (!isSVGElement) { ASSERT(!targetStack.isEmpty()); @@ -347,7 +347,12 @@ const EventContext* EventDispatcher::topEventContext() return m_ancestors.isEmpty() ? 0 : &m_ancestors.last(); } -EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot) +static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target) +{ + return target->toNode() && target->toNode()->treeScope()->rootNode() == shadowRoot; +} + +EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target) { #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO) // Video-only full screen is a mode where we use the shadow DOM as an implementation @@ -366,13 +371,14 @@ EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, S // Changing this breaks existing sites. // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. const AtomicString eventType = event->type(); - if (eventType == eventNames().abortEvent + if (inTheSameScope(shadowRoot, target) + && (eventType == eventNames().abortEvent || eventType == eventNames().changeEvent || eventType == eventNames().resetEvent || eventType == eventNames().resizeEvent || eventType == eventNames().scrollEvent || eventType == eventNames().selectEvent - || eventType == eventNames().selectstartEvent) + || eventType == eventNames().selectstartEvent)) return StayInsideShadowDOM; return RetargetEvent; diff --git a/Source/WebCore/dom/EventDispatcher.h b/Source/WebCore/dom/EventDispatcher.h index a11301e5c..34c55e4db 100644 --- a/Source/WebCore/dom/EventDispatcher.h +++ b/Source/WebCore/dom/EventDispatcher.h @@ -75,7 +75,7 @@ public: private: EventDispatcher(Node*); - EventDispatchBehavior determineDispatchBehavior(Event*, ShadowRoot*); + EventDispatchBehavior determineDispatchBehavior(Event*, ShadowRoot*, EventTarget*); void ensureEventAncestors(Event*); const EventContext* topEventContext(); diff --git a/Source/WebCore/dom/ExceptionCode.h b/Source/WebCore/dom/ExceptionCode.h index 31d668045..51f8dc2d3 100644 --- a/Source/WebCore/dom/ExceptionCode.h +++ b/Source/WebCore/dom/ExceptionCode.h @@ -63,7 +63,10 @@ namespace WebCore { QUOTA_EXCEEDED_ERR = 22, TIMEOUT_ERR = 23, INVALID_NODE_TYPE_ERR = 24, - DATA_CLONE_ERR = 25 + DATA_CLONE_ERR = 25, + + // Converted to a native TypeError by the script binding layer: + NATIVE_TYPE_ERR = 99 }; } // namespace WebCore diff --git a/Source/WebCore/dom/MessageEvent.cpp b/Source/WebCore/dom/MessageEvent.cpp index 1252d2c64..24b52dd12 100644 --- a/Source/WebCore/dom/MessageEvent.cpp +++ b/Source/WebCore/dom/MessageEvent.cpp @@ -73,6 +73,10 @@ MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& , m_source(source) , m_ports(ports) { +#if USE(V8) + if (m_dataAsSerializedScriptValue) + m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptContext(); +#endif } MessageEvent::MessageEvent(const String& data) @@ -134,6 +138,11 @@ void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo m_lastEventId = lastEventId; m_source = source; m_ports = ports; + +#if USE(V8) + if (m_dataAsSerializedScriptValue) + m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptContext(); +#endif } // FIXME: Remove this when we have custom ObjC binding support. diff --git a/Source/WebCore/dom/MicroDataItemList.cpp b/Source/WebCore/dom/MicroDataItemList.cpp index 7b4863537..6fc53936e 100644 --- a/Source/WebCore/dom/MicroDataItemList.cpp +++ b/Source/WebCore/dom/MicroDataItemList.cpp @@ -45,7 +45,7 @@ const String& MicroDataItemList::undefinedItemType() } MicroDataItemList::MicroDataItemList(PassRefPtr<Node> rootNode, const String& typeNames) - : DynamicSubtreeNodeList(rootNode, InvalidateOnItemAttrChange) + : DynamicSubtreeNodeList(rootNode, MicroDataItemListType, InvalidateOnItemAttrChange) , m_typeNames(typeNames, document()->inQuirksMode()) , m_originalTypeNames(typeNames) { diff --git a/Source/WebCore/dom/NameNodeList.cpp b/Source/WebCore/dom/NameNodeList.cpp index 34d5a534c..0c9e08928 100644 --- a/Source/WebCore/dom/NameNodeList.cpp +++ b/Source/WebCore/dom/NameNodeList.cpp @@ -33,7 +33,7 @@ namespace WebCore { using namespace HTMLNames; NameNodeList::NameNodeList(PassRefPtr<Node> rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode, InvalidateOnNameAttrChange) + : DynamicSubtreeNodeList(rootNode, NameNodeListType, InvalidateOnNameAttrChange) , m_name(name) { } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 8fd6d5c4f..6b622c764 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -406,7 +406,7 @@ Node::~Node() if (renderer()) detach(); - Document* doc = m_document; + Document* doc = documentInternal(); if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists()) doc->axObjectCache()->removeNodeForUse(this); @@ -421,41 +421,6 @@ Node::~Node() InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); } -void Node::setDocument(Document* document) -{ - ASSERT(!inDocument() || m_document == document); - if (inDocument() || m_document == document) - return; - - m_document = document; -} - -NodeRareData* Node::setTreeScope(TreeScope* scope) -{ - if (!scope) { - if (hasRareData()) { - NodeRareData* data = rareData(); - data->setTreeScope(0); - return data; - } - - return 0; - } - - NodeRareData* data = ensureRareData(); - data->setTreeScope(scope); - return data; -} - -TreeScope* Node::treeScope() const -{ - // FIXME: Using m_document directly is not good -> see comment with document() in the header file. - if (!hasRareData()) - return m_document; - TreeScope* scope = rareData()->treeScope(); - return scope ? scope : m_document; -} - NodeRareData* Node::rareData() const { ASSERT(hasRareData()); @@ -962,6 +927,40 @@ unsigned Node::nodeIndex() const return count; } +template<unsigned type> +bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName) +{ + if (nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName)) + return true; + return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName); +} + +template<> +bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&) +{ + return false; +} + +bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const +{ + if (attrName) + return shouldInvalidateNodeListCachesForAttr<DoNotInvalidateOnAttributeChanges + 1>(m_nodeListCounts, *attrName); + + for (int type = 0; type < numNodeListInvalidationTypes; type++) { + if (m_nodeListCounts[type]) + return true; + } + + return false; +} + +void Document::invalidateNodeListCaches(const QualifiedName* attrName) +{ + HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end(); + for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) + (*it)->invalidateCache(attrName); +} + void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement) { if (hasRareData() && (!attrName || isAttributeNode())) @@ -971,7 +970,7 @@ void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, El if (attrName && !attributeOwnerElement) return; - if (!document()->shouldInvalidateNodeListCaches()) + if (!document()->shouldInvalidateNodeListCaches(attrName)) return; document()->invalidateNodeListCaches(attrName); @@ -1394,6 +1393,12 @@ bool Node::canStartSelection() const return parentOrHostNode() ? parentOrHostNode()->canStartSelection() : true; } +Element* Node::shadowHost() const +{ + if (ShadowRoot* root = shadowRoot()) + return root->host(); + return 0; +} Node* Node::shadowAncestorNode() const { @@ -1435,11 +1440,6 @@ ContainerNode* Node::nonShadowBoundaryParentNode() const return parent && !parent->isShadowRoot() ? parent : 0; } -bool Node::isInShadowTree() const -{ - return treeScope() != document(); -} - Element* Node::parentOrHostElement() const { ContainerNode* parent = parentOrHostNode(); @@ -2756,7 +2756,7 @@ void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const MemoryClassInfo<Node> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); info.visitBaseClass<TreeShared<Node, ContainerNode> >(this); info.visitBaseClass<ScriptWrappable>(this); - info.addInstrumentedMember(m_document); + info.addInstrumentedMember(document()); info.addInstrumentedMember(m_next); info.addInstrumentedMember(m_previous); } diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index c9a28f49d..6252273ad 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -223,13 +223,18 @@ public: bool hasAttrList() const { return getFlag(HasAttrListFlag); } bool hasCustomCallbacks() const { return getFlag(HasCustomCallbacksFlag); } + // If this node is in a shadow tree, returns its shadow host. Otherwise, returns 0. + Element* shadowHost() const; + // If this node is in a shadow tree, returns its shadow host. Otherwise, returns this. + // Deprecated. Should use shadowHost() and check the return value. Node* shadowAncestorNode() const; ShadowRoot* shadowRoot() const; ShadowRoot* youngestShadowRoot() const; // Returns 0, a child of ShadowRoot, or a legacy shadow root. Node* nonBoundaryShadowTreeRootNode(); - bool isInShadowTree() const; + bool isInShadowTree() const { return getFlag(InShadowTree); } + // Node's parent, shadow tree host. ContainerNode* parentOrHostNode() const; Element* parentOrHostElement() const; @@ -407,14 +412,7 @@ public: // Returns the document associated with this node. This method never returns NULL, except in the case // of a DocumentType node that is not used with any Document yet. A Document node returns itself. - Document* document() const - { - ASSERT(this); - // FIXME: below ASSERT is useful, but prevents the use of document() in the constructor or destructor - // due to the virtual function call to nodeType(). - ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); - return m_document; - } + Document* document() const; TreeScope* treeScope() const; @@ -422,7 +420,7 @@ public: // node tree, false otherwise. bool inDocument() const { - ASSERT(m_document || !getFlag(InDocumentFlag)); + ASSERT(treeScope() || !getFlag(InDocumentFlag)); return getFlag(InDocumentFlag); } @@ -692,10 +690,12 @@ private: #endif InNamedFlowFlag = 1 << 26, HasAttrListFlag = 1 << 27, - HasCustomCallbacksFlag = 1 << 28 + HasCustomCallbacksFlag = 1 << 28, + InShadowTree = 1 << 29 + }; - // 4 bits remaining + // 3 bits remaining bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } @@ -731,16 +731,14 @@ protected: void setHasCustomCallbacks() { setFlag(true, HasCustomCallbacksFlag); } + void setTreeScope(TreeScope*); + Document* documentInternal() const; + private: friend class TreeShared<Node, ContainerNode>; void removedLastRef(); - // These API should be only used for a tree scope migration. - // setTreeScope() returns NodeRareData to save extra nodeRareData() invocations on the caller site. - NodeRareData* setTreeScope(TreeScope*); - void setDocument(Document*); - enum EditableLevel { Editable, RichlyEditable }; bool rendererIsEditable(EditableLevel) const; bool isEditableToAccessibility(EditableLevel) const; @@ -783,7 +781,7 @@ private: #endif mutable uint32_t m_nodeFlags; - Document* m_document; + TreeScope* m_treeScope; Node* m_previous; Node* m_next; RenderObject* m_renderer; diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h index 0bdc3e8ac..b84a4b09f 100644 --- a/Source/WebCore/dom/NodeRareData.h +++ b/Source/WebCore/dom/NodeRareData.h @@ -184,8 +184,7 @@ class NodeRareData { WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED; public: NodeRareData() - : m_treeScope(0) - , m_childNodeList(0) + : m_childNodeList(0) , m_tabIndex(0) , m_tabIndexWasSetExplicitly(false) , m_isFocused(false) @@ -213,9 +212,6 @@ public: return rareDataMap().get(node); } - TreeScope* treeScope() const { return m_treeScope; } - void setTreeScope(TreeScope* treeScope) { m_treeScope = treeScope; } - void clearNodeLists() { m_nodeLists.clear(); } void setNodeLists(PassOwnPtr<NodeListsNodeData> lists) { m_nodeLists = lists; } NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } @@ -349,7 +345,6 @@ protected: private: - TreeScope* m_treeScope; OwnPtr<NodeListsNodeData> m_nodeLists; ChildNodeList* m_childNodeList; OwnPtr<EventTargetData> m_eventTargetData; diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp index 0943643d2..6bba56c0b 100644 --- a/Source/WebCore/dom/ProcessingInstruction.cpp +++ b/Source/WebCore/dom/ProcessingInstruction.cpp @@ -312,7 +312,8 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) m_sheet = 0; } - if (m_cachedSheet) + // If we're in document teardown, then we don't need to do any notification of our sheet's removal. + if (document()->renderer()) document()->styleResolverChanged(DeferRecalcStyle); } diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 67bb8618e..b586687c1 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -46,7 +46,7 @@ namespace WebCore { ShadowRoot::ShadowRoot(Document* document) : DocumentFragment(document, CreateShadowRoot) - , TreeScope(this) + , TreeScope(this, document) , m_prev(0) , m_next(0) , m_applyAuthorStyles(false) @@ -55,11 +55,9 @@ ShadowRoot::ShadowRoot(Document* document) { ASSERT(document); - // Assume document as parent scope. - setParentTreeScope(document); // Shadow tree scopes have the scope pointer point to themselves. // This way, direct children will receive the correct scope pointer. - ensureRareData()->setTreeScope(this); + setTreeScope(this); } ShadowRoot::~ShadowRoot() diff --git a/Source/WebCore/dom/TagNodeList.cpp b/Source/WebCore/dom/TagNodeList.cpp index 295a8d9b2..a832a6cb1 100644 --- a/Source/WebCore/dom/TagNodeList.cpp +++ b/Source/WebCore/dom/TagNodeList.cpp @@ -31,7 +31,7 @@ namespace WebCore { TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) - : DynamicSubtreeNodeList(rootNode, DoNotInvalidateOnAttributeChanges) + : DynamicSubtreeNodeList(rootNode, TagNodeListType, DoNotInvalidateOnAttributeChanges) , m_namespaceURI(namespaceURI) , m_localName(localName) { diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp index e88b13ab8..032edf126 100644 --- a/Source/WebCore/dom/TreeScope.cpp +++ b/Source/WebCore/dom/TreeScope.cpp @@ -52,14 +52,22 @@ namespace WebCore { using namespace HTMLNames; -TreeScope::TreeScope(ContainerNode* rootNode) +TreeScope::TreeScope(ContainerNode* rootNode, Document* rootDocument) : m_rootNode(rootNode) - , m_parentTreeScope(0) + , m_rootDocument(rootDocument) + , m_parentTreeScope(rootNode == rootDocument ? 0 : rootDocument) , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { ASSERT(rootNode); } +TreeScope::TreeScope() + : m_rootNode(0) + , m_rootDocument(0) + , m_parentTreeScope(0) +{ +} + TreeScope::~TreeScope() { if (m_selection) { @@ -82,6 +90,7 @@ void TreeScope::setParentTreeScope(TreeScope* newParentScope) ASSERT(newParentScope); m_parentTreeScope = newParentScope; + m_rootDocument = newParentScope->rootDocument(); } Element* TreeScope::getElementById(const AtomicString& elementId) const @@ -248,6 +257,11 @@ Node* TreeScope::focusedNode() return 0; } +bool TreeScope::isDocumentScope() const +{ + return this == m_rootDocument; +} + static void listTreeScopes(Node* node, Vector<TreeScope*, 5>& treeScopes) { while (true) { @@ -281,5 +295,11 @@ TreeScope* commonTreeScope(Node* nodeA, Node* nodeB) return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : 0; } +TreeScope* TreeScope::nullInstance() +{ + DEFINE_STATIC_LOCAL(TreeScope, instance, ()); + return &instance; +} + } // namespace WebCore diff --git a/Source/WebCore/dom/TreeScope.h b/Source/WebCore/dom/TreeScope.h index 841bbb6c1..f933c6f25 100644 --- a/Source/WebCore/dom/TreeScope.h +++ b/Source/WebCore/dom/TreeScope.h @@ -34,6 +34,7 @@ namespace WebCore { class ContainerNode; class DOMSelection; +class Document; class Element; class HTMLMapElement; class IdTargetObserverRegistry; @@ -78,17 +79,23 @@ public: void adoptIfNeeded(Node*); ContainerNode* rootNode() const { return m_rootNode; } - + Document* rootDocument() const { return m_rootDocument; } + bool isDocumentScope() const; IdTargetObserverRegistry& idTargetObserverRegistry() const { return *m_idTargetObserverRegistry.get(); } + static TreeScope* nullInstance(); + protected: - TreeScope(ContainerNode*); + TreeScope(ContainerNode*, Document*); virtual ~TreeScope(); void destroyTreeScopeData(); private: + TreeScope(); + ContainerNode* m_rootNode; + Document* m_rootDocument; TreeScope* m_parentTreeScope; DocumentOrderedMap m_elementsById; diff --git a/Source/WebCore/dom/TreeScopeAdopter.cpp b/Source/WebCore/dom/TreeScopeAdopter.cpp index 3601e0859..1dfb5cef5 100644 --- a/Source/WebCore/dom/TreeScopeAdopter.cpp +++ b/Source/WebCore/dom/TreeScopeAdopter.cpp @@ -49,7 +49,9 @@ void TreeScopeAdopter::moveTreeToNewScope(Node* root) const oldDocument->incDOMTreeVersion(); for (Node* node = root; node; node = node->traverseNextNode(root)) { - if (NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope)) { + node->setTreeScope(m_newScope); + if (node->hasRareData()) { + NodeRareData* rareData = node->rareData(); if (rareData->nodeLists()) rareData->nodeLists()->adoptTreeScope(oldDocument, newDocument); if (node->isElementNode()) @@ -96,8 +98,6 @@ inline void TreeScopeAdopter::moveNodeToNewDocument(Node* node, Document* oldDoc if (oldDocument) oldDocument->moveNodeIteratorsToNewDocument(node, newDocument); - node->setDocument(newDocument); - #ifndef NDEBUG didMoveToNewDocumentWasCalled = false; oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument; diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp index b0cff11b5..c50e0572f 100644 --- a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp @@ -43,6 +43,20 @@ WebKitNamedFlowCollection::WebKitNamedFlowCollection(Document* doc) { } +Vector<String> WebKitNamedFlowCollection::namedFlowsNames() +{ + Vector<String> namedFlows; + + for (NamedFlowSet::iterator it = m_namedFlows.begin(); it != m_namedFlows.end(); ++it) { + if ((*it)->flowState() == WebKitNamedFlow::FlowStateNull) + continue; + + namedFlows.append((*it)->name().string()); + } + + return namedFlows; +} + WebKitNamedFlow* WebKitNamedFlowCollection::flowByName(const String& flowName) { NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.h b/Source/WebCore/dom/WebKitNamedFlowCollection.h index 130c6c8fb..d952e8ed2 100644 --- a/Source/WebCore/dom/WebKitNamedFlowCollection.h +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.h @@ -34,6 +34,7 @@ #include <wtf/ListHashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/Vector.h> namespace WebCore { @@ -44,6 +45,7 @@ class WebKitNamedFlowCollection : public RefCounted<WebKitNamedFlowCollection> { public: static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); } + Vector<String> namedFlowsNames(); WebKitNamedFlow* flowByName(const String&); PassRefPtr<WebKitNamedFlow> ensureFlowWithName(const String&); diff --git a/Source/WebCore/editing/MoveSelectionCommand.cpp b/Source/WebCore/editing/MoveSelectionCommand.cpp index 5a2143c63..5bf545413 100644 --- a/Source/WebCore/editing/MoveSelectionCommand.cpp +++ b/Source/WebCore/editing/MoveSelectionCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "MoveSelectionCommand.h" +#include "Document.h" #include "DocumentFragment.h" #include "ReplaceSelectionCommand.h" diff --git a/Source/WebCore/editing/RemoveNodeCommand.cpp b/Source/WebCore/editing/RemoveNodeCommand.cpp index 19657ac0f..8be207061 100644 --- a/Source/WebCore/editing/RemoveNodeCommand.cpp +++ b/Source/WebCore/editing/RemoveNodeCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RemoveNodeCommand.h" +#include "Document.h" #include "Node.h" #include <wtf/Assertions.h> diff --git a/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp b/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp index 1452f8803..281fdbdf3 100644 --- a/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp +++ b/Source/WebCore/editing/RemoveNodePreservingChildrenCommand.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RemoveNodePreservingChildrenCommand.h" +#include "Document.h" #include "Node.h" #include <wtf/Assertions.h> diff --git a/Source/WebCore/html/CollectionType.h b/Source/WebCore/html/CollectionType.h index 9cd70cea0..ab03ce646 100644 --- a/Source/WebCore/html/CollectionType.h +++ b/Source/WebCore/html/CollectionType.h @@ -61,7 +61,7 @@ enum CollectionType { #endif FormControls, - InvalidCollectionType + NodeListCollectionType }; static const CollectionType FirstUnnamedDocumentCachedType = DocImages; diff --git a/Source/WebCore/html/ColorInputType.cpp b/Source/WebCore/html/ColorInputType.cpp index 1ececc2b6..ea2151c1e 100644 --- a/Source/WebCore/html/ColorInputType.cpp +++ b/Source/WebCore/html/ColorInputType.cpp @@ -38,6 +38,8 @@ #include "HTMLDivElement.h" #include "HTMLInputElement.h" #include "MouseEvent.h" +#include "RenderObject.h" +#include "RenderView.h" #include "ScriptController.h" #include "ShadowRoot.h" @@ -117,7 +119,7 @@ void ColorInputType::createShadowSubtree() ExceptionCode ec = 0; wrapperElement->appendChild(colorSwatch.release(), ec); ASSERT(!ec); - element()->shadow()->oldestShadowRoot()->appendChild(wrapperElement.release(), ec); + element()->userAgentShadowRoot()->appendChild(wrapperElement.release(), ec); ASSERT(!ec); updateColorSwatch(); @@ -191,10 +193,17 @@ void ColorInputType::updateColorSwatch() HTMLElement* ColorInputType::shadowColorSwatch() const { - ShadowRoot* shadow = element()->shadow()->oldestShadowRoot(); + ShadowRoot* shadow = element()->userAgentShadowRoot(); return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0; } +IntRect ColorInputType::elementRectRelativeToWindow() const +{ + RenderObject* renderer = element()->renderer(); + ASSERT(renderer); + return pixelSnappedIntRect(renderer->view()->frameView()->contentsToWindow(renderer->absoluteBoundingBoxRect())); +} + } // namespace WebCore #endif // ENABLE(INPUT_TYPE_COLOR) diff --git a/Source/WebCore/html/ColorInputType.h b/Source/WebCore/html/ColorInputType.h index 779cd976e..e03cb2242 100644 --- a/Source/WebCore/html/ColorInputType.h +++ b/Source/WebCore/html/ColorInputType.h @@ -46,6 +46,7 @@ public: // ColorChooserClient implementation. virtual void didChooseColor(const Color&) OVERRIDE; virtual void didEndChooser() OVERRIDE; + virtual IntRect elementRectRelativeToWindow() const OVERRIDE; private: ColorInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { } diff --git a/Source/WebCore/html/FTPDirectoryDocument.cpp b/Source/WebCore/html/FTPDirectoryDocument.cpp index 412a1fe65..18689c97f 100644 --- a/Source/WebCore/html/FTPDirectoryDocument.cpp +++ b/Source/WebCore/html/FTPDirectoryDocument.cpp @@ -88,7 +88,6 @@ private: RefPtr<HTMLTableElement> m_tableElement; bool m_skipLF; - bool m_parsedTemplate; int m_size; UChar* m_buffer; @@ -101,7 +100,6 @@ private: FTPDirectoryDocumentParser::FTPDirectoryDocumentParser(HTMLDocument* document) : HTMLDocumentParser(document, false) , m_skipLF(false) - , m_parsedTemplate(false) , m_size(254) , m_buffer(static_cast<UChar*>(fastMalloc(sizeof(UChar) * m_size))) , m_dest(m_buffer) diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp index f39733d15..7a75e13c1 100644 --- a/Source/WebCore/html/FileInputType.cpp +++ b/Source/WebCore/html/FileInputType.cpp @@ -297,13 +297,13 @@ void FileInputType::createShadowSubtree() { ASSERT(element()->shadow()); ExceptionCode ec = 0; - element()->shadow()->oldestShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), ec); + element()->userAgentShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), ec); } void FileInputType::multipleAttributeChanged() { ASSERT(element()->shadow()); - UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->shadow()->oldestShadowRoot()->firstChild()); + UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->userAgentShadowRoot()->firstChild()); if (button) button->setValue(element()->multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel()); } diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp index 46241be1a..5e39fe229 100644 --- a/Source/WebCore/html/FormController.cpp +++ b/Source/WebCore/html/FormController.cpp @@ -79,14 +79,13 @@ FormControlState FormControlState::deserialize(const Vector<String>& stateVector class FormElementKey { public: - FormElementKey(AtomicStringImpl* = 0, AtomicStringImpl* = 0, AtomicStringImpl* = 0); + FormElementKey(AtomicStringImpl* = 0, AtomicStringImpl* = 0); ~FormElementKey(); FormElementKey(const FormElementKey&); FormElementKey& operator=(const FormElementKey&); AtomicStringImpl* name() const { return m_name; } AtomicStringImpl* type() const { return m_type; } - AtomicStringImpl* formKey() const { return m_formKey; } // Hash table deleted values, which are only constructed and never copied or destroyed. FormElementKey(WTF::HashTableDeletedValueType) : m_name(hashTableDeletedValue()) { } @@ -100,13 +99,11 @@ private: AtomicStringImpl* m_name; AtomicStringImpl* m_type; - AtomicStringImpl* m_formKey; }; -FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type, AtomicStringImpl* formKey) +FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type) : m_name(name) , m_type(type) - , m_formKey(formKey) { ref(); } @@ -119,7 +116,6 @@ FormElementKey::~FormElementKey() FormElementKey::FormElementKey(const FormElementKey& other) : m_name(other.name()) , m_type(other.type()) - , m_formKey(other.formKey()) { ref(); } @@ -130,7 +126,6 @@ FormElementKey& FormElementKey::operator=(const FormElementKey& other) deref(); m_name = other.name(); m_type = other.type(); - m_formKey = other.formKey(); return *this; } @@ -140,8 +135,6 @@ void FormElementKey::ref() const name()->ref(); if (type()) type()->ref(); - if (formKey()) - formKey()->ref(); } void FormElementKey::deref() const @@ -150,13 +143,11 @@ void FormElementKey::deref() const name()->deref(); if (type()) type()->deref(); - if (formKey()) - formKey()->deref(); } inline bool operator==(const FormElementKey& a, const FormElementKey& b) { - return a.name() == b.name() && a.type() == b.type() && a.formKey() == b.formKey(); + return a.name() == b.name() && a.type() == b.type(); } struct FormElementKeyHash { @@ -178,17 +169,23 @@ struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> { // ---------------------------------------------------------------------------- class SavedFormState { + WTF_MAKE_NONCOPYABLE(SavedFormState); + WTF_MAKE_FAST_ALLOCATED; + public: static PassOwnPtr<SavedFormState> create(); + static PassOwnPtr<SavedFormState> deserialize(const Vector<String>&, size_t& index); + void serializeTo(Vector<String>&) const; bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); } - void appendControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey, const FormControlState&); - FormControlState takeControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey); + void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&); + FormControlState takeControlState(const AtomicString& name, const AtomicString& type); private: - SavedFormState() { } + SavedFormState() : m_controlStateCount(0) { } typedef HashMap<FormElementKey, Deque<FormControlState>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap; FormElementStateMap m_stateForNewFormElements; + size_t m_controlStateCount; }; PassOwnPtr<SavedFormState> SavedFormState::create() @@ -196,9 +193,50 @@ PassOwnPtr<SavedFormState> SavedFormState::create() return adoptPtr(new SavedFormState); } -void SavedFormState::appendControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey, const FormControlState& state) +static bool isNotFormControlTypeCharacter(UChar ch) +{ + return ch != '-' && (ch > 'z' || ch < 'a'); +} + +PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index) +{ + if (index >= stateVector.size()) + return nullptr; + // FIXME: We need String::toSizeT(). + size_t itemCount = stateVector[index++].toUInt(); + if (!itemCount) + return nullptr; + OwnPtr<SavedFormState> savedFormState = adoptPtr(new SavedFormState); + while (itemCount--) { + if (index + 1 >= stateVector.size()) + return nullptr; + String name = stateVector[index++]; + String type = stateVector[index++]; + FormControlState state = FormControlState::deserialize(stateVector, index); + if (type.isEmpty() || type.find(isNotFormControlTypeCharacter) != notFound || state.isFailure()) + return nullptr; + savedFormState->appendControlState(name, type, state); + } + return savedFormState.release(); +} + +void SavedFormState::serializeTo(Vector<String>& stateVector) const +{ + stateVector.append(String::number(m_controlStateCount)); + for (FormElementStateMap::const_iterator it = m_stateForNewFormElements.begin(); it != m_stateForNewFormElements.end(); ++it) { + const FormElementKey& key = it->first; + const Deque<FormControlState>& queue = it->second; + for (Deque<FormControlState>::const_iterator queIterator = queue.begin(); queIterator != queue.end(); ++queIterator) { + stateVector.append(key.name()); + stateVector.append(key.type()); + queIterator->serializeTo(stateVector); + } + } +} + +void SavedFormState::appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState& state) { - FormElementKey key(name.impl(), type.impl(), formKey.impl()); + FormElementKey key(name.impl(), type.impl()); FormElementStateMap::iterator it = m_stateForNewFormElements.find(key); if (it != m_stateForNewFormElements.end()) it->second.append(state); @@ -207,17 +245,19 @@ void SavedFormState::appendControlState(const AtomicString& name, const AtomicSt stateList.append(state); m_stateForNewFormElements.set(key, stateList); } + m_controlStateCount++; } -FormControlState SavedFormState::takeControlState(const AtomicString& name, const AtomicString& type, const AtomicString& formKey) +FormControlState SavedFormState::takeControlState(const AtomicString& name, const AtomicString& type) { if (m_stateForNewFormElements.isEmpty()) return FormControlState(); - FormElementStateMap::iterator it = m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl(), formKey.impl())); + FormElementStateMap::iterator it = m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl())); if (it == m_stateForNewFormElements.end()) return FormControlState(); ASSERT(it->second.size()); FormControlState state = it->second.takeFirst(); + m_controlStateCount--; if (!it->second.size()) m_stateForNewFormElements.remove(it); return state; @@ -238,23 +278,45 @@ private: FormKeyGenerator() { } typedef HashMap<HTMLFormElement*, AtomicString> FormToKeyMap; + typedef HashMap<String, unsigned> FormSignatureToNextIndexMap; FormToKeyMap m_formToKeyMap; - HashSet<AtomicString> m_existingKeys; + FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; }; -static inline AtomicString createKey(HTMLFormElement* form, unsigned index) +static inline void recordFormStructure(const HTMLFormElement& form, StringBuilder& builder) { - ASSERT(form); - KURL actionURL = form->getURLAttribute(actionAttr); + // 2 is enough to distinguish forms in webkit.org/b/91209#c0 + const size_t namedControlsToBeRecorded = 2; + const Vector<FormAssociatedElement*>& controls = form.associatedElements(); + builder.append(" ["); + for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) { + if (!controls[i]->isFormControlElementWithState()) + continue; + HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(controls[i]); + if (!ownerFormForState(*control)) + continue; + AtomicString name = control->name(); + if (name.isEmpty()) + continue; + namedControls++; + builder.append(name); + builder.append(" "); + } + builder.append("]"); +} + +static inline String formSignature(const HTMLFormElement& form) +{ + KURL actionURL = form.getURLAttribute(actionAttr); // Remove the query part because it might contain volatile parameters such // as a session key. actionURL.setQuery(String()); StringBuilder builder; if (!actionURL.isEmpty()) builder.append(actionURL.string()); - builder.append(" #"); - builder.append(String::number(index)); - return builder.toAtomicString(); + + recordFormStructure(form, builder); + return builder.toString(); } AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control) @@ -268,13 +330,18 @@ AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& co if (it != m_formToKeyMap.end()) return it->second; - AtomicString candidateKey; - unsigned index = 0; - do { - candidateKey = createKey(form, index++); - } while (!m_existingKeys.add(candidateKey).isNewEntry); - m_formToKeyMap.add(form, candidateKey); - return candidateKey; + String signature = formSignature(*form); + ASSERT(!signature.isNull()); + FormSignatureToNextIndexMap::AddResult result = m_formSignatureToNextIndexMap.add(signature, 0); + unsigned nextIndex = result.iterator->second++; + + StringBuilder builder; + builder.append(signature); + builder.append(" #"); + builder.append(String::number(nextIndex)); + AtomicString formKey = builder.toAtomicString(); + m_formToKeyMap.add(form, formKey); + return formKey; } void FormKeyGenerator::willDeleteForm(HTMLFormElement* form) @@ -285,7 +352,6 @@ void FormKeyGenerator::willDeleteForm(HTMLFormElement* form) FormToKeyMap::iterator it = m_formToKeyMap.find(form); if (it == m_formToKeyMap.end()) return; - m_existingKeys.remove(it->second); m_formToKeyMap.remove(it); } @@ -304,26 +370,35 @@ static String formStateSignature() // In the legacy version of serialized state, the first item was a name // attribute value of a form control. The following string literal should // contain some characters which are rarely used for name attribute values. - DEFINE_STATIC_LOCAL(String, signature, ("\n\r?% WebKit serialized form state version 5 \n\r=&")); + DEFINE_STATIC_LOCAL(String, signature, ("\n\r?% WebKit serialized form state version 7 \n\r=&")); return signature; } -Vector<String> FormController::formElementsState() const +PassOwnPtr<FormController::SavedFormStateMap> FormController::createSavedFormStateMap(const FormElementListHashSet& controlList) { OwnPtr<FormKeyGenerator> keyGenerator = FormKeyGenerator::create(); + OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap); + for (FormElementListHashSet::const_iterator it = controlList.begin(); it != controlList.end(); ++it) { + HTMLFormControlElementWithState* control = *it; + if (!control->shouldSaveAndRestoreFormControlState()) + continue; + SavedFormStateMap::AddResult result = stateMap->add(keyGenerator->formKey(*control).impl(), nullptr); + if (result.isNewEntry) + result.iterator->second = SavedFormState::create(); + result.iterator->second->appendControlState(control->name(), control->type(), control->saveFormControlState()); + } + return stateMap.release(); +} + +Vector<String> FormController::formElementsState() const +{ + OwnPtr<SavedFormStateMap> stateMap = createSavedFormStateMap(m_formElementsWithState); Vector<String> stateVector; - stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 5 + 1); + stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 4); stateVector.append(formStateSignature()); - typedef FormElementListHashSet::const_iterator Iterator; - Iterator end = m_formElementsWithState.end(); - for (Iterator it = m_formElementsWithState.begin(); it != end; ++it) { - HTMLFormControlElementWithState* elementWithState = *it; - if (!elementWithState->shouldSaveAndRestoreFormControlState()) - continue; - stateVector.append(elementWithState->name().string()); - stateVector.append(elementWithState->formControlType().string()); - stateVector.append(keyGenerator->formKey(*elementWithState).string()); - elementWithState->saveFormControlState().serializeTo(stateVector); + for (SavedFormStateMap::const_iterator it = stateMap->begin(); it != stateMap->end(); ++it) { + stateVector.append(it->first.get()); + it->second->serializeTo(stateVector); } bool hasOnlySignature = stateVector.size() == 1; if (hasOnlySignature) @@ -331,11 +406,6 @@ Vector<String> FormController::formElementsState() const return stateVector; } -static bool isNotFormControlTypeCharacter(UChar ch) -{ - return ch != '-' && (ch > 'z' || ch < 'a'); -} - void FormController::setStateForNewFormElements(const Vector<String>& stateVector) { m_formElementsWithState.clear(); @@ -344,30 +414,31 @@ void FormController::setStateForNewFormElements(const Vector<String>& stateVecto if (stateVector.size() < 1 || stateVector[i++] != formStateSignature()) return; - while (i + 2 < stateVector.size()) { - AtomicString name = stateVector[i++]; - AtomicString type = stateVector[i++]; + while (i + 1 < stateVector.size()) { AtomicString formKey = stateVector[i++]; - FormControlState state = FormControlState::deserialize(stateVector, i); - if (type.isEmpty() || type.impl()->find(isNotFormControlTypeCharacter) != notFound || state.isFailure()) + OwnPtr<SavedFormState> state = SavedFormState::deserialize(stateVector, i); + if (!state) { + i = 0; break; - if (!m_savedFormState) - m_savedFormState = SavedFormState::create(); - m_savedFormState->appendControlState(name, type, formKey, state); + } + m_savedFormStateMap.add(formKey.impl(), state.release()); } if (i != stateVector.size()) - m_savedFormState.clear(); + m_savedFormStateMap.clear(); } FormControlState FormController::takeStateForFormElement(const HTMLFormControlElementWithState& control) { - if (!m_savedFormState) + if (m_savedFormStateMap.isEmpty()) return FormControlState(); if (!m_formKeyGenerator) m_formKeyGenerator = FormKeyGenerator::create(); - FormControlState state = m_savedFormState->takeControlState(control.name(), control.type(), m_formKeyGenerator->formKey(control)); - if (m_savedFormState->isEmpty()) - m_savedFormState.clear(); + SavedFormStateMap::iterator it = m_savedFormStateMap.find(m_formKeyGenerator->formKey(control).impl()); + if (it == m_savedFormStateMap.end()) + return FormControlState(); + FormControlState state = it->second->takeControlState(control.name(), control.type()); + if (it->second->isEmpty()) + m_savedFormStateMap.remove(it); return state; } diff --git a/Source/WebCore/html/FormController.h b/Source/WebCore/html/FormController.h index 2dd7b2202..5d3748d0e 100644 --- a/Source/WebCore/html/FormController.h +++ b/Source/WebCore/html/FormController.h @@ -93,15 +93,16 @@ public: void restoreControlStateIn(HTMLFormElement&); private: + typedef ListHashSet<HTMLFormControlElementWithState*, 64> FormElementListHashSet; + typedef HashMap<RefPtr<AtomicStringImpl>, OwnPtr<SavedFormState> > SavedFormStateMap; + FormController(); + static PassOwnPtr<SavedFormStateMap> createSavedFormStateMap(const FormElementListHashSet&); FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&); CheckedRadioButtons m_checkedRadioButtons; - - typedef ListHashSet<HTMLFormControlElementWithState*, 64> FormElementListHashSet; FormElementListHashSet m_formElementsWithState; - - OwnPtr<SavedFormState> m_savedFormState; + SavedFormStateMap m_savedFormStateMap; OwnPtr<FormKeyGenerator> m_formKeyGenerator; }; diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp index e769b2641..1dd5c15aa 100644 --- a/Source/WebCore/html/HTMLAllCollection.cpp +++ b/Source/WebCore/html/HTMLAllCollection.cpp @@ -36,7 +36,7 @@ PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document) } HTMLAllCollection::HTMLAllCollection(Document* document) - : HTMLCollection(document, DocAll, SupportItemBefore) + : HTMLCollection(document, DocAll, DoesNotOverrideItemAfter) { } diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index 2b53edd98..57953ac98 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -69,7 +69,7 @@ static bool shouldOnlyIncludeDirectChildren(CollectionType type) case TSectionRows: case TableTBodies: return true; - case InvalidCollectionType: + case NodeListCollectionType: break; } ASSERT_NOT_REACHED(); @@ -104,7 +104,7 @@ static NodeListRootType rootTypeFromCollectionType(CollectionType type) case SelectedOptions: case DataListOptions: case MapAreas: - case InvalidCollectionType: + case NodeListCollectionType: return NodeListIsRootedAtNode; } ASSERT_NOT_REACHED(); @@ -144,7 +144,7 @@ static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col #endif case FormControls: return InvalidateForFormControls; - case InvalidCollectionType: + case NodeListCollectionType: break; } ASSERT_NOT_REACHED(); @@ -152,17 +152,16 @@ static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col } -HTMLCollection::HTMLCollection(Node* base, CollectionType type, ItemBeforeSupportType itemBeforeSupportType) - : HTMLCollectionCacheBase(rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), type, itemBeforeSupportType) - , m_base(base) +HTMLCollection::HTMLCollection(Node* ownerNode, CollectionType type, ItemAfterOverrideType itemAfterOverrideType) + : HTMLCollectionCacheBase(ownerNode, rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), + WebCore::shouldOnlyIncludeDirectChildren(type), type, itemAfterOverrideType) { - ASSERT(m_base); - m_base->document()->registerNodeListCache(this); + document()->registerNodeListCache(this); } PassRefPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type) { - return adoptRef(new HTMLCollection(base, type, SupportItemBefore)); + return adoptRef(new HTMLCollection(base, type, DoesNotOverrideItemAfter)); } HTMLCollection::~HTMLCollection() @@ -176,7 +175,7 @@ HTMLCollection::~HTMLCollection() } else // HTMLNameCollection removes cache by itself. ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); - m_base->document()->unregisterNodeListCache(this); + document()->unregisterNodeListCache(this); } static inline bool isAcceptableElement(CollectionType type, Element* element) @@ -231,7 +230,7 @@ static inline bool isAcceptableElement(CollectionType type, Element* element) case DocumentNamedItems: case TableRows: case WindowNamedItems: - case InvalidCollectionType: + case NodeListCollectionType: ASSERT_NOT_REACHED(); } return false; @@ -254,41 +253,65 @@ static inline Node* lastDescendent(Node* node) return node; } -template<bool forward> -static Element* itemBeforeOrAfter(CollectionType type, Node* base, unsigned& offsetInArray, Node* previous) +static Node* firstNode(bool forward, Node* rootNode, bool onlyIncludeDirectChildren) { - ASSERT_UNUSED(offsetInArray, !offsetInArray); - bool onlyIncludeDirectChildren = shouldOnlyIncludeDirectChildren(type); - Node* rootNode = base; - Node* current; - if (previous) - current = nextNode<forward>(rootNode, previous, onlyIncludeDirectChildren); - else { - if (forward) - current = rootNode->firstChild(); - else - current = onlyIncludeDirectChildren ? rootNode->lastChild() : lastDescendent(rootNode); - } + if (forward) + return rootNode->firstChild(); + else + return onlyIncludeDirectChildren ? rootNode->lastChild() : lastDescendent(rootNode); +} +template <bool forward> +Node* DynamicNodeListCacheBase::iterateForNextNode(Node* current) const +{ + bool onlyIncludeDirectChildren = shouldOnlyIncludeDirectChildren(); + CollectionType collectionType = type(); + Node* rootNode = this->rootNode(); for (; current; current = nextNode<forward>(rootNode, current, onlyIncludeDirectChildren)) { - if (current->isElementNode() && isAcceptableElement(type, toElement(current))) - return toElement(current); + if (collectionType == NodeListCollectionType) { + if (current->isElementNode() && static_cast<const DynamicNodeList*>(this)->nodeMatches(toElement(current))) + return toElement(current); + } else { + if (current->isElementNode() && isAcceptableElement(collectionType, toElement(current))) + return toElement(current); + } } return 0; } -Element* HTMLCollection::itemBefore(unsigned& offsetInArray, Element* previous) const +// Without this ALWAYS_INLINE, length() and item() can be 100% slower. +template<bool forward> ALWAYS_INLINE +Node* DynamicNodeListCacheBase::itemBeforeOrAfter(Node* previous) const +{ + Node* current; + if (LIKELY(!!previous)) // Without this LIKELY, length() and item() can be 10% slower. + current = nextNode<forward>(rootNode(), previous, shouldOnlyIncludeDirectChildren()); + else + current = firstNode(forward, rootNode(), previous); + + if (type() == NodeListCollectionType && shouldOnlyIncludeDirectChildren()) // ChildNodeList + return current; + + return iterateForNextNode<forward>(current); +} + +// Without this ALWAYS_INLINE, length() and item() can be 100% slower. +ALWAYS_INLINE Node* DynamicNodeListCacheBase::itemBefore(Node* previous) const { - return itemBeforeOrAfter<false>(type(), base(), offsetInArray, previous); + return itemBeforeOrAfter<false>(previous); } -Element* HTMLCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +// Without this ALWAYS_INLINE, length() and item() can be 100% slower. +ALWAYS_INLINE Node* DynamicNodeListCacheBase::itemAfter(unsigned& offsetInArray, Node* previous) const { - return itemBeforeOrAfter<true>(type(), base(), offsetInArray, previous); + if (UNLIKELY(overridesItemAfter())) // Without this UNLIKELY, length() can be 100% slower. + return static_cast<const HTMLCollection*>(this)->virtualItemAfter(offsetInArray, toElement(previous)); + ASSERT(!offsetInArray); + return itemBeforeOrAfter<true>(previous); } -bool ALWAYS_INLINE HTMLCollection::isLastItemCloserThanLastOrCachedItem(unsigned offset) const +bool ALWAYS_INLINE DynamicNodeListCacheBase::isLastItemCloserThanLastOrCachedItem(unsigned offset) const { ASSERT(isLengthCacheValid()); unsigned distanceFromLastItem = cachedLength() - offset; @@ -298,7 +321,7 @@ bool ALWAYS_INLINE HTMLCollection::isLastItemCloserThanLastOrCachedItem(unsigned return cachedItemOffset() < offset && distanceFromLastItem < offset - cachedItemOffset(); } -bool ALWAYS_INLINE HTMLCollection::isFirstItemCloserThanCachedItem(unsigned offset) const +bool ALWAYS_INLINE DynamicNodeListCacheBase::isFirstItemCloserThanCachedItem(unsigned offset) const { ASSERT(isItemCacheValid()); if (cachedItemOffset() < offset) @@ -308,28 +331,33 @@ bool ALWAYS_INLINE HTMLCollection::isFirstItemCloserThanCachedItem(unsigned offs return offset < distanceFromCachedItem; } -unsigned HTMLCollection::length() const +ALWAYS_INLINE void DynamicNodeListCacheBase::setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const +{ + setItemCache(item, offset); + if (overridesItemAfter()) { + ASSERT(item->isElementNode()); + static_cast<const HTMLCollectionCacheBase*>(this)->m_cachedElementsArrayOffset = elementsArrayOffset; + } else + ASSERT(!elementsArrayOffset); +} + +ALWAYS_INLINE unsigned DynamicNodeListCacheBase::cachedElementsArrayOffset() const +{ + return overridesItemAfter() ? static_cast<const HTMLCollectionCacheBase*>(this)->m_cachedElementsArrayOffset : 0; +} + +unsigned DynamicNodeListCacheBase::lengthCommon() const { if (isLengthCacheValid()) return cachedLength(); - if (!isItemCacheValid() && !item(0)) { - ASSERT(isLengthCacheValid()); - return 0; - } - - ASSERT(isItemCacheValid()); - ASSERT(cachedItem()); - unsigned offset = cachedItemOffset(); - do { - offset++; - } while (itemBeforeOrAfterCachedItem(offset)); + itemCommon(UINT_MAX); ASSERT(isLengthCacheValid()); - - return offset; + + return cachedLength(); } -Node* HTMLCollection::item(unsigned offset) const +Node* DynamicNodeListCacheBase::itemCommon(unsigned offset) const { if (isItemCacheValid() && cachedItemOffset() == offset) return cachedItem(); @@ -342,14 +370,11 @@ Node* HTMLCollection::item(unsigned offset) const static_cast<const HTMLPropertiesCollection*>(this)->updateRefElements(); #endif - if (isLengthCacheValid() && supportsItemBefore() && isLastItemCloserThanLastOrCachedItem(offset)) { - // FIXME: Need to figure out the last offset in array for HTMLFormCollection and HTMLPropertiesCollection - unsigned unusedOffsetInArray = 0; - Node* lastItem = itemBefore(unusedOffsetInArray, 0); - ASSERT(!unusedOffsetInArray); + if (isLengthCacheValid() && !overridesItemAfter() && isLastItemCloserThanLastOrCachedItem(offset)) { + Node* lastItem = itemBefore(0); ASSERT(lastItem); setItemCache(lastItem, cachedLength() - 1, 0); - } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (!supportsItemBefore() && offset < cachedItemOffset())) { + } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (overridesItemAfter() && offset < cachedItemOffset())) { unsigned offsetInArray = 0; Node* firstItem = itemAfter(offsetInArray, 0); if (!firstItem) { @@ -366,22 +391,19 @@ Node* HTMLCollection::item(unsigned offset) const return itemBeforeOrAfterCachedItem(offset); } -Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const +Node* DynamicNodeListCacheBase::itemBeforeOrAfterCachedItem(unsigned offset) const { unsigned currentOffset = cachedItemOffset(); - ASSERT(cachedItem()->isElementNode()); - Element* currentItem = toElement(cachedItem()); + Node* currentItem = cachedItem(); ASSERT(currentOffset != offset); - unsigned offsetInArray = cachedElementsArrayOffset(); - if (offset < cachedItemOffset()) { - ASSERT(supportsItemBefore()); - while ((currentItem = itemBefore(offsetInArray, currentItem))) { + ASSERT(!overridesItemAfter()); + while ((currentItem = itemBefore(currentItem))) { ASSERT(currentOffset); currentOffset--; if (currentOffset == offset) { - setItemCache(currentItem, currentOffset, offsetInArray); + setItemCache(currentItem, currentOffset, 0); return currentItem; } } @@ -389,6 +411,7 @@ Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const return 0; } + unsigned offsetInArray = cachedElementsArrayOffset(); while ((currentItem = itemAfter(offsetInArray, currentItem))) { currentOffset++; if (currentOffset == offset) { @@ -403,6 +426,12 @@ Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const return 0; } +Element* HTMLCollection::virtualItemAfter(unsigned&, Element*) const +{ + ASSERT_NOT_REACHED(); + return 0; +} + static inline bool nameShouldBeVisibleInDocumentAll(HTMLElement* element) { // The document.all collection returns only certain types of elements by name, @@ -441,8 +470,8 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const unsigned arrayOffset = 0; unsigned i = 0; - for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { - if (checkForNameMatch(e, /* checkName */ false, name)) { + for (Node* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { + if (checkForNameMatch(toElement(e), /* checkName */ false, name)) { setItemCache(e, i, arrayOffset); return e; } @@ -450,10 +479,10 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const } i = 0; - for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { - if (checkForNameMatch(e, /* checkName */ true, name)) { + for (Node* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { + if (checkForNameMatch(toElement(e), /* checkName */ true, name)) { setItemCache(e, i, arrayOffset); - return e; + return toElement(e); } i++; } @@ -467,10 +496,10 @@ void HTMLCollection::updateNameCache() const return; unsigned arrayOffset = 0; - for (Element* element = itemAfter(arrayOffset, 0); element; element = itemAfter(arrayOffset, element)) { - if (!element->isHTMLElement()) + for (Node* node = itemAfter(arrayOffset, 0); node; node = itemAfter(arrayOffset, node)) { + if (!node->isHTMLElement()) continue; - HTMLElement* e = toHTMLElement(element); + HTMLElement* e = toHTMLElement(node); const AtomicString& idAttrVal = e->getIdAttribute(); const AtomicString& nameAttrVal = e->getNameAttribute(); if (!idAttrVal.isEmpty()) @@ -522,7 +551,7 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& PassRefPtr<NodeList> HTMLCollection::tags(const String& name) { - return m_base->getElementsByTagName(name); + return ownerNode()->getElementsByTagName(name); } void HTMLCollectionCacheBase::append(NodeCacheMap& map, const AtomicString& key, Element* element) diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h index 6343e8edf..833618373 100644 --- a/Source/WebCore/html/HTMLCollection.h +++ b/Source/WebCore/html/HTMLCollection.h @@ -39,20 +39,13 @@ class NodeList; class HTMLCollectionCacheBase : public DynamicNodeListCacheBase { public: - HTMLCollectionCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, CollectionType collectionType, ItemBeforeSupportType itemBeforeSupportType) - : DynamicNodeListCacheBase(rootType, invalidationType, collectionType, itemBeforeSupportType) - , m_cachedElementsArrayOffset(0) + HTMLCollectionCacheBase(Node* ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType, + bool shouldOnlyIncludeDirectChildren, CollectionType collectionType, ItemAfterOverrideType itemAfterOverrideType) + : DynamicNodeListCacheBase(ownerNode, rootType, invalidationType, shouldOnlyIncludeDirectChildren, collectionType, itemAfterOverrideType) { } protected: - void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const - { - setItemCache(item, offset); - m_cachedElementsArrayOffset = elementsArrayOffset; - } - unsigned cachedElementsArrayOffset() const { return m_cachedElementsArrayOffset; } - typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache.get(name.impl()); } Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameCache.get(name.impl()); } @@ -63,13 +56,12 @@ protected: private: using DynamicNodeListCacheBase::isRootedAtDocument; - using DynamicNodeListCacheBase::setItemCache; mutable NodeCacheMap m_idCache; mutable NodeCacheMap m_nameCache; mutable unsigned m_cachedElementsArrayOffset; - friend void DynamicNodeListCacheBase::invalidateCache() const; + friend class DynamicNodeListCacheBase; }; class HTMLCollection : public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase { @@ -78,8 +70,8 @@ public: virtual ~HTMLCollection(); // DOM API - unsigned length() const; - Node* item(unsigned index) const; + unsigned length() const { return lengthCommon(); } + Node* item(unsigned offset) const { return itemCommon(offset); } virtual Node* namedItem(const AtomicString& name) const; PassRefPtr<NodeList> tags(const String&); @@ -103,23 +95,16 @@ public: return item(0) && !item(1); } - Node* base() const { return m_base.get(); } + Node* base() const { return ownerNode(); } + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const; protected: - HTMLCollection(Node* base, CollectionType, ItemBeforeSupportType); + HTMLCollection(Node* base, CollectionType, ItemAfterOverrideType); virtual void updateNameCache() const; - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const; private: bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const; - - Element* itemBefore(unsigned& offsetInArray, Element*) const; - bool isLastItemCloserThanLastOrCachedItem(unsigned offset) const; - bool isFirstItemCloserThanCachedItem(unsigned offset) const; - Element* itemBeforeOrAfterCachedItem(unsigned offset) const; - - RefPtr<Node> m_base; }; } // namespace diff --git a/Source/WebCore/html/HTMLDataListElement.cpp b/Source/WebCore/html/HTMLDataListElement.cpp index ed842eecc..d6dcb28d7 100644 --- a/Source/WebCore/html/HTMLDataListElement.cpp +++ b/Source/WebCore/html/HTMLDataListElement.cpp @@ -30,10 +30,11 @@ */ #include "config.h" -#if ENABLE(DATALIST) #include "HTMLDataListElement.h" +#if ENABLE(DATALIST_ELEMENT) #include "HTMLNames.h" +#include "IdTargetObserverRegistry.h" namespace WebCore { @@ -52,5 +53,10 @@ PassRefPtr<HTMLCollection> HTMLDataListElement::options() return ensureCachedHTMLCollection(DataListOptions); } -} // namespace WebCore -#endif // ENABLE(DATALIST) +void HTMLDataListElement::optionElementChildrenChanged() +{ + treeScope()->idTargetObserverRegistry().notifyObservers(getIdAttribute()); +} + +} // namespace WebCore +#endif // ENABLE(DATALIST_ELEMENT) diff --git a/Source/WebCore/html/HTMLDataListElement.h b/Source/WebCore/html/HTMLDataListElement.h index 9129f295e..3572643cb 100644 --- a/Source/WebCore/html/HTMLDataListElement.h +++ b/Source/WebCore/html/HTMLDataListElement.h @@ -32,8 +32,7 @@ #ifndef HTMLDataListElement_h #define HTMLDataListElement_h -#if ENABLE(DATALIST) - +#if ENABLE(DATALIST_ELEMENT) #include "HTMLCollection.h" #include "HTMLElement.h" @@ -45,11 +44,13 @@ public: PassRefPtr<HTMLCollection> options(); + void optionElementChildrenChanged(); + private: HTMLDataListElement(const QualifiedName&, Document*); }; -} // namespace WebCore -#endif // ENABLE(DATALIST) +} // namespace WebCore +#endif // ENABLE(DATALIST_ELEMENT) -#endif // HTMLDataListElement_h +#endif // HTMLDataListElement_h diff --git a/Source/WebCore/html/HTMLDataListElement.idl b/Source/WebCore/html/HTMLDataListElement.idl index 1f38105f8..7e0d69c96 100644 --- a/Source/WebCore/html/HTMLDataListElement.idl +++ b/Source/WebCore/html/HTMLDataListElement.idl @@ -30,7 +30,7 @@ module html { interface [ - Conditional=DATALIST, + Conditional=DATALIST_ELEMENT, ] HTMLDataListElement : HTMLElement { readonly attribute HTMLCollection options; }; diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp index 531bd3306..86a7b48ca 100644 --- a/Source/WebCore/html/HTMLDetailsElement.cpp +++ b/Source/WebCore/html/HTMLDetailsElement.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "HTMLDetailsElement.h" -#if ENABLE(DETAILS) - +#if ENABLE(DETAILS_ELEMENT) #include "ElementShadow.h" #include "HTMLContentElement.h" #include "HTMLNames.h" @@ -124,7 +123,7 @@ Element* HTMLDetailsElement::findMainSummary() const return toElement(child); } - return static_cast<DetailsSummaryElement*>(shadow()->oldestShadowRoot()->firstChild())->fallbackSummary(); + return static_cast<DetailsSummaryElement*>(userAgentShadowRoot()->firstChild())->fallbackSummary(); } void HTMLDetailsElement::parseAttribute(const Attribute& attribute) diff --git a/Source/WebCore/html/HTMLDetailsElement.idl b/Source/WebCore/html/HTMLDetailsElement.idl index 5ad9508c9..087f083ff 100644 --- a/Source/WebCore/html/HTMLDetailsElement.idl +++ b/Source/WebCore/html/HTMLDetailsElement.idl @@ -18,8 +18,9 @@ */ module html { - - interface HTMLDetailsElement : HTMLElement { + interface [ + Conditional=DETAILS_ELEMENT + ] HTMLDetailsElement : HTMLElement { attribute [Reflect] boolean open; }; diff --git a/Source/WebCore/html/HTMLDialogElement.cpp b/Source/WebCore/html/HTMLDialogElement.cpp index bd630ef67..4510d8143 100644 --- a/Source/WebCore/html/HTMLDialogElement.cpp +++ b/Source/WebCore/html/HTMLDialogElement.cpp @@ -28,6 +28,8 @@ #if ENABLE(DIALOG_ELEMENT) +#include "ExceptionCode.h" + namespace WebCore { using namespace HTMLNames; @@ -43,14 +45,30 @@ PassRefPtr<HTMLDialogElement> HTMLDialogElement::create(const QualifiedName& tag return adoptRef(new HTMLDialogElement(tagName, document)); } -void HTMLDialogElement::close() +void HTMLDialogElement::close(ExceptionCode& ec) { - // FIXME: Implement. + if (!fastHasAttribute(openAttr)) { + ec = INVALID_STATE_ERR; + return; + } + setBooleanAttribute(openAttr, false); } void HTMLDialogElement::show() { - // FIXME: Implement. + if (fastHasAttribute(openAttr)) + return; + setBooleanAttribute(openAttr, true); +} + +bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const +{ + // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: modifying an attribute for which there is an attribute selector + // in html.css sometimes does not trigger a style recalc. + if (name == openAttr) + return true; + + return HTMLElement::isPresentationAttribute(name); } } diff --git a/Source/WebCore/html/HTMLDialogElement.h b/Source/WebCore/html/HTMLDialogElement.h index cc5c2db0b..d1dd77689 100644 --- a/Source/WebCore/html/HTMLDialogElement.h +++ b/Source/WebCore/html/HTMLDialogElement.h @@ -39,11 +39,13 @@ class HTMLDialogElement : public HTMLElement { public: static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document*); - void close(); + void close(ExceptionCode&); void show(); private: HTMLDialogElement(const QualifiedName&, Document*); + + virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLDialogElement.idl b/Source/WebCore/html/HTMLDialogElement.idl index e5d6479ba..442f93fd8 100644 --- a/Source/WebCore/html/HTMLDialogElement.idl +++ b/Source/WebCore/html/HTMLDialogElement.idl @@ -29,7 +29,7 @@ module html { Conditional=DIALOG_ELEMENT ] HTMLDialogElement : HTMLElement { attribute [Reflect] boolean open; - void close(); + void close() raises(DOMException); void show(); }; diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormCollection.cpp index b845f0c6f..a5cc6ac4a 100644 --- a/Source/WebCore/html/HTMLFormCollection.cpp +++ b/Source/WebCore/html/HTMLFormCollection.cpp @@ -37,7 +37,7 @@ using namespace HTMLNames; // calculation every time if anything has changed. HTMLFormCollection::HTMLFormCollection(Element* base) - : HTMLCollection(base, FormControls, DoNotSupportItemBefore) + : HTMLCollection(base, FormControls, OverridesItemAfter) { ASSERT(base->hasTagName(formTag) || base->hasTagName(fieldsetTag)); } @@ -67,7 +67,7 @@ const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const return static_cast<HTMLFormElement*>(base())->imageElements(); } -Element* HTMLFormCollection::itemAfter(unsigned& offset, Element* previousItem) const +Element* HTMLFormCollection::virtualItemAfter(unsigned& offset, Element* previousItem) const { const Vector<FormAssociatedElement*>& elementsArray = formControlElements(); if (previousItem) diff --git a/Source/WebCore/html/HTMLFormCollection.h b/Source/WebCore/html/HTMLFormCollection.h index 82cbfed15..978a26f8f 100644 --- a/Source/WebCore/html/HTMLFormCollection.h +++ b/Source/WebCore/html/HTMLFormCollection.h @@ -49,7 +49,7 @@ private: const Vector<FormAssociatedElement*>& formControlElements() const; const Vector<HTMLImageElement*>& formImageElements() const; - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp index 16cf36051..d12e7b434 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.cpp +++ b/Source/WebCore/html/HTMLFrameElementBase.cpp @@ -246,11 +246,4 @@ int HTMLFrameElementBase::height() return renderBox()->height(); } -#if ENABLE(FULLSCREEN_API) -bool HTMLFrameElementBase::allowFullScreen() const -{ - return hasAttribute(webkitallowfullscreenAttr); -} -#endif - } // namespace WebCore diff --git a/Source/WebCore/html/HTMLFrameElementBase.h b/Source/WebCore/html/HTMLFrameElementBase.h index 11dc94d3d..0f84df36e 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.h +++ b/Source/WebCore/html/HTMLFrameElementBase.h @@ -42,10 +42,6 @@ public: int width(); int height(); -#if ENABLE(FULLSCREEN_API) - virtual bool allowFullScreen() const; -#endif - virtual bool canContainRangeEndPoint() const { return false; } protected: diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp index 2992b6a17..e3138e6e0 100644 --- a/Source/WebCore/html/HTMLImageElement.cpp +++ b/Source/WebCore/html/HTMLImageElement.cpp @@ -96,7 +96,7 @@ HTMLImageElement::~HTMLImageElement() void HTMLImageElement::willAddAuthorShadowRoot() { - if (shadow()->oldestShadowRoot()) + if (userAgentShadowRoot()) return; createShadowSubtree(); @@ -112,9 +112,9 @@ void HTMLImageElement::createShadowSubtree() Element* HTMLImageElement::imageElement() { - if (ElementShadow* elementShadow = shadow()) { - ASSERT(elementShadow->oldestShadowRoot()->firstChild()->hasTagName(webkitInnerImageTag)); - return toElement(elementShadow->oldestShadowRoot()->firstChild()); + if (ShadowRoot* root = userAgentShadowRoot()) { + ASSERT(root->firstChild()->hasTagName(webkitInnerImageTag)); + return toElement(root->firstChild()); } return this; @@ -409,8 +409,8 @@ void HTMLImageElement::setItemValueText(const String& value, ExceptionCode&) inline ImageInnerElement* HTMLImageElement::innerElement() const { - ASSERT(shadow()); - return toImageInnerElement(shadow()->oldestShadowRoot()->firstChild()); + ASSERT(userAgentShadowRoot()); + return toImageInnerElement(userAgentShadowRoot()->firstChild()); } } diff --git a/Source/WebCore/html/HTMLImageLoader.cpp b/Source/WebCore/html/HTMLImageLoader.cpp index e69c3e091..46a652780 100644 --- a/Source/WebCore/html/HTMLImageLoader.cpp +++ b/Source/WebCore/html/HTMLImageLoader.cpp @@ -74,13 +74,13 @@ void HTMLImageLoader::notifyFinished(CachedResource*) { CachedImage* cachedImage = image(); - Element* elem = client()->sourceElement(); + RefPtr<Element> element = client()->sourceElement(); ImageLoader::notifyFinished(cachedImage); bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400; #if USE(JSC) if (!loadError) { - if (!elem->inDocument()) { + if (!element->inDocument()) { JSC::JSGlobalData* globalData = JSDOMWindowBase::commonJSGlobalData(); JSC::JSLockHolder lock(globalData); globalData->heap.reportExtraMemoryCost(cachedImage->encodedSize()); @@ -88,8 +88,8 @@ void HTMLImageLoader::notifyFinished(CachedResource*) } #endif - if (loadError && elem->hasTagName(HTMLNames::objectTag)) - static_cast<HTMLObjectElement*>(elem)->renderFallbackContent(); + if (loadError && element->hasTagName(HTMLNames::objectTag)) + static_cast<HTMLObjectElement*>(element.get())->renderFallbackContent(); } } diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 77ea42567..407c1233b 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -45,6 +45,7 @@ #include "HTMLNames.h" #include "HTMLOptionElement.h" #include "HTMLParserIdioms.h" +#include "IdTargetObserver.h" #include "InputType.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" @@ -77,6 +78,19 @@ namespace WebCore { using namespace HTMLNames; +#if ENABLE(DATALIST_ELEMENT) +class ListAttributeTargetObserver : IdTargetObserver { +public: + static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id, HTMLInputElement*); + virtual void idTargetChanged() OVERRIDE; + +private: + ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); + + HTMLInputElement* m_element; +}; +#endif + // FIXME: According to HTML4, the length attribute's value can be arbitrarily // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things // get rather sluggish when a text field has a larger number of characters than @@ -183,6 +197,11 @@ HTMLElement* HTMLInputElement::speechButtonElement() const } #endif +HTMLElement* HTMLInputElement::sliderThumbElement() const +{ + return m_inputType->sliderThumbElement(); +} + HTMLElement* HTMLInputElement::placeholderElement() const { return m_inputType->placeholderElement(); @@ -678,10 +697,14 @@ void HTMLInputElement::parseAttribute(const Attribute& attribute) HTMLTextFormControlElement::parseAttribute(attribute); m_inputType->readonlyAttributeChanged(); } -#if ENABLE(DATALIST) - else if (attribute.name() == listAttr) +#if ENABLE(DATALIST_ELEMENT) + else if (attribute.name() == listAttr) { m_hasNonEmptyList = !attribute.isEmpty(); - // FIXME: we need to tell this change to a renderer if the attribute affects the appearance. + if (m_hasNonEmptyList) { + resetListAttributeTargetObserver(); + listAttributeTargetChanged(); + } + } #endif #if ENABLE(INPUT_SPEECH) else if (attribute.name() == webkitspeechAttr) { @@ -1412,6 +1435,9 @@ Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode* HTMLTextFormControlElement::insertedInto(insertionPoint); if (insertionPoint->inDocument() && !form()) addToRadioButtonGroup(); +#if ENABLE(DATALIST_ELEMENT) + resetListAttributeTargetObserver(); +#endif return InsertionDone; } @@ -1420,6 +1446,10 @@ void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) if (insertionPoint->inDocument() && !form()) removeFromRadioButtonGroup(); HTMLTextFormControlElement::removedFrom(insertionPoint); + ASSERT(!inDocument()); +#if ENABLE(DATALIST_ELEMENT) + resetListAttributeTargetObserver(); +#endif } void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) @@ -1468,8 +1498,7 @@ void HTMLInputElement::selectColorInColorChooser(const Color& color) } #endif -#if ENABLE(DATALIST) - +#if ENABLE(DATALIST_ELEMENT) HTMLElement* HTMLInputElement::list() const { return dataList(); @@ -1492,7 +1521,19 @@ HTMLDataListElement* HTMLInputElement::dataList() const return static_cast<HTMLDataListElement*>(element); } -#endif // ENABLE(DATALIST) +void HTMLInputElement::resetListAttributeTargetObserver() +{ + if (inDocument()) + m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fastGetAttribute(listAttr), this); + else + m_listAttributeTargetObserver = nullptr; +} + +void HTMLInputElement::listAttributeTargetChanged() +{ + m_inputType->listAttributeTargetChanged(); +} +#endif // ENABLE(DATALIST_ELEMENT) bool HTMLInputElement::isSteppable() const { @@ -1760,4 +1801,22 @@ void HTMLInputElement::setWidth(unsigned width) setAttribute(widthAttr, String::number(width)); } +#if ENABLE(DATALIST_ELEMENT) +PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(const AtomicString& id, HTMLInputElement* element) +{ + return adoptPtr(new ListAttributeTargetObserver(id, element)); +} + +ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element) + : IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id) + , m_element(element) +{ +} + +void ListAttributeTargetObserver::idTargetChanged() +{ + m_element->listAttributeTargetChanged(); +} +#endif + } // namespace diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 2fd43d863..3fd66c9e4 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -39,6 +39,7 @@ class HTMLOptionElement; class Icon; class InputType; class KURL; +class ListAttributeTargetObserver; class HTMLInputElement : public HTMLTextFormControlElement, public ImageLoaderClientBase<HTMLInputElement> { public: @@ -122,6 +123,7 @@ public: #if ENABLE(INPUT_SPEECH) HTMLElement* speechButtonElement() const; #endif + HTMLElement* sliderThumbElement() const; virtual HTMLElement* placeholderElement() const; bool checked() const { return m_isChecked; } @@ -232,8 +234,9 @@ public: void addSearchResult(); void onSearch(); -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) HTMLElement* list() const; + void listAttributeTargetChanged(); #endif HTMLInputElement* checkedRadioButtonForGroup() const; @@ -359,9 +362,9 @@ private: virtual void subtreeHasChanged(); - -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) HTMLDataListElement* dataList() const; + void resetListAttributeTargetObserver(); #endif void parseMaxLengthAttribute(const Attribute&); void updateValueIfNeeded(); @@ -384,7 +387,7 @@ private: bool m_isActivatedSubmit : 1; unsigned m_autocomplete : 2; // AutoCompleteSetting bool m_isAutofilled : 1; -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) bool m_hasNonEmptyList : 1; #endif bool m_stateRestored : 1; @@ -394,6 +397,9 @@ private: bool m_canReceiveDroppedFiles : 1; bool m_hasTouchEventHandler: 1; OwnPtr<InputType> m_inputType; +#if ENABLE(DATALIST_ELEMENT) + OwnPtr<ListAttributeTargetObserver> m_listAttributeTargetObserver; +#endif }; } //namespace diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index e326ce7be..879a34f57 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -39,7 +39,7 @@ module html { attribute [Reflect] DOMString formTarget; attribute unsigned long height; attribute boolean indeterminate; - readonly attribute [Conditional=DATALIST] HTMLElement list; + readonly attribute [Conditional=DATALIST_ELEMENT] HTMLElement list; attribute [Reflect] DOMString max; attribute long maxLength setter raises(DOMException); attribute [Reflect] DOMString min; diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index a1b032e06..cfe2d8e49 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -136,7 +136,7 @@ bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const HTMLSelectElement* HTMLKeygenElement::shadowSelect() const { - ShadowRoot* root = this->shadow()->oldestShadowRoot(); + ShadowRoot* root = userAgentShadowRoot(); return root ? toHTMLSelectElement(root->firstChild()) : 0; } diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 705a05c5f..f16271bcd 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -1862,20 +1862,14 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) void HTMLMediaElement::createShadowSubtree() { - ASSERT(!shadow() || !shadow()->oldestShadowRoot()); - + ASSERT(!userAgentShadowRoot()); ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); } void HTMLMediaElement::willAddAuthorShadowRoot() { - ASSERT(shadow()); - if (shadow()->oldestShadowRoot()) { - ASSERT(shadow()->oldestShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot); - return; - } - - createShadowSubtree(); + if (!userAgentShadowRoot()) + createShadowSubtree(); } void HTMLMediaElement::rewind(float timeDelta) @@ -4180,17 +4174,18 @@ void HTMLMediaElement::privateBrowsingStateDidChange() MediaControls* HTMLMediaElement::mediaControls() const { - return toMediaControls(shadow()->oldestShadowRoot()->firstChild()); + return toMediaControls(userAgentShadowRoot()->firstChild()); } bool HTMLMediaElement::hasMediaControls() const { - ElementShadow* elementShadow = shadow(); - if (!elementShadow) - return false; + if (ShadowRoot* userAgent = userAgentShadowRoot()) { + Node* node = userAgent->firstChild(); + ASSERT(!node || node->isMediaControls()); + return node; + } - Node* node = elementShadow->oldestShadowRoot()->firstChild(); - return node && node->isMediaControls(); + return false; } bool HTMLMediaElement::createMediaControls() @@ -4211,8 +4206,8 @@ bool HTMLMediaElement::createMediaControls() if (!shadow()) createShadowSubtree(); - ASSERT(shadow()->oldestShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot); - shadow()->oldestShadowRoot()->appendChild(controls, ec); + ASSERT(userAgentShadowRoot()); + userAgentShadowRoot()->appendChild(controls, ec); return true; } diff --git a/Source/WebCore/html/HTMLMeterElement.cpp b/Source/WebCore/html/HTMLMeterElement.cpp index 13dea1513..290de5b07 100644 --- a/Source/WebCore/html/HTMLMeterElement.cpp +++ b/Source/WebCore/html/HTMLMeterElement.cpp @@ -19,9 +19,9 @@ */ #include "config.h" -#if ENABLE(METER_TAG) #include "HTMLMeterElement.h" +#if ENABLE(METER_ELEMENT) #include "Attribute.h" #include "EventNames.h" #include "ExceptionCode.h" diff --git a/Source/WebCore/html/HTMLMeterElement.h b/Source/WebCore/html/HTMLMeterElement.h index bca0be6e6..188309157 100644 --- a/Source/WebCore/html/HTMLMeterElement.h +++ b/Source/WebCore/html/HTMLMeterElement.h @@ -21,7 +21,7 @@ #ifndef HTMLMeterElement_h #define HTMLMeterElement_h -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "LabelableElement.h" namespace WebCore { diff --git a/Source/WebCore/html/HTMLMeterElement.idl b/Source/WebCore/html/HTMLMeterElement.idl index 7c11fe4ce..8d3e1074c 100644 --- a/Source/WebCore/html/HTMLMeterElement.idl +++ b/Source/WebCore/html/HTMLMeterElement.idl @@ -19,7 +19,7 @@ module html { interface [ - Conditional=METER_TAG + Conditional=METER_ELEMENT ] HTMLMeterElement : HTMLElement { attribute double value setter raises(DOMException); diff --git a/Source/WebCore/html/HTMLNameCollection.cpp b/Source/WebCore/html/HTMLNameCollection.cpp index 246235d07..36c7350a4 100644 --- a/Source/WebCore/html/HTMLNameCollection.cpp +++ b/Source/WebCore/html/HTMLNameCollection.cpp @@ -33,7 +33,7 @@ namespace WebCore { using namespace HTMLNames; HTMLNameCollection::HTMLNameCollection(Document* document, CollectionType type, const AtomicString& name) - : HTMLCollection(document, type, DoNotSupportItemBefore) + : HTMLCollection(document, type, OverridesItemAfter) , m_name(name) { } @@ -49,7 +49,7 @@ HTMLNameCollection::~HTMLNameCollection() static_cast<Document*>(base())->removeDocumentNamedItemCache(this, m_name); } -Element* HTMLNameCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +Element* HTMLNameCollection::virtualItemAfter(unsigned& offsetInArray, Element* previous) const { ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(previous != base()); diff --git a/Source/WebCore/html/HTMLNameCollection.h b/Source/WebCore/html/HTMLNameCollection.h index dd9d45d9d..4a7afebb7 100644 --- a/Source/WebCore/html/HTMLNameCollection.h +++ b/Source/WebCore/html/HTMLNameCollection.h @@ -43,7 +43,7 @@ public: private: HTMLNameCollection(Document*, CollectionType, const AtomicString& name); - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; AtomicString m_name; }; diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index 3691e8241..bb68a9d32 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -30,6 +30,7 @@ #include "Attribute.h" #include "Document.h" #include "ExceptionCode.h" +#include "HTMLDataListElement.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "HTMLSelectElement.h" @@ -187,6 +188,12 @@ int HTMLOptionElement::index() const void HTMLOptionElement::parseAttribute(const Attribute& attribute) { +#if ENABLE(DATALIST_ELEMENT) + if (attribute.name() == valueAttr) { + if (HTMLDataListElement* dataList = ownerDataListElement()) + dataList->optionElementChildrenChanged(); + } else +#endif if (attribute.name() == disabledAttr) { bool oldDisabled = m_disabled; m_disabled = !attribute.isNull(); @@ -252,11 +259,27 @@ void HTMLOptionElement::setSelectedState(bool selected) void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { +#if ENABLE(DATALIST_ELEMENT) + if (HTMLDataListElement* dataList = ownerDataListElement()) + dataList->optionElementChildrenChanged(); + else +#endif if (HTMLSelectElement* select = ownerSelectElement()) select->optionElementChildrenChanged(); HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } +#if ENABLE(DATALIST_ELEMENT) +HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const +{ + for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) { + if (parent->hasTagName(datalistTag)) + return static_cast<HTMLDataListElement*>(parent); + } + return 0; +} +#endif + HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const { ContainerNode* select = parentNode(); diff --git a/Source/WebCore/html/HTMLOptionElement.h b/Source/WebCore/html/HTMLOptionElement.h index 247b6c1a9..24cdcdb5e 100644 --- a/Source/WebCore/html/HTMLOptionElement.h +++ b/Source/WebCore/html/HTMLOptionElement.h @@ -29,6 +29,7 @@ namespace WebCore { +class HTMLDataListElement; class HTMLSelectElement; class HTMLOptionElement : public HTMLElement { @@ -49,6 +50,9 @@ public: bool selected(); void setSelected(bool); +#if ENABLE(DATALIST_ELEMENT) + HTMLDataListElement* ownerDataListElement() const; +#endif HTMLSelectElement* ownerSelectElement() const; String label() const; diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp index 960fc8995..8d2aff9e0 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.cpp +++ b/Source/WebCore/html/HTMLOptionsCollection.cpp @@ -28,7 +28,7 @@ namespace WebCore { HTMLOptionsCollection::HTMLOptionsCollection(Element* select) - : HTMLCollection(select, SelectOptions, SupportItemBefore) + : HTMLCollection(select, SelectOptions, DoesNotOverrideItemAfter) { ASSERT(select->hasTagName(HTMLNames::selectTag)); } diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index 4030ee238..742b09ffa 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -19,9 +19,9 @@ */ #include "config.h" -#if ENABLE(PROGRESS_TAG) #include "HTMLProgressElement.h" +#if ENABLE(PROGRESS_ELEMENT) #include "Attribute.h" #include "EventNames.h" #include "ExceptionCode.h" diff --git a/Source/WebCore/html/HTMLProgressElement.h b/Source/WebCore/html/HTMLProgressElement.h index e2e8a270d..72180b93d 100644 --- a/Source/WebCore/html/HTMLProgressElement.h +++ b/Source/WebCore/html/HTMLProgressElement.h @@ -21,7 +21,7 @@ #ifndef HTMLProgressElement_h #define HTMLProgressElement_h -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "LabelableElement.h" namespace WebCore { diff --git a/Source/WebCore/html/HTMLProgressElement.idl b/Source/WebCore/html/HTMLProgressElement.idl index ace4def83..6ad1ab53e 100644 --- a/Source/WebCore/html/HTMLProgressElement.idl +++ b/Source/WebCore/html/HTMLProgressElement.idl @@ -19,7 +19,7 @@ module html { interface [ - Conditional=PROGRESS_TAG + Conditional=PROGRESS_ELEMENT ] HTMLProgressElement : HTMLElement { attribute double value setter raises(DOMException); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.cpp b/Source/WebCore/html/HTMLPropertiesCollection.cpp index c17e7c696..d86bf6c65 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.cpp +++ b/Source/WebCore/html/HTMLPropertiesCollection.cpp @@ -51,7 +51,7 @@ PassRefPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(Node* item } HTMLPropertiesCollection::HTMLPropertiesCollection(Node* itemNode) - : HTMLCollection(itemNode, ItemProperties, DoNotSupportItemBefore) + : HTMLCollection(itemNode, ItemProperties, OverridesItemAfter) , m_hasPropertyNameCache(false) , m_hasItemRefElements(false) { @@ -112,10 +112,10 @@ static Node* nextNodeWithProperty(Node* base, Node* node) ? node->traverseNextNode(base) : node->traverseNextSibling(base); } -Element* HTMLPropertiesCollection::itemAfter(unsigned& offsetInArray, Element* previousItem) const +Element* HTMLPropertiesCollection::virtualItemAfter(unsigned& offsetInArray, Element* previousItem) const { while (offsetInArray < m_itemRefElements.size()) { - if (Element* next = itemAfter(m_itemRefElements[offsetInArray], previousItem)) + if (Element* next = virtualItemAfter(m_itemRefElements[offsetInArray], previousItem)) return next; offsetInArray++; previousItem = 0; @@ -123,7 +123,7 @@ Element* HTMLPropertiesCollection::itemAfter(unsigned& offsetInArray, Element* p return 0; } -HTMLElement* HTMLPropertiesCollection::itemAfter(HTMLElement* base, Element* previous) const +HTMLElement* HTMLPropertiesCollection::virtualItemAfter(HTMLElement* base, Element* previous) const { Node* current; current = previous ? nextNodeWithProperty(base, previous) : base; @@ -149,7 +149,7 @@ void HTMLPropertiesCollection::updateNameCache() const for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { HTMLElement* refElement = m_itemRefElements[i]; - for (HTMLElement* element = itemAfter(refElement, 0); element; element = itemAfter(refElement, element)) { + for (HTMLElement* element = virtualItemAfter(refElement, 0); element; element = virtualItemAfter(refElement, element)) { DOMSettableTokenList* itemProperty = element->itemProp(); for (unsigned propertyIndex = 0; propertyIndex < itemProperty->length(); ++propertyIndex) updatePropertyCache(element, itemProperty->item(propertyIndex)); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.h b/Source/WebCore/html/HTMLPropertiesCollection.h index dba91cac1..29a84ed71 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.h +++ b/Source/WebCore/html/HTMLPropertiesCollection.h @@ -65,8 +65,8 @@ private: Node* findRefElements(Node* previous) const; - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; - HTMLElement* itemAfter(HTMLElement* base, Element* previous) const; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + HTMLElement* virtualItemAfter(HTMLElement* base, Element* previous) const; void updateNameCache() const; diff --git a/Source/WebCore/html/HTMLSummaryElement.cpp b/Source/WebCore/html/HTMLSummaryElement.cpp index 800a0efc2..daf126cfb 100644 --- a/Source/WebCore/html/HTMLSummaryElement.cpp +++ b/Source/WebCore/html/HTMLSummaryElement.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "HTMLSummaryElement.h" -#if ENABLE(DETAILS) - +#if ENABLE(DETAILS_ELEMENT) #include "DetailsMarkerControl.h" #include "ElementShadow.h" #include "HTMLContentElement.h" diff --git a/Source/WebCore/html/HTMLTableRowsCollection.cpp b/Source/WebCore/html/HTMLTableRowsCollection.cpp index 206864ec2..2619f94f1 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.cpp +++ b/Source/WebCore/html/HTMLTableRowsCollection.cpp @@ -152,7 +152,7 @@ HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement* table) // table to get at the collection cache. Order of argument evaluation is undefined and can // differ between compilers. HTMLTableRowsCollection::HTMLTableRowsCollection(Element* table) - : HTMLCollection(table, TableRows, DoNotSupportItemBefore) + : HTMLCollection(table, TableRows, OverridesItemAfter) { ASSERT(table->hasTagName(tableTag)); } @@ -162,7 +162,7 @@ PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(Element* tab return adoptRef(new HTMLTableRowsCollection(table)); } -Element* HTMLTableRowsCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +Element* HTMLTableRowsCollection::virtualItemAfter(unsigned& offsetInArray, Element* previous) const { ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(!previous || (previous->isHTMLElement() && toHTMLElement(previous)->hasLocalName(trTag))); diff --git a/Source/WebCore/html/HTMLTableRowsCollection.h b/Source/WebCore/html/HTMLTableRowsCollection.h index 817b14373..c5068dbac 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.h +++ b/Source/WebCore/html/HTMLTableRowsCollection.h @@ -46,7 +46,7 @@ public: private: HTMLTableRowsCollection(Element*); - virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index 4119ba9b6..c40672863 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -33,10 +33,10 @@ colgroup interfaceName=HTMLTableColElement command interfaceName=HTMLElement content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, contextConditional=shadowDOM webkitShadowContent interfaceName=HTMLElement, noConstructor -datalist interfaceName=HTMLDataListElement, conditional=DATALIST +datalist interfaceName=HTMLDataListElement, conditional=DATALIST_ELEMENT dd interfaceName=HTMLElement del interfaceName=HTMLModElement -details conditional=DETAILS +details conditional=DETAILS_ELEMENT dfn interfaceName=HTMLElement dir interfaceName=HTMLDirectoryElement dialog conditional=DIALOG_ELEMENT, contextConditional=dialogElement @@ -86,7 +86,7 @@ mark interfaceName=HTMLElement marquee menu meta -meter interfaceName=HTMLMeterElement, conditional=METER_TAG +meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT nav interfaceName=HTMLElement nobr interfaceName=HTMLElement noembed interfaceName=HTMLElement @@ -102,7 +102,7 @@ p interfaceName=HTMLParagraphElement param plaintext interfaceName=HTMLElement pre -progress interfaceName=HTMLProgressElement, conditional=PROGRESS_TAG +progress interfaceName=HTMLProgressElement, conditional=PROGRESS_ELEMENT q interfaceName=HTMLQuoteElement rp interfaceName=HTMLElement rt interfaceName=HTMLElement @@ -119,7 +119,7 @@ strike interfaceName=HTMLElement strong interfaceName=HTMLElement style constructorNeedsCreatedByParser sub interfaceName=HTMLElement -summary interfaceName=HTMLSummaryElement, JSInterfaceName=HTMLElement, conditional=DETAILS +summary interfaceName=HTMLSummaryElement, JSInterfaceName=HTMLElement, conditional=DETAILS_ELEMENT sup interfaceName=HTMLElement table tbody interfaceName=HTMLTableSectionElement diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index d07a972c6..bad8571d3 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -294,7 +294,7 @@ String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue, HTMLElement* HTMLTextAreaElement::innerTextElement() const { - Node* node = shadow()->oldestShadowRoot()->firstChild(); + Node* node = userAgentShadowRoot()->firstChild(); ASSERT(!node || node->hasTagName(divTag)); return toHTMLElement(node); } @@ -505,7 +505,7 @@ void HTMLTextAreaElement::updatePlaceholderText() String placeholderText = strippedPlaceholder(); if (placeholderText.isEmpty()) { if (m_placeholder) { - shadow()->oldestShadowRoot()->removeChild(m_placeholder.get(), ec); + userAgentShadowRoot()->removeChild(m_placeholder.get(), ec); ASSERT(!ec); m_placeholder.clear(); } @@ -514,7 +514,7 @@ void HTMLTextAreaElement::updatePlaceholderText() if (!m_placeholder) { m_placeholder = HTMLDivElement::create(document()); m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); - shadow()->oldestShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec); + userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec); ASSERT(!ec); } m_placeholder->setInnerText(placeholderText, ec); diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 4c4586523..d9097c4de 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -453,12 +453,10 @@ void InputType::createShadowSubtree() void InputType::destroyShadowSubtree() { - ElementShadow* shadow = element()->shadow(); - if (!shadow) + ShadowRoot* root = element()->userAgentShadowRoot(); + if (!root) return; - ShadowRoot* root = shadow->oldestShadowRoot(); - ASSERT(root->type() == ShadowRoot::UserAgentShadowRoot); root->removeAllChildren(); // It's ok to clear contents of all other ShadowRoots because they must have @@ -897,6 +895,12 @@ String InputType::defaultToolTip() const return String(); } +#if ENABLE(DATALIST_ELEMENT) +void InputType::listAttributeTargetChanged() +{ +} +#endif + bool InputType::supportsIndeterminateAppearance() const { return false; diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 6c6659a7c..348148b10 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -226,6 +226,7 @@ public: #if ENABLE(INPUT_SPEECH) virtual HTMLElement* speechButtonElement() const { return 0; } #endif + virtual HTMLElement* sliderThumbElement() const { return 0; } virtual HTMLElement* placeholderElement() const; // Miscellaneous functions @@ -275,6 +276,9 @@ public: virtual void disabledAttributeChanged(); virtual void readonlyAttributeChanged(); virtual String defaultToolTip() const; +#if ENABLE(DATALIST_ELEMENT) + virtual void listAttributeTargetChanged(); +#endif // Parses the specified string for the type, and return // the Decimal value for the parsing result if the parsing diff --git a/Source/WebCore/html/LabelsNodeList.cpp b/Source/WebCore/html/LabelsNodeList.cpp index d3a4ba162..3b2b8d3ef 100644 --- a/Source/WebCore/html/LabelsNodeList.cpp +++ b/Source/WebCore/html/LabelsNodeList.cpp @@ -34,7 +34,7 @@ namespace WebCore { using namespace HTMLNames; LabelsNodeList::LabelsNodeList(Node* forNode) - : DynamicSubtreeNodeList(forNode, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) + : DynamicSubtreeNodeList(forNode, LabelsNodeListType, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) { } diff --git a/Source/WebCore/html/RadioNodeList.cpp b/Source/WebCore/html/RadioNodeList.cpp index bd3cc87b5..944f7b40d 100644 --- a/Source/WebCore/html/RadioNodeList.cpp +++ b/Source/WebCore/html/RadioNodeList.cpp @@ -38,7 +38,7 @@ namespace WebCore { using namespace HTMLNames; RadioNodeList::RadioNodeList(Node* rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) + : DynamicSubtreeNodeList(rootNode, RadioNodeListType, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) , m_name(name) { } diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp index 10c7576bf..901a9acc1 100644 --- a/Source/WebCore/html/RangeInputType.cpp +++ b/Source/WebCore/html/RangeInputType.cpp @@ -96,6 +96,11 @@ void RangeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBe element()->setValue(serialize(newValue), eventBehavior); } +bool RangeInputType::typeMismatchFor(const String& value) const +{ + return !value.isEmpty() && !isfinite(parseToDoubleForNumberType(value)); +} + bool RangeInputType::supportsRequired() const { return false; @@ -132,7 +137,7 @@ void RangeInputType::handleMouseDownEvent(MouseEvent* event) if (event->button() != LeftButton || !targetNode) return; ASSERT(element()->shadow()); - if (targetNode != element() && !targetNode->isDescendantOf(element()->shadow()->oldestShadowRoot())) + if (targetNode != element() && !targetNode->isDescendantOf(element()->userAgentShadowRoot())) return; SliderThumbElement* thumb = sliderThumbElementOf(element()); if (targetNode == thumb) @@ -239,7 +244,7 @@ void RangeInputType::createShadowSubtree() RefPtr<HTMLElement> container = SliderContainerElement::create(document); container->appendChild(track.release(), ec); container->appendChild(TrackLimiterElement::create(document), ec); - element()->shadow()->oldestShadowRoot()->appendChild(container.release(), ec); + element()->userAgentShadowRoot()->appendChild(container.release(), ec); } RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) const @@ -306,4 +311,16 @@ bool RangeInputType::shouldRespectListAttribute() return InputType::themeSupportsDataListUI(this); } +HTMLElement* RangeInputType::sliderThumbElement() const +{ + return sliderThumbElementOf(element()); +} + +#if ENABLE(DATALIST_ELEMENT) +void RangeInputType::listAttributeTargetChanged() +{ + element()->setNeedsStyleRecalc(); +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h index 0983b3d57..69d2ec7c6 100644 --- a/Source/WebCore/html/RangeInputType.h +++ b/Source/WebCore/html/RangeInputType.h @@ -47,6 +47,7 @@ private: virtual const AtomicString& formControlType() const OVERRIDE; virtual double valueAsDouble() const OVERRIDE; virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE; + virtual bool typeMismatchFor(const String&) const OVERRIDE; virtual bool supportsRequired() const OVERRIDE; virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE; virtual bool isSteppable() const OVERRIDE; @@ -68,6 +69,10 @@ private: virtual String fallbackValue() const OVERRIDE; virtual String sanitizeValue(const String& proposedValue) const OVERRIDE; virtual bool shouldRespectListAttribute() OVERRIDE; + virtual HTMLElement* sliderThumbElement() const OVERRIDE; +#if ENABLE(DATALIST_ELEMENT) + virtual void listAttributeTargetChanged() OVERRIDE; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp index 632816be7..10ed8fb0a 100644 --- a/Source/WebCore/html/TextFieldInputType.cpp +++ b/Source/WebCore/html/TextFieldInputType.cpp @@ -246,11 +246,11 @@ void TextFieldInputType::createShadowSubtree() ExceptionCode ec = 0; m_innerText = TextControlInnerTextElement::create(document); if (!createsContainer) { - element()->shadow()->oldestShadowRoot()->appendChild(m_innerText, ec); + element()->userAgentShadowRoot()->appendChild(m_innerText, ec); return; } - ShadowRoot* shadowRoot = element()->shadow()->oldestShadowRoot(); + ShadowRoot* shadowRoot = element()->userAgentShadowRoot(); m_container = HTMLDivElement::create(document); m_container->setShadowPseudoId("-webkit-textfield-decoration-container"); shadowRoot->appendChild(m_container, ec); @@ -417,7 +417,7 @@ void TextFieldInputType::updatePlaceholderText() if (!m_placeholder) { m_placeholder = HTMLDivElement::create(element()->document()); m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); - element()->shadow()->oldestShadowRoot()->insertBefore(m_placeholder, m_container ? m_container->nextSibling() : innerTextElement()->nextSibling(), ec); + element()->userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container->nextSibling() : innerTextElement()->nextSibling(), ec); ASSERT(!ec); } m_placeholder->setInnerText(placeholderText, ec); diff --git a/Source/WebCore/html/ValidationMessage.cpp b/Source/WebCore/html/ValidationMessage.cpp index b63d8837d..1901f46ce 100644 --- a/Source/WebCore/html/ValidationMessage.cpp +++ b/Source/WebCore/html/ValidationMessage.cpp @@ -196,7 +196,7 @@ void ValidationMessage::deleteBubbleTree(Timer<ValidationMessage>*) m_messageBody = 0; HTMLElement* host = toHTMLElement(m_element); ExceptionCode ec; - host->shadow()->oldestShadowRoot()->removeChild(m_bubble.get(), ec); + host->userAgentShadowRoot()->removeChild(m_bubble.get(), ec); m_bubble = 0; } m_message = String(); diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index 4da7a7ae9..9454f5fd9 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -220,8 +220,6 @@ void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken& void HTMLConstructionSite::insertHTMLHtmlStartTagInBody(AtomicHTMLToken& token) { - // FIXME: parse error - // Fragments do not have a root HTML element, so any additional HTML elements // encountered during fragment parsing should be ignored. if (m_isParsingFragment) @@ -232,7 +230,6 @@ void HTMLConstructionSite::insertHTMLHtmlStartTagInBody(AtomicHTMLToken& token) void HTMLConstructionSite::insertHTMLBodyStartTagInBody(AtomicHTMLToken& token) { - // FIXME: parse error mergeAttributesFromTokenIntoElement(token, m_openElements.bodyElement()); } diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 803b0e7d3..6a2b0e770 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -346,11 +346,10 @@ private: }; -HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks, unsigned maximumDOMTreeDepth) +HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, HTMLDocument* document, bool, bool usePreHTML5ParserQuirks, unsigned maximumDOMTreeDepth) : m_framesetOk(true) , m_document(document) , m_tree(document, maximumDOMTreeDepth) - , m_reportErrors(reportErrors) , m_insertionMode(InitialMode) , m_originalInsertionMode(InitialMode) , m_shouldSkipLeadingNewline(false) @@ -367,7 +366,6 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f , m_fragmentContext(fragment, contextElement, scriptingPermission) , m_document(fragment->document()) , m_tree(fragment, scriptingPermission, maximumDOMTreeDepth) - , m_reportErrors(false) // FIXME: Why not report errors in fragments? , m_insertionMode(InitialMode) , m_originalInsertionMode(InitialMode) , m_shouldSkipLeadingNewline(false) @@ -729,7 +727,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::StartTag); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == baseTag @@ -1142,7 +1140,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case BeforeHeadMode: ASSERT(insertionMode() == BeforeHeadMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == headTag) { @@ -1161,7 +1159,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case AfterHeadMode: ASSERT(insertionMode() == AfterHeadMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == bodyTag) { @@ -1224,7 +1222,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InColumnGroupMode: ASSERT(insertionMode() == InColumnGroupMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == colTag) { @@ -1311,7 +1309,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case AfterAfterBodyMode: ASSERT(insertionMode() == AfterBodyMode || insertionMode() == AfterAfterBodyMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } setInsertionMode(InBodyMode); @@ -1320,7 +1318,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InHeadNoscriptMode: ASSERT(insertionMode() == InHeadNoscriptMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == basefontTag @@ -1343,7 +1341,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InFramesetMode: ASSERT(insertionMode() == InFramesetMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == framesetTag) { @@ -1364,7 +1362,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case AfterAfterFramesetMode: ASSERT(insertionMode() == AfterFramesetMode || insertionMode() == AfterAfterFramesetMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == noframesTag) { @@ -1390,7 +1388,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) case InSelectMode: ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return; } if (token.name() == optionTag) { @@ -1448,6 +1446,12 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token) } } +void HTMLTreeBuilder::processHtmlStartTagForInBody(AtomicHTMLToken& token) +{ + parseError(token); + m_tree.insertHTMLHtmlStartTagInBody(token); +} + bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::EndTag); @@ -1964,6 +1968,7 @@ void HTMLTreeBuilder::processEndTagForInTable(AtomicHTMLToken& token) parseError(token); return; } + parseError(token); // Is this redirection necessary here? HTMLConstructionSite::RedirectToFosterParentGuard redirecter(m_tree); processEndTagForInBody(token); @@ -2558,7 +2563,7 @@ bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::StartTag); if (token.name() == htmlTag) { - m_tree.insertHTMLHtmlStartTagInBody(token); + processHtmlStartTagForInBody(token); return true; } if (token.name() == baseTag diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.h b/Source/WebCore/html/parser/HTMLTreeBuilder.h index e7c689084..192884e5b 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.h +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.h @@ -137,6 +137,7 @@ private: void processEndTagForInCell(AtomicHTMLToken&); void processIsindexStartTagForInBody(AtomicHTMLToken&); + void processHtmlStartTagForInBody(AtomicHTMLToken&); bool processBodyEndTagForInBody(AtomicHTMLToken&); bool processTableEndTagForInTable(); bool processCaptionEndTagForInCaption(); @@ -213,8 +214,6 @@ private: Document* m_document; HTMLConstructionSite m_tree; - bool m_reportErrors; - // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#insertion-mode InsertionMode m_insertionMode; diff --git a/Source/WebCore/html/shadow/CalendarPickerElement.cpp b/Source/WebCore/html/shadow/CalendarPickerElement.cpp index b4176b296..ea9fbb7b3 100644 --- a/Source/WebCore/html/shadow/CalendarPickerElement.cpp +++ b/Source/WebCore/html/shadow/CalendarPickerElement.cpp @@ -81,9 +81,11 @@ RenderObject* CalendarPickerElement::createRenderer(RenderArena* arena, RenderSt inline HTMLInputElement* CalendarPickerElement::hostInput() { - ASSERT(shadowAncestorNode()); - ASSERT(shadowAncestorNode()->hasTagName(inputTag)); - return static_cast<HTMLInputElement*>(shadowAncestorNode()); + // JavaScript code can't create CalendarPickerElement objects. This is + // always in shadow of <input>. + ASSERT(shadowHost()); + ASSERT(shadowHost()->hasTagName(inputTag)); + return static_cast<HTMLInputElement*>(shadowHost()); } void CalendarPickerElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/shadow/DetailsMarkerControl.cpp b/Source/WebCore/html/shadow/DetailsMarkerControl.cpp index d4fddd30f..b3be3c45c 100644 --- a/Source/WebCore/html/shadow/DetailsMarkerControl.cpp +++ b/Source/WebCore/html/shadow/DetailsMarkerControl.cpp @@ -31,8 +31,7 @@ #include "config.h" #include "DetailsMarkerControl.h" -#if ENABLE(DETAILS) - +#if ENABLE(DETAILS_ELEMENT) #include "HTMLNames.h" #include "HTMLSummaryElement.h" #include "RenderDetailsMarker.h" diff --git a/Source/WebCore/html/shadow/ImageInnerElement.cpp b/Source/WebCore/html/shadow/ImageInnerElement.cpp index 4ca44e9c1..b23d6b1a5 100644 --- a/Source/WebCore/html/shadow/ImageInnerElement.cpp +++ b/Source/WebCore/html/shadow/ImageInnerElement.cpp @@ -68,4 +68,10 @@ RenderObject* ImageInnerElement::createRenderer(RenderArena* arena, RenderStyle* return createRendererForImage(this, arena); } +const AtomicString& ImageInnerElement::shadowPseudoId() const +{ + DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-image-inner-element")); + return pseudoId; +} + } diff --git a/Source/WebCore/html/shadow/ImageInnerElement.h b/Source/WebCore/html/shadow/ImageInnerElement.h index 2586306e5..3d61b239e 100644 --- a/Source/WebCore/html/shadow/ImageInnerElement.h +++ b/Source/WebCore/html/shadow/ImageInnerElement.h @@ -53,6 +53,8 @@ private: virtual void attach() OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; + + virtual const AtomicString& shadowPseudoId() const OVERRIDE; }; inline PassRefPtr<ImageInnerElement> ImageInnerElement::create(Document* document) diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp index 9edbd8ad3..9f0e8c62e 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp @@ -80,7 +80,6 @@ MediaControlRootElementChromium::MediaControlRootElementChromium(Document* docum #if ENABLE(VIDEO_TRACK) , m_textDisplayContainer(0) #endif - , m_opaque(true) , m_hideFullscreenControlsTimer(this, &MediaControlRootElementChromium::hideFullscreenControlsTimerFired) , m_isMouseOverControls(false) , m_isFullscreen(false) @@ -245,7 +244,7 @@ void MediaControlRootElementChromium::reset() } } - if (m_mediaController->supportsFullscreen()) + if (m_mediaController->supportsFullscreen() && m_mediaController->hasVideo()) m_fullscreenButton->show(); else m_fullscreenButton->hide(); diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h index f86bc615a..2fb4c3cfe 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h @@ -149,7 +149,6 @@ private: MediaControlTextTrackContainerElement* m_textDisplayContainer; #endif - bool m_opaque; Timer<MediaControlRootElementChromium> m_hideFullscreenControlsTimer; bool m_isMouseOverControls; bool m_isFullscreen; diff --git a/Source/WebCore/html/shadow/MeterShadowElement.cpp b/Source/WebCore/html/shadow/MeterShadowElement.cpp index bc5ea6295..2d4d84481 100644 --- a/Source/WebCore/html/shadow/MeterShadowElement.cpp +++ b/Source/WebCore/html/shadow/MeterShadowElement.cpp @@ -29,9 +29,9 @@ */ #include "config.h" -#if ENABLE(METER_TAG) #include "MeterShadowElement.h" +#if ENABLE(METER_ELEMENT) #include "CSSPropertyNames.h" #include "HTMLMeterElement.h" #include "HTMLNames.h" diff --git a/Source/WebCore/html/shadow/MeterShadowElement.h b/Source/WebCore/html/shadow/MeterShadowElement.h index c36b01b24..6b8bf62ae 100644 --- a/Source/WebCore/html/shadow/MeterShadowElement.h +++ b/Source/WebCore/html/shadow/MeterShadowElement.h @@ -31,6 +31,7 @@ #ifndef MeterShadowElement_h #define MeterShadowElement_h +#if ENABLE(METER_ELEMENT) #include "HTMLDivElement.h" #include <wtf/Forward.h> @@ -82,5 +83,5 @@ inline PassRefPtr<MeterValueElement> MeterValueElement::create(Document* documen } } - -#endif +#endif // ENABLE(METER_ELEMENT) +#endif // MeterShadowElement_h diff --git a/Source/WebCore/html/shadow/ProgressShadowElement.cpp b/Source/WebCore/html/shadow/ProgressShadowElement.cpp index 548571302..780815212 100644 --- a/Source/WebCore/html/shadow/ProgressShadowElement.cpp +++ b/Source/WebCore/html/shadow/ProgressShadowElement.cpp @@ -29,9 +29,9 @@ */ #include "config.h" -#if ENABLE(PROGRESS_TAG) #include "ProgressShadowElement.h" +#if ENABLE(PROGRESS_ELEMENT) #include "HTMLNames.h" #include "HTMLProgressElement.h" #include "RenderObject.h" @@ -78,4 +78,3 @@ void ProgressValueElement::setWidthPercentage(double width) } #endif - diff --git a/Source/WebCore/html/shadow/ProgressShadowElement.h b/Source/WebCore/html/shadow/ProgressShadowElement.h index e135c71da..aff94fba3 100644 --- a/Source/WebCore/html/shadow/ProgressShadowElement.h +++ b/Source/WebCore/html/shadow/ProgressShadowElement.h @@ -32,6 +32,7 @@ #ifndef ProgressShadowElement_h #define ProgressShadowElement_h +#if ENABLE(PROGRESS_ELEMENT) #include "HTMLDivElement.h" #include <wtf/Forward.h> @@ -83,5 +84,5 @@ inline PassRefPtr<ProgressValueElement> ProgressValueElement::create(Document* d } } - -#endif +#endif // ENABLE(PROGRESS_ELEMENT) +#endif // ProgressShadowElement_h diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index 0186fa57d..bb5948690 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -74,7 +74,7 @@ inline static bool hasVerticalAppearance(HTMLInputElement* input) SliderThumbElement* sliderThumbElementOf(Node* node) { ASSERT(node); - ShadowRoot* shadow = node->toInputElement()->shadow()->oldestShadowRoot(); + ShadowRoot* shadow = node->toInputElement()->userAgentShadowRoot(); ASSERT(shadow); Node* thumb = shadow->firstChild()->firstChild()->firstChild(); ASSERT(thumb); @@ -148,19 +148,38 @@ void RenderSliderContainer::layout() // Sets the concrete height if the height of the <input> is not fixed or a // percentage value because a percentage height value of this box won't be // based on the <input> height in such case. - Length inputHeight = input->renderer()->style()->height(); - RenderObject* trackRenderer = node()->firstChild()->renderer(); - if (!isVertical && input->renderer()->isSlider() && !inputHeight.isFixed() && !inputHeight.isPercent()) { - RenderObject* thumbRenderer = input->shadow()->oldestShadowRoot()->firstChild()->firstChild()->firstChild()->renderer(); - if (thumbRenderer) { - style()->setHeight(thumbRenderer->style()->height()); - if (trackRenderer) - trackRenderer->style()->setHeight(thumbRenderer->style()->height()); + if (input->renderer()->isSlider()) { + if (!isVertical) { + RenderObject* trackRenderer = node()->firstChild()->renderer(); + Length inputHeight = input->renderer()->style()->height(); + if (!inputHeight.isSpecified()) { + RenderObject* thumbRenderer = input->sliderThumbElement()->renderer(); + if (thumbRenderer) { + Length height = thumbRenderer->style()->height(); +#if ENABLE(DATALIST_ELEMENT) + if (input && input->list()) { + int offsetFromCenter = theme()->sliderTickOffsetFromTrackCenter(); + int trackHeight = 0; + if (offsetFromCenter < 0) + trackHeight = -2 * offsetFromCenter; + else { + int tickLength = theme()->sliderTickSize().height(); + trackHeight = 2 * (offsetFromCenter + tickLength); + } + float zoomFactor = style()->effectiveZoom(); + if (zoomFactor != 1.0) + trackHeight *= zoomFactor; + height = Length(trackHeight, Fixed); + } +#endif + style()->setHeight(height); + } + } else { + style()->setHeight(Length(100, Percent)); + if (trackRenderer) + trackRenderer->style()->setHeight(Length()); + } } - } else { - style()->setHeight(Length(100, Percent)); - if (trackRenderer) - trackRenderer->style()->setHeight(Length()); } RenderDeprecatedFlexibleBox::layout(); @@ -405,8 +424,7 @@ const AtomicString& TrackLimiterElement::shadowPseudoId() const TrackLimiterElement* trackLimiterElementOf(Node* node) { ASSERT(node); - ASSERT(node->toInputElement()->shadow()); - ShadowRoot* shadow = node->toInputElement()->shadow()->oldestShadowRoot(); + ShadowRoot* shadow = node->toInputElement()->userAgentShadowRoot(); ASSERT(shadow); Node* limiter = shadow->firstChild()->lastChild(); ASSERT(limiter); diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp index 9423aa8d2..09cc7b1d4 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp @@ -116,9 +116,10 @@ void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible) inline HTMLInputElement* TextFieldDecorationElement::hostInput() { - ASSERT(shadowAncestorNode()); - ASSERT(shadowAncestorNode()->hasTagName(inputTag)); - return static_cast<HTMLInputElement*>(shadowAncestorNode()); + // TextFieldDecorationElement is created only by C++ code, and it is always + // in <input> shadow. + ASSERT(!shadowHost() || shadowHost()->hasTagName(inputTag)); + return static_cast<HTMLInputElement*>(shadowHost()); } bool TextFieldDecorationElement::isTextFieldDecoration() const @@ -181,7 +182,7 @@ bool TextFieldDecorationElement::isMouseFocusable() const void TextFieldDecorationElement::defaultEventHandler(Event* event) { RefPtr<HTMLInputElement> input(hostInput()); - if (input->disabled() || input->readOnly() || !event->isMouseEvent()) { + if (!input || input->disabled() || input->readOnly() || !event->isMouseEvent()) { if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); return; diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index b3a5f4151..ec3812b16 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -2953,18 +2953,45 @@ def flatten_list(input): return res +# A writer that only updates file if it actually changed to better support incremental build. +class SmartOutput: + def __init__(self, file_name): + self.file_name_ = file_name + self.output_ = "" + + def write(self, text): + self.output_ += text + + def close(self): + text_changed = True + + try: + read_file = open(self.file_name_, "r") + old_text = read_file.read() + read_file.close() + text_changed = old_text != self.output_ + except: + # Ignore, just overwrite by default + pass + + if text_changed: + out_file = open(self.file_name_, "w") + out_file.write(self.output_) + out_file.close() + + Generator.go() -backend_h_file = open(output_header_dirname + "/InspectorBackendDispatcher.h", "w") -backend_cpp_file = open(output_cpp_dirname + "/InspectorBackendDispatcher.cpp", "w") +backend_h_file = SmartOutput(output_header_dirname + "/InspectorBackendDispatcher.h") +backend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorBackendDispatcher.cpp") -frontend_h_file = open(output_header_dirname + "/InspectorFrontend.h", "w") -frontend_cpp_file = open(output_cpp_dirname + "/InspectorFrontend.cpp", "w") +frontend_h_file = SmartOutput(output_header_dirname + "/InspectorFrontend.h") +frontend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorFrontend.cpp") -typebuilder_h_file = open(output_header_dirname + "/InspectorTypeBuilder.h", "w") -typebuilder_cpp_file = open(output_cpp_dirname + "/InspectorTypeBuilder.cpp", "w") +typebuilder_h_file = SmartOutput(output_header_dirname + "/InspectorTypeBuilder.h") +typebuilder_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorTypeBuilder.cpp") -backend_js_file = open(output_cpp_dirname + "/InspectorBackendCommands.js", "w") +backend_js_file = SmartOutput(output_cpp_dirname + "/InspectorBackendCommands.js") backend_h_file.write(Templates.backend_h.substitute(None, @@ -3007,4 +3034,7 @@ backend_cpp_file.close() frontend_h_file.close() frontend_cpp_file.close() +typebuilder_h_file.close() +typebuilder_cpp_file.close() + backend_js_file.close() diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.cpp b/Source/WebCore/inspector/DOMNodeHighlighter.cpp index e4c7100d6..46c99cf3d 100644 --- a/Source/WebCore/inspector/DOMNodeHighlighter.cpp +++ b/Source/WebCore/inspector/DOMNodeHighlighter.cpp @@ -39,6 +39,7 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "GraphicsTypes.h" +#include "InspectorClient.h" #include "Node.h" #include "Page.h" #include "Range.h" @@ -462,9 +463,9 @@ static void getOrDrawNodeHighlight(GraphicsContext* context, HighlightData* high drawElementTitle(*context, node, renderer, pixelSnappedIntRect(boundingBox), pixelSnappedIntRect(titleAnchorBox), visibleRect, containingFrame->settings()); } -static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, HighlightData* highlightData, Highlight *highlight) +static void getOrDrawRectHighlight(GraphicsContext* context, Page* page, HighlightData* highlightData, Highlight *highlight) { - if (!document) + if (!page) return; FloatRect highlightRect(*(highlightData->rect)); @@ -473,7 +474,7 @@ static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, highlight->quads.append(highlightRect); if (context) { - FrameView* view = document->frame()->view(); + FrameView* view = page->mainFrame()->view(); if (!view->delegatesScrolling()) { FloatRect visibleRect = view->visibleContentRect(); context->translate(-visibleRect.x(), -visibleRect.y()); @@ -485,44 +486,132 @@ static void getOrDrawRectHighlight(GraphicsContext* context, Document* document, } // anonymous namespace -namespace DOMNodeHighlighter { +InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client) + : m_page(page) + , m_client(client) +{ +} -void drawHighlight(GraphicsContext& context, Document* document, HighlightData* highlightData) +void InspectorOverlay::paint(GraphicsContext& context) { - if (!highlightData) - return; + drawPausedInDebugger(context); + drawHighlight(context); +} - Highlight highlight; - if (highlightData->node) - getOrDrawNodeHighlight(&context, highlightData, &highlight); - else if (highlightData->rect) - getOrDrawRectHighlight(&context, document, highlightData, &highlight); +void InspectorOverlay::drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color) +{ + FloatRect outlineRect = rect; + drawOutlinedQuad(context, outlineRect, Color(), color); } -void getHighlight(Document* document, HighlightData* highlightData, Highlight* highlight) +void InspectorOverlay::getHighlight(Highlight* highlight) const { - if (!highlightData) + if (!m_highlightData) return; - highlight->contentColor = highlightData->content; - highlight->paddingColor = highlightData->padding; - highlight->borderColor = highlightData->border; - highlight->marginColor = highlightData->margin; + highlight->contentColor = m_highlightData->content; + highlight->paddingColor = m_highlightData->padding; + highlight->borderColor = m_highlightData->border; + highlight->marginColor = m_highlightData->margin; highlight->type = HighlightTypeRects; - if (highlightData->node) - getOrDrawNodeHighlight(0, highlightData, highlight); - else if (highlightData->rect) - getOrDrawRectHighlight(0, document, highlightData, highlight); + if (m_highlightData->node) + getOrDrawNodeHighlight(0, m_highlightData.get(), highlight); + else if (m_highlightData->rect) + getOrDrawRectHighlight(0, m_page, m_highlightData.get(), highlight); } -void drawOutline(GraphicsContext& context, const LayoutRect& rect, const Color& color) +void InspectorOverlay::setPausedInDebuggerMessage(const String* message) { - FloatRect outlineRect = rect; - drawOutlinedQuad(context, outlineRect, Color(), color); + m_pausedInDebuggerMessage = message ? *message : String(); + update(); } -} // namespace DOMNodeHighlighter +void InspectorOverlay::hideHighlight() +{ + if (m_highlightData) { + // FIXME: Clear entire highlight data here, store config upon setInspectModeEnabled + m_highlightData->rect.clear(); + m_highlightData->node.clear(); + } + update(); +} + +void InspectorOverlay::highlightNode(Node* node) +{ + if (m_highlightData) + m_highlightData->node = node; + update(); +} + +void InspectorOverlay::setHighlightData(PassOwnPtr<HighlightData> highlightData) +{ + m_highlightData = highlightData; + update(); +} + +void InspectorOverlay::clearHighlightData() +{ + m_highlightData.clear(); + update(); +} + +Node* InspectorOverlay::highlightedNode() const +{ + return m_highlightData ? m_highlightData->node.get() : 0; +} + +void InspectorOverlay::update() +{ + if (m_highlightData || !m_pausedInDebuggerMessage.isNull()) + m_client->highlight(); + else + m_client->hideHighlight(); +} + +void InspectorOverlay::drawHighlight(GraphicsContext& context) +{ + if (!m_highlightData || (!m_highlightData->rect && !m_highlightData->node)) + return; + + Highlight highlight; + if (m_highlightData->node) + getOrDrawNodeHighlight(&context, m_highlightData.get(), &highlight); + else if (m_highlightData->rect) + getOrDrawRectHighlight(&context, m_page, m_highlightData.get(), &highlight); +} + +void InspectorOverlay::drawPausedInDebugger(GraphicsContext& context) +{ + if (m_pausedInDebuggerMessage.isNull()) + return; + + DEFINE_STATIC_LOCAL(Color, backgroundColor, (0, 0, 0, 31)); + DEFINE_STATIC_LOCAL(Color, textBackgroundColor, (255, 255, 194)); + DEFINE_STATIC_LOCAL(Color, borderColor, (128, 128, 128)); + + Frame* frame = m_page->mainFrame(); + Settings* settings = frame->settings(); + IntRect visibleRect = frame->view()->visibleContentRect(); + + context.setFillColor(backgroundColor, ColorSpaceDeviceRGB); + context.fillRect(visibleRect); + + FontDescription desc; + setUpFontDescription(desc, settings); + Font font = Font(desc, 0, 0); + font.update(0); + + TextRun textRun(m_pausedInDebuggerMessage); + IntRect titleRect = enclosingIntRect(font.selectionRectForText(textRun, IntPoint(), fontHeightPx)); + titleRect.inflate(rectInflatePx); + titleRect.setLocation(IntPoint(visibleRect.width() / 2 - titleRect.width() / 2, 0)); + + context.setFillColor(textBackgroundColor, ColorSpaceDeviceRGB); + context.setStrokeColor(borderColor, ColorSpaceDeviceRGB); + context.drawRect(titleRect); + drawSubstring(textRun, 0, m_pausedInDebuggerMessage.length(), Color::black, font, context, titleRect); +} } // namespace WebCore diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.h b/Source/WebCore/inspector/DOMNodeHighlighter.h index f7b6f00f4..a200ccc9b 100644 --- a/Source/WebCore/inspector/DOMNodeHighlighter.h +++ b/Source/WebCore/inspector/DOMNodeHighlighter.h @@ -32,18 +32,21 @@ #include "Color.h" #include "FloatQuad.h" #include "LayoutTypes.h" +#include "Node.h" #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> namespace WebCore { class Color; -class Document; -class FrameView; class GraphicsContext; +class InspectorClient; +class IntRect; class Node; +class Page; struct HighlightData { Color content; @@ -75,13 +78,38 @@ struct Highlight { Vector<FloatQuad> quads; }; -namespace DOMNodeHighlighter { +class InspectorOverlay { +public: + static PassOwnPtr<InspectorOverlay> create(Page* page, InspectorClient* client) + { + return adoptPtr(new InspectorOverlay(page, client)); + } -void drawHighlight(GraphicsContext&, Document*, HighlightData*); -void getHighlight(Document*, HighlightData*, Highlight*); -void drawOutline(GraphicsContext&, const LayoutRect&, const Color&); + void paint(GraphicsContext&); + void drawOutline(GraphicsContext&, const LayoutRect&, const Color&); + void getHighlight(Highlight*) const; -} // namespace DOMNodeHighlighter + void setPausedInDebuggerMessage(const String*); + + void hideHighlight(); + void highlightNode(Node*); + void setHighlightData(PassOwnPtr<HighlightData>); + void clearHighlightData(); + + Node* highlightedNode() const; + +private: + InspectorOverlay(Page*, InspectorClient*); + + void update(); + void drawHighlight(GraphicsContext&); + void drawPausedInDebugger(GraphicsContext&); + + Page* m_page; + InspectorClient* m_client; + String m_pausedInDebuggerMessage; + OwnPtr<HighlightData> m_highlightData; +}; } // namespace WebCore diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp index 59858d977..e49f993d3 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.cpp +++ b/Source/WebCore/inspector/InjectedScriptHost.cpp @@ -77,7 +77,6 @@ InjectedScriptHost::InjectedScriptHost() #endif , m_domStorageAgent(0) , m_domAgent(0) - , m_lastWorkerId(1 << 31) // Distinguish ids of fake workers from real ones, to minimize the chances they overlap. { m_defaultInspectableObject = adoptPtr(new InspectableObject()); } @@ -164,25 +163,6 @@ String InjectedScriptHost::storageIdImpl(Storage* storage) return String(); } -#if ENABLE(WORKERS) -long InjectedScriptHost::nextWorkerId() -{ - return ++m_lastWorkerId; -} - -void InjectedScriptHost::didCreateWorker(long id, const String& url, bool isSharedWorker) -{ - if (m_inspectorAgent) - m_inspectorAgent->didCreateWorker(static_cast<int>(id), url, isSharedWorker); -} - -void InjectedScriptHost::didDestroyWorker(long id) -{ - if (m_inspectorAgent) - m_inspectorAgent->didDestroyWorker(static_cast<int>(id)); -} -#endif // ENABLE(WORKERS) - #if ENABLE(JAVASCRIPT_DEBUGGER) ScriptDebugServer& InjectedScriptHost::scriptDebugServer() { diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h index 4e9a82102..ab50fb939 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.h +++ b/Source/WebCore/inspector/InjectedScriptHost.h @@ -109,11 +109,6 @@ public: String databaseIdImpl(Database*); #endif String storageIdImpl(Storage*); -#if ENABLE(WORKERS) - long nextWorkerId(); - void didCreateWorker(long id, const String& url, bool isSharedWorker); - void didDestroyWorker(long id); -#endif #if ENABLE(JAVASCRIPT_DEBUGGER) ScriptDebugServer& scriptDebugServer(); @@ -132,7 +127,6 @@ private: #if ENABLE(JAVASCRIPT_DEBUGGER) InspectorDebuggerAgent* m_debuggerAgent; #endif - long m_lastWorkerId; Vector<OwnPtr<InspectableObject> > m_inspectedObjects; OwnPtr<InspectableObject> m_defaultInspectableObject; }; diff --git a/Source/WebCore/inspector/InjectedScriptHost.idl b/Source/WebCore/inspector/InjectedScriptHost.idl index 54f080f2c..71b88b137 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.idl +++ b/Source/WebCore/inspector/InjectedScriptHost.idl @@ -47,11 +47,6 @@ module core { [Custom] DOMString databaseId(in DOMObject database); [Custom] DOMString storageId(in DOMObject storage); - -#if defined(ENABLE_WORKERS) && ENABLE_WORKERS - void didCreateWorker(in long id, in DOMString url, in boolean isFakeWorker); - void didDestroyWorker(in long id); - long nextWorkerId(); -#endif }; } + diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index d178d9d2d..7176abb8c 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -28,20 +28,6 @@ { "name": "object", "$ref": "Runtime.RemoteObject" }, { "name": "hints", "type": "object" } ] - }, - { - "name": "didCreateWorker", - "parameters": [ - { "name": "id", "type": "integer" }, - { "name": "url", "type": "string" }, - { "name": "isShared", "type": "boolean" } - ] - }, - { - "name": "didDestroyWorker", - "parameters": [ - { "name": "id", "type": "integer" } - ] } ] }, @@ -2287,6 +2273,17 @@ "returns": [ { "name": "profile", "$ref": "SelectorProfile" } ] + }, + { + "name": "getNamedFlowCollection", + "parameters": [ + { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection."} + ], + "returns": [ + { "name": "namedFlows", "type": "array", "items": { "type": "string" }, "description": "An array containing the Named Flows in the document." } + ], + "description": "Returns the Named Flows from the document.", + "hidden": true } ], "events": [ @@ -2630,6 +2627,14 @@ { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the script run." } ], "description": "Runs script with given id in a given context." + }, + { + "name": "setOverlayMessage", + "parameters": [ + { "name": "message", "type": "string", "optional": true, "description": "Overlay message to display when paused in debugger." } + ], + "hidden": true, + "description": "Sets overlay message." } ], "events": [ diff --git a/Source/WebCore/inspector/InspectorAgent.cpp b/Source/WebCore/inspector/InspectorAgent.cpp index b3aa3bcf6..5c28ca778 100644 --- a/Source/WebCore/inspector/InspectorAgent.cpp +++ b/Source/WebCore/inspector/InspectorAgent.cpp @@ -45,7 +45,6 @@ #include "InspectorInstrumentation.h" #include "InspectorState.h" #include "InspectorValues.h" -#include "InspectorWorkerResource.h" #include "InstrumentingAgents.h" #include "Page.h" #include "ResourceRequest.h" @@ -113,23 +112,12 @@ void InspectorAgent::didCommitLoad() { m_didCommitLoadFired = true; m_injectedScriptManager->discardInjectedScripts(); -#if ENABLE(WORKERS) - m_workers.clear(); -#endif } void InspectorAgent::enable(ErrorString*) { m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true); -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS) - WorkersMap::iterator workersEnd = m_workers.end(); - for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) { - InspectorWorkerResource* worker = it->second.get(); - m_frontend->inspector()->didCreateWorker(static_cast<int>(worker->id()), worker->url(), worker->isSharedWorker()); - } -#endif - if (m_pendingInspectData.first) inspect(m_pendingInspectData.first, m_pendingInspectData.second); @@ -153,36 +141,6 @@ bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& re return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL(); } -#if ENABLE(WORKERS) -void InspectorAgent::didCreateWorker(intptr_t id, const String& url, bool isSharedWorker) -{ - if (!developerExtrasEnabled()) - return; - - RefPtr<InspectorWorkerResource> workerResource(InspectorWorkerResource::create(id, url, isSharedWorker)); - m_workers.set(id, workerResource); -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->didCreateWorker(static_cast<int>(id), url, isSharedWorker); -#endif -} - -void InspectorAgent::didDestroyWorker(intptr_t id) -{ - if (!developerExtrasEnabled()) - return; - - WorkersMap::iterator workerResource = m_workers.find(id); - if (workerResource == m_workers.end()) - return; -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) - m_frontend->inspector()->didDestroyWorker(static_cast<int>(id)); -#endif - m_workers.remove(workerResource); -} -#endif // ENABLE(WORKERS) - void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script) { if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) diff --git a/Source/WebCore/inspector/InspectorAgent.h b/Source/WebCore/inspector/InspectorAgent.h index 52f31e2c8..d510a4db9 100644 --- a/Source/WebCore/inspector/InspectorAgent.h +++ b/Source/WebCore/inspector/InspectorAgent.h @@ -45,7 +45,6 @@ class Frame; class InjectedScriptManager; class InspectorFrontend; class InspectorObject; -class InspectorWorkerResource; class InstrumentingAgents; class KURL; class Page; @@ -82,11 +81,6 @@ public: void domContentLoadedEventFired(); bool didCommitLoadFired() { return m_didCommitLoadFired; } -#if ENABLE(WORKERS) - void didCreateWorker(intptr_t, const String& url, bool isSharedWorker); - void didDestroyWorker(intptr_t); -#endif - bool hasFrontend() const { return m_frontend; } // Generic code called from custom implementations. @@ -115,10 +109,6 @@ private: pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m_pendingInspectData; typedef HashMap<String, String> InjectedScriptForOriginMap; InjectedScriptForOriginMap m_injectedScriptForOrigin; -#if ENABLE(WORKERS) - typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap; - WorkersMap m_workers; -#endif bool m_didCommitLoadFired; }; diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index a54d8c9c7..b2ec10cdc 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -51,6 +51,7 @@ #include "StyleResolver.h" #include "StyleRule.h" #include "StyleSheetList.h" +#include "WebKitNamedFlowCollection.h" #include <wtf/CurrentTime.h> #include <wtf/HashSet.h> @@ -787,6 +788,21 @@ void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuild cssProperties = properties.release(); } +void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int nodeId, RefPtr<TypeBuilder::Array<String> >& result) +{ + Document* document = m_domAgent->assertDocument(errorString, nodeId); + if (!document) + return; + + Vector<String> namedFlowsVector = document->namedFlows()->namedFlowsNames(); + RefPtr<TypeBuilder::Array<String> > namedFlows = TypeBuilder::Array<String>::create(); + + for (Vector<String>::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it) + namedFlows->addItem(*it); + + result = namedFlows.release(); +} + void InspectorCSSAgent::startSelectorProfiler(ErrorString*) { m_currentSelectorProfile = adoptPtr(new SelectorProfile()); diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h index 791a7bf18..9ceaf3b24 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.h +++ b/Source/WebCore/inspector/InspectorCSSAgent.h @@ -110,6 +110,7 @@ public: virtual void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result); virtual void addRule(ErrorString*, int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result); virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<String> >& result); + virtual void getNamedFlowCollection(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<String> >& result); virtual void startSelectorProfiler(ErrorString*); virtual void stopSelectorProfiler(ErrorString*, RefPtr<TypeBuilder::CSS::SelectorProfile>&); diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 912bbaad6..c3f9f08b3 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -34,6 +34,7 @@ #include "InspectorController.h" +#include "DOMNodeHighlighter.h" #include "Frame.h" #include "GraphicsContext.h" #include "IdentifiersFactory.h" @@ -78,6 +79,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC : m_instrumentingAgents(adoptPtr(new InstrumentingAgents())) , m_injectedScriptManager(InjectedScriptManager::createForPage()) , m_state(adoptPtr(new InspectorState(inspectorClient))) + , m_overlay(InspectorOverlay::create(page, inspectorClient)) , m_page(page) , m_inspectorClient(inspectorClient) { @@ -85,12 +87,12 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC m_inspectorAgent = inspectorAgentPtr.get(); m_agents.append(inspectorAgentPtr.release()); - OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient)); + OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_inspectorAgent, m_state.get(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get())); InspectorPageAgent* pageAgent = pageAgentPtr.get(); m_pageAgent = pageAgentPtr.get(); m_agents.append(pageAgentPtr.release()); - OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get(), m_injectedScriptManager.get())); + OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), m_injectedScriptManager.get(), m_overlay.get())); m_domAgent = domAgentPtr.get(); m_agents.append(domAgentPtr.release()); @@ -130,7 +132,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC m_agents.append(consoleAgentPtr.release()); #if ENABLE(JAVASCRIPT_DEBUGGER) - OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get())); + OwnPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get(), m_overlay.get())); m_debuggerAgent = debuggerAgentPtr.get(); m_agents.append(debuggerAgentPtr.release()); @@ -297,12 +299,12 @@ void InspectorController::evaluateForTestInFrontend(long callId, const String& s void InspectorController::drawHighlight(GraphicsContext& context) const { - m_domAgent->drawHighlight(context); + m_overlay->paint(context); } void InspectorController::getHighlight(Highlight* highlight) const { - m_domAgent->getHighlight(highlight); + m_overlay->getHighlight(highlight); } void InspectorController::inspect(Node* node) @@ -344,7 +346,7 @@ void InspectorController::hideHighlight() Node* InspectorController::highlightedNode() const { - return m_domAgent->highlightedNode(); + return m_overlay->highlightedNode(); } #if ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h index b7e1cbfd8..90996e5e9 100644 --- a/Source/WebCore/inspector/InspectorController.h +++ b/Source/WebCore/inspector/InspectorController.h @@ -52,6 +52,7 @@ class InspectorDebuggerAgent; class InspectorFrontend; class InspectorFrontendChannel; class InspectorFrontendClient; +class InspectorOverlay; class InspectorPageAgent; class InspectorProfilerAgent; class InspectorResourceAgent; @@ -120,6 +121,7 @@ private: OwnPtr<InstrumentingAgents> m_instrumentingAgents; OwnPtr<InjectedScriptManager> m_injectedScriptManager; OwnPtr<InspectorState> m_state; + OwnPtr<InspectorOverlay> m_overlay; InspectorAgent* m_inspectorAgent; InspectorDOMAgent* m_domAgent; diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index 9079589e5..91a38310f 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -66,7 +66,6 @@ #include "HitTestResult.h" #include "IdentifiersFactory.h" #include "InjectedScriptManager.h" -#include "InspectorClient.h" #include "InspectorFrontend.h" #include "InspectorHistory.h" #include "InspectorPageAgent.h" @@ -194,11 +193,11 @@ String InspectorDOMAgent::toErrorString(const ExceptionCode& ec) return ""; } -InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) +InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) : InspectorBaseAgent<InspectorDOMAgent>("DOM", instrumentingAgents, inspectorState) , m_pageAgent(pageAgent) - , m_client(client) , m_injectedScriptManager(injectedScriptManager) + , m_overlay(overlay) , m_frontend(0) , m_domListener(0) , m_lastNodeId(1) @@ -210,7 +209,6 @@ InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, I InspectorDOMAgent::~InspectorDOMAgent() { reset(); - ASSERT(!m_highlightData || (!m_highlightData->node && !m_highlightData->rect)); ASSERT(!m_searchingForNode); } @@ -270,11 +268,6 @@ Vector<Document*> InspectorDOMAgent::documents() return result; } -Node* InspectorDOMAgent::highlightedNode() const -{ - return m_highlightData ? m_highlightData->node.get() : 0; -} - void InspectorDOMAgent::reset() { if (m_history) @@ -375,6 +368,19 @@ Node* InspectorDOMAgent::assertNode(ErrorString* errorString, int nodeId) return node; } +Document* InspectorDOMAgent::assertDocument(ErrorString* errorString, int nodeId) +{ + Node* node = assertNode(errorString, nodeId); + if (!node) + return 0; + + if (!(node->isDocumentNode())) { + *errorString = "Document is not available"; + return 0; + } + return static_cast<Document*>(node); +} + Element* InspectorDOMAgent::assertElement(ErrorString* errorString, int nodeId) { Node* node = assertNode(errorString, nodeId); @@ -938,11 +944,11 @@ bool InspectorDOMAgent::handleMousePress() if (!m_searchingForNode) return false; - if (m_highlightData && m_highlightData->node) { - RefPtr<Node> node = m_highlightData->node; - inspect(node.get()); + if (Node* node = m_overlay->highlightedNode()) { + inspect(node); + return true; } - return true; + return false; } void InspectorDOMAgent::inspect(Node* node) @@ -982,16 +988,14 @@ void InspectorDOMAgent::focusNode() void InspectorDOMAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned) { - if (!m_searchingForNode || !m_highlightData) + if (!m_searchingForNode) return; Node* node = result.innerNode(); while (node && node->nodeType() == Node::TEXT_NODE) node = node->parentNode(); - if (node) { - m_highlightData->node = node; - highlight(); - } + if (node) + m_overlay->highlightNode(node); } void InspectorDOMAgent::setSearchingForNode(bool enabled, InspectorObject* highlightConfig) @@ -1004,48 +1008,42 @@ void InspectorDOMAgent::setSearchingForNode(bool enabled, InspectorObject* highl else { ErrorString error; hideHighlight(&error); - m_highlightData.clear(); + m_overlay->clearHighlightData(); } } -void InspectorDOMAgent::setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig) -{ - setSearchingForNode(enabled, highlightConfig ? highlightConfig->get() : 0); -} - bool InspectorDOMAgent::setHighlightDataFromConfig(InspectorObject* highlightConfig) { if (!highlightConfig) { - m_highlightData.clear(); + m_overlay->clearHighlightData(); return false; } - m_highlightData = adoptPtr(new HighlightData()); + OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); bool showInfo = false; // Default: false (do not show a tooltip). highlightConfig->getBoolean("showInfo", &showInfo); - m_highlightData->showInfo = showInfo; - m_highlightData->content = parseConfigColor("contentColor", highlightConfig); - m_highlightData->contentOutline = parseConfigColor("contentOutlineColor", highlightConfig); - m_highlightData->padding = parseConfigColor("paddingColor", highlightConfig); - m_highlightData->border = parseConfigColor("borderColor", highlightConfig); - m_highlightData->margin = parseConfigColor("marginColor", highlightConfig); + highlightData->showInfo = showInfo; + highlightData->content = parseConfigColor("contentColor", highlightConfig); + highlightData->contentOutline = parseConfigColor("contentOutlineColor", highlightConfig); + highlightData->padding = parseConfigColor("paddingColor", highlightConfig); + highlightData->border = parseConfigColor("borderColor", highlightConfig); + highlightData->margin = parseConfigColor("marginColor", highlightConfig); + m_overlay->setHighlightData(highlightData.release()); return true; } -void InspectorDOMAgent::highlight() +void InspectorDOMAgent::setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig) { - // This method requires m_highlightData to have been filled in by its client. - ASSERT(m_highlightData); - m_client->highlight(); + setSearchingForNode(enabled, highlightConfig ? highlightConfig->get() : 0); } void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor) { - m_highlightData = adoptPtr(new HighlightData()); - m_highlightData->rect = adoptPtr(new IntRect(x, y, width, height)); - m_highlightData->content = parseColor(color); - m_highlightData->contentOutline = parseColor(outlineColor); - m_client->highlight(); + OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); + highlightData->rect = adoptPtr(new IntRect(x, y, width, height)); + highlightData->content = parseColor(color); + highlightData->contentOutline = parseColor(outlineColor); + m_overlay->setHighlightData(highlightData.release()); } void InspectorDOMAgent::highlightNode( @@ -1053,12 +1051,9 @@ void InspectorDOMAgent::highlightNode( int nodeId, const RefPtr<InspectorObject>& highlightConfig) { - if (Node* node = nodeForId(nodeId)) { - if (setHighlightDataFromConfig(highlightConfig.get())) { - m_highlightData->node = node; - highlight(); - } - } + if (Node* node = nodeForId(nodeId)) + if (setHighlightDataFromConfig(highlightConfig.get())) + m_overlay->highlightNode(node); } void InspectorDOMAgent::highlightFrame( @@ -1069,22 +1064,18 @@ void InspectorDOMAgent::highlightFrame( { Frame* frame = m_pageAgent->frameForId(frameId); if (frame && frame->ownerElement()) { - m_highlightData = adoptPtr(new HighlightData()); - m_highlightData->node = frame->ownerElement(); - m_highlightData->showInfo = true; // Always show tooltips for frames. - m_highlightData->content = parseColor(color); - m_highlightData->contentOutline = parseColor(outlineColor); - highlight(); + OwnPtr<HighlightData> highlightData = adoptPtr(new HighlightData()); + highlightData->node = frame->ownerElement(); + highlightData->showInfo = true; // Always show tooltips for frames. + highlightData->content = parseColor(color); + highlightData->contentOutline = parseColor(outlineColor); + m_overlay->setHighlightData(highlightData.release()); } } void InspectorDOMAgent::hideHighlight(ErrorString*) { - if (m_highlightData) { - m_highlightData->node.clear(); - m_highlightData->rect.clear(); - } - m_client->hideHighlight(); + m_overlay->hideHighlight(); } void InspectorDOMAgent::moveTo(ErrorString* errorString, int nodeId, int targetElementId, const int* const anchorNodeId, int* newNodeId) @@ -1599,22 +1590,6 @@ PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(No return injectedScript.wrapNode(node, objectGroup); } -void InspectorDOMAgent::drawHighlight(GraphicsContext& context) const -{ - if (!m_highlightData) - return; - - DOMNodeHighlighter::drawHighlight(context, m_highlightData->node ? m_highlightData->node->document() : m_document.get(), m_highlightData.get()); -} - -void InspectorDOMAgent::getHighlight(Highlight* highlight) const -{ - if (!m_highlightData) - return; - - DOMNodeHighlighter::getHighlight(m_highlightData->node ? m_highlightData->node->document() : m_document.get(), m_highlightData.get(), highlight); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index b05ab570d..ac478cce0 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -55,12 +55,10 @@ class DOMEditor; class Document; class Element; class Event; -class GraphicsContext; -class InspectorClient; class InspectorFrontend; class InspectorHistory; +class InspectorOverlay; class InspectorPageAgent; -class IntRect; class HitTestResult; class HTMLElement; class InspectorState; @@ -71,9 +69,6 @@ class RevalidateStyleAttributeTask; class ScriptValue; class ShadowRoot; -struct Highlight; -struct HighlightData; - typedef String ErrorString; #if ENABLE(INSPECTOR) @@ -103,9 +98,9 @@ public: virtual void didModifyDOMAttr(Element*) = 0; }; - static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) + static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) { - return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, client, inspectorState, injectedScriptManager)); + return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, inspectorState, injectedScriptManager, overlay)); } static String toErrorString(const ExceptionCode&); @@ -151,8 +146,6 @@ public: virtual void redo(ErrorString*); virtual void markUndoableState(ErrorString*); - Node* highlightedNode() const; - void getEventListeners(Node*, Vector<EventListenerInfo>& listenersArray, bool includeAncestors); // Methods called from the InspectorInstrumentation. @@ -185,9 +178,6 @@ public: void inspect(Node*); void focusNode(); - void drawHighlight(GraphicsContext&) const; - void getHighlight(Highlight*) const; - InspectorHistory* history() { return m_history.get(); } // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. @@ -200,16 +190,16 @@ public: static bool isWhitespace(Node*); Node* assertNode(ErrorString*, int nodeId); + Document* assertDocument(ErrorString*, int nodeId); // Methods called from other agents. InspectorPageAgent* pageAgent() { return m_pageAgent; } private: - InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorClient*, InspectorState*, InjectedScriptManager*); + InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InjectedScriptManager*, InspectorOverlay*); void setSearchingForNode(bool enabled, InspectorObject* highlightConfig); bool setHighlightDataFromConfig(InspectorObject* highlightConfig); - void highlight(); // Node-related methods. typedef HashMap<RefPtr<Node>, int> NodeToIdMap; @@ -241,8 +231,8 @@ private: #endif InspectorPageAgent* m_pageAgent; - InspectorClient* m_client; InjectedScriptManager* m_injectedScriptManager; + InspectorOverlay* m_overlay; InspectorFrontend::DOM* m_frontend; DOMListener* m_domListener; NodeToIdMap m_documentNodeToIdMap; @@ -256,7 +246,6 @@ private: typedef HashMap<String, Vector<RefPtr<Node> > > SearchResults; SearchResults m_searchResults; OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask; - OwnPtr<HighlightData> m_highlightData; RefPtr<Node> m_nodeToFocus; bool m_searchingForNode; OwnPtr<InspectorHistory> m_history; diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp index 4c727bcc2..0ae120773 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp +++ b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp @@ -57,7 +57,6 @@ InspectorDOMStorageResource::InspectorDOMStorageResource(StorageArea* storageAre , m_frame(frame) , m_frontend(0) , m_id(String::number(s_nextUnusedId++)) - , m_reportingChangesToFrontend(false) { } diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.h b/Source/WebCore/inspector/InspectorDOMStorageResource.h index 332ef2819..9256949d5 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageResource.h +++ b/Source/WebCore/inspector/InspectorDOMStorageResource.h @@ -66,7 +66,6 @@ private: RefPtr<Frame> m_frame; InspectorFrontend::DOMStorage* m_frontend; String m_id; - bool m_reportingChangesToFrontend; static int s_nextUnusedId; }; diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp index 11807a3f9..d6e44d91a 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -570,6 +570,10 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& } } +void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*) +{ +} + PassRefPtr<Array<TypeBuilder::Debugger::CallFrame> > InspectorDebuggerAgent::currentCallFrames() { if (!m_pausedScriptState) @@ -690,6 +694,8 @@ void InspectorDebuggerAgent::clear() m_continueToLocationBreakpointId = String(); clearBreakDetails(); m_javaScriptPauseScheduled = false; + ErrorString error; + setOverlayMessage(&error, 0); } bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString) diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h index 09c97d195..cd5b703db 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h @@ -112,6 +112,7 @@ public: TypeBuilder::OptOutput<bool>* wasThrown); void compileScript(ErrorString*, const String& expression, const String& sourceURL, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>*, TypeBuilder::OptOutput<String>* syntaxErrorMessage); void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown); + virtual void setOverlayMessage(ErrorString*, const String*); class Listener { public: @@ -133,17 +134,18 @@ protected: InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; } virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0; + virtual void disable(); + virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); + virtual void didContinue(); + private: void enable(); - void disable(); bool enabled(); PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > currentCallFrames(); virtual void didParseSource(const String& scriptId, const Script&); virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); - virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); - virtual void didContinue(); void setPauseOnExceptionsImpl(ErrorString*, int); diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 325a4c48f..296165fd7 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -973,18 +973,6 @@ void InspectorInstrumentation::didStartWorkerContextImpl(InstrumentingAgents* in workerAgent->didStartWorkerContext(workerContextProxy, url); } -void InspectorInstrumentation::didCreateWorkerImpl(InstrumentingAgents* instrumentingAgents, intptr_t id, const String& url, bool isSharedWorker) -{ - if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent()) - inspectorAgent->didCreateWorker(id, url, isSharedWorker); -} - -void InspectorInstrumentation::didDestroyWorkerImpl(InstrumentingAgents* instrumentingAgents, intptr_t id) -{ - if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent()) - inspectorAgent->didDestroyWorker(id); -} - void InspectorInstrumentation::willEvaluateWorkerScript(WorkerContext* workerContext, int workerThreadStartMode) { if (workerThreadStartMode != PauseWorkerContextOnStart) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 4350e9ccd..fd38b44e2 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -223,8 +223,6 @@ public: #if ENABLE(WORKERS) static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*); static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, const KURL&); - static void didCreateWorker(ScriptExecutionContext*, intptr_t id, const String& url, bool isSharedWorker); - static void didDestroyWorker(ScriptExecutionContext*, intptr_t id); static void workerContextTerminated(ScriptExecutionContext*, WorkerContextProxy*); static void willEvaluateWorkerScript(WorkerContext*, int workerThreadStartMode); #endif @@ -389,8 +387,6 @@ private: #if ENABLE(WORKERS) static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*); static void didStartWorkerContextImpl(InstrumentingAgents*, WorkerContextProxy*, const KURL&); - static void didCreateWorkerImpl(InstrumentingAgents*, intptr_t id, const String& url, bool isSharedWorker); - static void didDestroyWorkerImpl(InstrumentingAgents*, intptr_t id); static void workerContextTerminatedImpl(InstrumentingAgents*, WorkerContextProxy*); #endif @@ -1250,24 +1246,6 @@ inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionConte #endif } -inline void InspectorInstrumentation::didCreateWorker(ScriptExecutionContext* context, intptr_t id, const String& url, bool isSharedWorker) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didCreateWorkerImpl(instrumentingAgents, id, url, isSharedWorker); -#endif -} - -inline void InspectorInstrumentation::didDestroyWorker(ScriptExecutionContext* context, intptr_t id) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didDestroyWorkerImpl(instrumentingAgents, id); -#endif -} - inline void InspectorInstrumentation::workerContextTerminated(ScriptExecutionContext* context, WorkerContextProxy* proxy) { #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index ef34537f0..9676d138e 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -223,9 +223,9 @@ bool InspectorPageAgent::sharedBufferContent(PassRefPtr<SharedBuffer> buffer, co return decodeSharedBuffer(buffer, textEncodingName, result); } -PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client) +PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) { - return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, inspectorAgent, state, injectedScriptManager, client)); + return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, inspectorAgent, state, injectedScriptManager, client, overlay)); } // static @@ -308,13 +308,14 @@ TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::cachedResourceTypeJson return resourceTypeJson(cachedResourceType(cachedResource)); } -InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client) +InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) : InspectorBaseAgent<InspectorPageAgent>("Page", instrumentingAgents, inspectorState) , m_page(page) , m_inspectorAgent(inspectorAgent) , m_injectedScriptManager(injectedScriptManager) , m_client(client) , m_frontend(0) + , m_overlay(overlay) , m_lastScriptIdentifier(0) , m_lastPaintContext(0) , m_didLoadEventFire(false) @@ -885,7 +886,7 @@ void InspectorPageAgent::didPaint() Color(0, 0, 0xFF, 0x3F), }; - DOMNodeHighlighter::drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]); + m_overlay->drawOutline(*m_lastPaintContext, m_lastPaintRect, colors[colorSelector++ % WTF_ARRAY_LENGTH(colors)]); m_lastPaintContext = 0; } diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index 964bc85fc..c3b9a6d2f 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -53,6 +53,7 @@ class InspectorAgent; class InspectorArray; class InspectorClient; class InspectorObject; +class InspectorOverlay; class InspectorState; class InstrumentingAgents; class KURL; @@ -77,7 +78,7 @@ public: OtherResource }; - static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*); + static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); static bool cachedResourceContent(CachedResource*, String* result, bool* base64Encoded); static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& textEncodingName, bool withBase64Encode, String* result); @@ -137,7 +138,7 @@ public: static DocumentLoader* assertDocumentLoader(ErrorString*, Frame*); private: - InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*); + InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); void updateViewMetrics(int, int, double, bool); PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*); @@ -147,6 +148,7 @@ private: InjectedScriptManager* m_injectedScriptManager; InspectorClient* m_client; InspectorFrontend::Page* m_frontend; + InspectorOverlay* m_overlay; long m_lastScriptIdentifier; String m_pendingScriptToEvaluateOnLoadOnce; String m_scriptToEvaluateOnLoadOnce; diff --git a/Source/WebCore/inspector/PageConsoleAgent.cpp b/Source/WebCore/inspector/PageConsoleAgent.cpp index f55dda58f..b0d527541 100644 --- a/Source/WebCore/inspector/PageConsoleAgent.cpp +++ b/Source/WebCore/inspector/PageConsoleAgent.cpp @@ -35,6 +35,7 @@ #include "PageConsoleAgent.h" #include "DOMWindow.h" +#include "Document.h" #include "InjectedScriptHost.h" #include "InjectedScriptManager.h" #include "InspectorAgent.h" diff --git a/Source/WebCore/inspector/PageDebuggerAgent.cpp b/Source/WebCore/inspector/PageDebuggerAgent.cpp index a586edf3f..b646af193 100644 --- a/Source/WebCore/inspector/PageDebuggerAgent.cpp +++ b/Source/WebCore/inspector/PageDebuggerAgent.cpp @@ -35,19 +35,21 @@ #include "PageDebuggerAgent.h" #include "Console.h" +#include "DOMNodeHighlighter.h" #include "Page.h" #include "PageScriptDebugServer.h" namespace WebCore { -PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager) +PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) { - return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager)); + return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, inspectedPage, injectedScriptManager, overlay)); } -PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager) +PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* inspectedPage, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) : InspectorDebuggerAgent(instrumentingAgents, inspectorState, injectedScriptManager) , m_inspectedPage(inspectedPage) + , m_overlay(overlay) { } @@ -92,6 +94,10 @@ InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString return injectedScript; } +void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message) +{ + m_overlay->setPausedInDebuggerMessage(message); +} } // namespace WebCore diff --git a/Source/WebCore/inspector/PageDebuggerAgent.h b/Source/WebCore/inspector/PageDebuggerAgent.h index 9dbd513f9..810052ea3 100644 --- a/Source/WebCore/inspector/PageDebuggerAgent.h +++ b/Source/WebCore/inspector/PageDebuggerAgent.h @@ -37,6 +37,7 @@ namespace WebCore { +class InspectorOverlay; class Page; class PageScriptDebugServer; @@ -44,7 +45,7 @@ class PageDebuggerAgent : public InspectorDebuggerAgent { WTF_MAKE_NONCOPYABLE(PageDebuggerAgent); WTF_MAKE_FAST_ALLOCATED; public: - static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); + static PassOwnPtr<PageDebuggerAgent> create(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*); virtual ~PageDebuggerAgent(); private: @@ -55,9 +56,11 @@ private: virtual void unmuteConsole(); virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId); + virtual void setOverlayMessage(ErrorString*, const String*); - PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*); + PageDebuggerAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*, InspectorOverlay*); Page* const m_inspectedPage; + InspectorOverlay* m_overlay; }; } // namespace WebCore diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index 97a61717f..37583f78a 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -283,6 +283,7 @@ modules = [ "ExtensionPanel.js", "ExtensionRegistryStub.js", "ExtensionServer.js", + "ExtensionView.js", ] }, { diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index aaf792a12..4102d94cb 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -160,6 +160,28 @@ WebInspector.CSSStyleModel.prototype = { }, /** + * @param {DOMAgent.NodeId} nodeId + * @param {function(?Array.<string>)} userCallback + */ + getNamedFlowCollectionAsync: function(nodeId, userCallback) + { + /** + * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback + * @param {?Protocol.Error} error + * @param {?Array.<string>=} namedFlowPayload + */ + function callback(userCallback, error, namedFlowPayload) + { + if (error || !namedFlowPayload) + userCallback(null); + else + userCallback(namedFlowPayload); + } + + CSSAgent.getNamedFlowCollection(nodeId, callback.bind(null, userCallback)); + }, + + /** * @param {CSSAgent.CSSRuleId} ruleId * @param {DOMAgent.NodeId} nodeId * @param {string} newSelector diff --git a/Source/WebCore/inspector/front-end/ConsolePanel.js b/Source/WebCore/inspector/front-end/ConsolePanel.js index 54ef63d68..b7af2a951 100644 --- a/Source/WebCore/inspector/front-end/ConsolePanel.js +++ b/Source/WebCore/inspector/front-end/ConsolePanel.js @@ -78,9 +78,8 @@ WebInspector.ConsolePanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { WebInspector.searchController.updateSearchMatchesCount(0, this); this.searchCanceled(); @@ -100,34 +99,20 @@ WebInspector.ConsolePanel.prototype = { this._jumpToSearchResult(0); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._searchResults || !this._searchResults.length) - return false; - if (!loop && this._currentSearchResultIndex + 1 >= this._searchResults.length) - return false; + return; this._jumpToSearchResult((this._currentSearchResultIndex + 1) % this._searchResults.length); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._searchResults || !this._searchResults.length) - return false; + return; var index = this._currentSearchResultIndex - 1; - if (index === -1) { - if (!loop) - return false; + if (index === -1) index = this._searchResults.length - 1; - } this._jumpToSearchResult(index); return true; }, diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js index 23470a443..df95843ba 100644 --- a/Source/WebCore/inspector/front-end/DebuggerModel.js +++ b/Source/WebCore/inspector/front-end/DebuggerModel.js @@ -298,10 +298,13 @@ WebInspector.DebuggerModel.prototype = { this._debuggerPausedDetails = debuggerPausedDetails; if (this._debuggerPausedDetails) this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPausedDetails); - if (debuggerPausedDetails) + if (debuggerPausedDetails) { this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]); - else + DebuggerAgent.setOverlayMessage(WebInspector.UIString("Paused in debugger")); + } else { this.setSelectedCallFrame(null); + DebuggerAgent.setOverlayMessage(); + } }, /** diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js index 740185e9a..7f2f86be0 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanel.js +++ b/Source/WebCore/inspector/front-end/ElementsPanel.js @@ -294,9 +294,8 @@ WebInspector.ElementsPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); @@ -493,41 +492,26 @@ WebInspector.ElementsPanel.prototype = { } }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._searchResults) - return false; + return; this._hideSearchHighlights(); - if (++this._currentSearchResultIndex >= this._searchResults.length) { - if (!loop) - return false; + if (++this._currentSearchResultIndex >= this._searchResults.length) this._currentSearchResultIndex = 0; - } - + this._highlightCurrentSearchResult(); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._searchResults) - return false; + return; this._hideSearchHighlights(); - if (--this._currentSearchResultIndex < 0) { - if (!loop) - return false; + if (--this._currentSearchResultIndex < 0) this._currentSearchResultIndex = (this._searchResults.length - 1); - } this._highlightCurrentSearchResult(); return true; diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js index d828d336e..4cdc81c99 100644 --- a/Source/WebCore/inspector/front-end/ExtensionPanel.js +++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js @@ -30,81 +30,10 @@ /** * @constructor - * @extends {WebInspector.View} - * @param {string} id - * @param {Element} parent - * @param {string} src - * @param {string} className - */ -WebInspector.ExtensionView = function(id, parent, src, className) -{ - WebInspector.View.call(this); - this.element.className = "fill"; - - this._id = id; - this._iframe = document.createElement("iframe"); - this._iframe.addEventListener("load", this._onLoad.bind(this), false); - this._iframe.src = src; - this._iframe.className = className; - - this.element.appendChild(this._iframe); - this.show(parent); -} - -WebInspector.ExtensionView.prototype = { - wasShown: function() - { - if (typeof this._frameIndex === "number") - WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); - }, - - willHide: function() - { - if (typeof this._frameIndex === "number") - WebInspector.extensionServer.notifyViewHidden(this._id); - }, - - _onLoad: function() - { - this._frameIndex = Array.prototype.indexOf.call(window.frames, this._iframe.contentWindow); - if (this.isShowing()) - WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); - } -} - -WebInspector.ExtensionView.prototype.__proto__ = WebInspector.View.prototype; - -/** - * @constructor - * @extends {WebInspector.View} - * @param {string} id - */ -WebInspector.ExtensionNotifierView = function(id) -{ - WebInspector.View.call(this); - - this._id = id; -} - -WebInspector.ExtensionNotifierView.prototype = { - wasShown: function() - { - WebInspector.extensionServer.notifyViewShown(this._id); - }, - - willHide: function() - { - WebInspector.extensionServer.notifyViewHidden(this._id); - } -} - -WebInspector.ExtensionNotifierView.prototype.__proto__ = WebInspector.View.prototype; - -/** - * @constructor * @extends {WebInspector.Panel} * @param {string} id * @param {string} label + * @param {string} pageURL * @param {string} iconURL */ WebInspector.ExtensionPanel = function(id, label, pageURL, iconURL) @@ -153,34 +82,23 @@ WebInspector.ExtensionPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PerformSearch, query); WebInspector.Panel.prototype.performSearch.apply(this, arguments); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.NextSearchResult); - WebInspector.Panel.prototype.jumpToNextSearchResult.call(this, loop); - return true; + WebInspector.Panel.prototype.jumpToNextSearchResult.call(this); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult); - WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this, loop); - return true; + WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this); }, _addStyleRule: function(selector, body) diff --git a/Source/WebCore/inspector/front-end/ExtensionView.js b/Source/WebCore/inspector/front-end/ExtensionView.js new file mode 100644 index 000000000..d79251882 --- /dev/null +++ b/Source/WebCore/inspector/front-end/ExtensionView.js @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @constructor + * @extends {WebInspector.View} + * @param {string} id + * @param {Element} parent + * @param {string} src + * @param {string} className + */ +WebInspector.ExtensionView = function(id, parent, src, className) +{ + WebInspector.View.call(this); + this.element.className = "fill"; + + this._id = id; + this._iframe = document.createElement("iframe"); + this._iframe.addEventListener("load", this._onLoad.bind(this), false); + this._iframe.src = src; + this._iframe.className = className; + + this.element.appendChild(this._iframe); + this.show(parent); +} + +WebInspector.ExtensionView.prototype = { + wasShown: function() + { + if (typeof this._frameIndex === "number") + WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); + }, + + willHide: function() + { + if (typeof this._frameIndex === "number") + WebInspector.extensionServer.notifyViewHidden(this._id); + }, + + _onLoad: function() + { + this._frameIndex = Array.prototype.indexOf.call(window.frames, this._iframe.contentWindow); + if (this.isShowing()) + WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); + } +} + +WebInspector.ExtensionView.prototype.__proto__ = WebInspector.View.prototype; + +/** + * @constructor + * @extends {WebInspector.View} + * @param {string} id + */ +WebInspector.ExtensionNotifierView = function(id) +{ + WebInspector.View.call(this); + + this._id = id; +} + +WebInspector.ExtensionNotifierView.prototype = { + wasShown: function() + { + WebInspector.extensionServer.notifyViewShown(this._id); + }, + + willHide: function() + { + WebInspector.extensionServer.notifyViewHidden(this._id); + } +} + +WebInspector.ExtensionNotifierView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/HandlerRegistry.js b/Source/WebCore/inspector/front-end/HandlerRegistry.js index 42d6e681d..3a7758756 100644 --- a/Source/WebCore/inspector/front-end/HandlerRegistry.js +++ b/Source/WebCore/inspector/front-end/HandlerRegistry.js @@ -96,7 +96,7 @@ WebInspector.HandlerRegistry.prototype = { */ appendApplicableItems: function(contextMenu, target) { - if (!(target instanceof WebInspector.UISourceCode || target instanceof WebInspector.Resource)) + if (!(target instanceof WebInspector.UISourceCode || target instanceof WebInspector.Resource || target instanceof WebInspector.NetworkRequest)) return; var contentProvider = /** @type {WebInspector.ContentProvider} */ target; if (!contentProvider.contentURL()) diff --git a/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png b/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png Binary files differindex 74eec1d3b..d270e277f 100644 --- a/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png +++ b/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png diff --git a/Source/WebCore/inspector/front-end/InjectedFakeWorker.js b/Source/WebCore/inspector/front-end/InjectedFakeWorker.js deleted file mode 100644 index d65b20840..000000000 --- a/Source/WebCore/inspector/front-end/InjectedFakeWorker.js +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -var InjectedFakeWorker = function(InjectedScriptHost, inspectedWindow, injectedScriptId) -{ - -Worker = function(url) -{ - var impl = new FakeWorker(this, url); - if (impl === null) - return null; - - this.isFake = true; - this.postMessage = bind(impl.postMessage, impl); - this.terminate = bind(impl.terminate, impl); - - function onmessageGetter() - { - return impl.channel.port1.onmessage; - } - function onmessageSetter(callback) - { - impl.channel.port1.onmessage = callback; - } - this.__defineGetter__("onmessage", onmessageGetter); - this.__defineSetter__("onmessage", onmessageSetter); - this.addEventListener = bind(impl.channel.port1.addEventListener, impl.channel.port1); - this.removeEventListener = bind(impl.channel.port1.removeEventListener, impl.channel.port1); - this.dispatchEvent = bind(impl.channel.port1.dispatchEvent, impl.channel.port1); -} - -function FakeWorker(worker, url) -{ - var scriptURL = this._expandURLAndCheckOrigin(document.baseURI, location.href, url); - - this._worker = worker; - this._id = InjectedScriptHost.nextWorkerId(); - this.channel = new MessageChannel(); - this._listeners = []; - this._buildWorker(scriptURL); - - InjectedScriptHost.didCreateWorker(this._id, scriptURL.url, false); -} - -FakeWorker.prototype = { - postMessage: function(msg, opt_ports) - { - if (this._frame != null) - this.channel.port1.postMessage.apply(this.channel.port1, arguments); - else if (this._pendingMessages) - this._pendingMessages.push(arguments) - else - this._pendingMessages = [ arguments ]; - }, - - terminate: function() - { - InjectedScriptHost.didDestroyWorker(this._id); - - this.channel.port1.close(); - this.channel.port2.close(); - if (this._frame != null) - this._frame.frameElement.parentNode.removeChild(this._frame.frameElement); - this._frame = null; - this._worker = null; // Break reference loop. - }, - - _buildWorker: function(url) - { - var code = this._loadScript(url.url); - var iframeElement = document.createElement("iframe"); - iframeElement.style.display = "none"; - - this._document = document; - iframeElement.onload = bind(this._onWorkerFrameLoaded, this, iframeElement, url, code); - - if (document.body) - this._attachWorkerFrameToDocument(iframeElement, url, code); - else - window.addEventListener("load", bind(this._attachWorkerFrameToDocument, this, iframeElement), false); - }, - - _attachWorkerFrameToDocument: function(iframeElement) - { - document.body.appendChild(iframeElement); - }, - - _onWorkerFrameLoaded: function(iframeElement, url, code) - { - var frame = iframeElement.contentWindow; - this._frame = frame; - this._setupWorkerContext(frame, url); - - var frameContents = '(function() { var location = __devtools.location; var window; ' + code + '})();\n' + '//@ sourceURL=' + url.url; - - frame.eval(frameContents); - if (this._pendingMessages) { - for (var msg = 0; msg < this._pendingMessages.length; ++msg) - this.postMessage.apply(this, this._pendingMessages[msg]); - delete this._pendingMessages; - } - }, - - _setupWorkerContext: function(workerFrame, url) - { - workerFrame.__devtools = { - handleException: bind(this._handleException, this), - location: url.mockLocation() - }; - - var self = this; - - function onmessageGetter() - { - return self.channel.port2.onmessage ? self.channel.port2.onmessage.originalCallback : null; - } - - function onmessageSetter(callback) - { - var wrappedCallback = bind(self._callbackWrapper, self, callback); - wrappedCallback.originalCallback = callback; - self.channel.port2.onmessage = wrappedCallback; - } - - workerFrame.__defineGetter__("onmessage", onmessageGetter); - workerFrame.__defineSetter__("onmessage", onmessageSetter); - workerFrame.addEventListener = bind(this._addEventListener, this); - workerFrame.removeEventListener = bind(this._removeEventListener, this); - workerFrame.dispatchEvent = bind(this.channel.port2.dispatchEvent, this.channel.port2); - workerFrame.postMessage = bind(this.channel.port2.postMessage, this.channel.port2); - workerFrame.importScripts = bind(this._importScripts, this, workerFrame); - workerFrame.close = bind(this.terminate, this); - }, - - _addEventListener: function(type, callback, useCapture) - { - var wrappedCallback = bind(this._callbackWrapper, this, callback); - wrappedCallback.originalCallback = callback; - wrappedCallback.type = type; - wrappedCallback.useCapture = Boolean(useCapture); - - this.channel.port2.addEventListener(type, wrappedCallback, useCapture); - this._listeners.push(wrappedCallback); - }, - - _removeEventListener: function(type, callback, useCapture) - { - var listeners = this._listeners; - for (var i = 0; i < listeners.length; ++i) { - if (listeners[i].originalCallback === callback && - listeners[i].type === type && - listeners[i].useCapture === Boolean(useCapture)) { - this.channel.port2.removeEventListener(type, listeners[i], useCapture); - listeners[i] = listeners[listeners.length - 1]; - listeners.pop(); - break; - } - } - }, - - _callbackWrapper: function(callback, msg) - { - // Shortcut -- if no exception handlers installed, avoid try/catch so as not to obscure line number. - if (!this._frame.onerror && !this._worker.onerror) { - callback(msg); - return; - } - - try { - callback(msg); - } catch (e) { - this._handleException(e, this._frame.onerror, this._worker.onerror); - } - }, - - _handleException: function(e) - { - // NB: it should be an ErrorEvent, but creating it from script is not - // currently supported, so emulate it on top of plain vanilla Event. - var errorEvent = this._document.createEvent("Event"); - errorEvent.initEvent("Event", false, false); - errorEvent.message = "Uncaught exception"; - - for (var i = 1; i < arguments.length; ++i) { - if (arguments[i] && arguments[i](errorEvent)) - return; - } - - throw e; - }, - - _importScripts: function(targetFrame) - { - for (var i = 1; i < arguments.length; ++i) { - var workerOrigin = targetFrame.__devtools.location.href; - var url = this._expandURLAndCheckOrigin(workerOrigin, workerOrigin, arguments[i]); - targetFrame.eval(this._loadScript(url.url) + "\n//@ sourceURL= " + url.url); - } - }, - - _loadScript: function(url) - { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.send(null); - - var text = xhr.responseText; - if (xhr.status != 0 && xhr.status/100 !== 2) { // We're getting status === 0 when using file://. - console.error("Failed to load worker: " + url + "[" + xhr.status + "]"); - text = ""; // We've got error message, not worker code. - } - return text; - }, - - _expandURLAndCheckOrigin: function(baseURL, origin, url) - { - var scriptURL = new URL(baseURL).completeWith(url); - - if (!scriptURL.sameOrigin(origin)) - throw new DOMCoreException("SECURITY_ERR",18); - return scriptURL; - } -}; - -function URL(url) -{ - this.url = url; - this.split(); -} - -URL.prototype = { - urlRegEx: (/^(http[s]?|file):\/\/([^\/:]*)(:[\d]+)?(?:(\/[^#?]*)(\?[^#]*)?(?:#(.*))?)?$/i), - - split: function() - { - function emptyIfNull(str) - { - return str == null ? "" : str; - } - var parts = this.urlRegEx.exec(this.url); - - this.schema = parts[1]; - this.host = parts[2]; - this.port = emptyIfNull(parts[3]); - this.path = emptyIfNull(parts[4]); - this.query = emptyIfNull(parts[5]); - this.fragment = emptyIfNull(parts[6]); - }, - - mockLocation: function() - { - var host = this.host.replace(/^[^@]*@/, ""); - - return { - href: this.url, - protocol: this.schema + ":", - host: host, - hostname: host, - port: this.port, - pathname: this.path, - search: this.query, - hash: this.fragment - }; - }, - - completeWith: function(url) - { - if (url === "" || /^[^/]*:/.exec(url)) // If given absolute url, return as is now. - return new URL(url); - - var relParts = /^([^#?]*)(.*)$/.exec(url); // => [ url, path, query-andor-fragment ] - - var path = (relParts[1].slice(0, 1) === "/" ? "" : this.path.replace(/[^/]*$/, "")) + relParts[1]; - path = path.replace(/(\/\.)+(\/|$)/g, "/").replace(/[^/]*\/\.\.(\/|$)/g, ""); - - return new URL(this.schema + "://" + this.host + this.port + path + relParts[2]); - }, - - sameOrigin: function(url) - { - function normalizePort(schema, port) - { - var portNo = port.slice(1); - return (schema === "https" && portNo == 443 || schema === "http" && portNo == 80) ? "" : port; - } - - var other = new URL(url); - - return this.schema === other.schema && - this.host === other.host && - normalizePort(this.schema, this.port) === normalizePort(other.schema, other.port); - } -}; - -function DOMCoreException(name, code) -{ - function formatError() - { - return "Error: " + this.message; - } - - this.name = name; - this.message = name + ": DOM Exception " + code; - this.code = code; - this.toString = bind(formatError, this); -} - -function bind(func, thisObject) -{ - var args = Array.prototype.slice.call(arguments, 2); - return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); }; -} - -function noop() -{ -} - -} diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index ade0491fa..54fa1a096 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -154,9 +154,9 @@ WebInspector.JavaScriptSourceFrame.prototype = { this._restoreBreakpointsAfterEditing(); }, - beforeTextChanged: function(userInput) + beforeTextChanged: function() { - WebInspector.SourceFrame.prototype.beforeTextChanged.call(this, userInput); + WebInspector.SourceFrame.prototype.beforeTextChanged.call(this); this._removeBreakpointsBeforeEditing(); }, diff --git a/Source/WebCore/inspector/front-end/NetworkItemView.js b/Source/WebCore/inspector/front-end/NetworkItemView.js index 1fe90248a..45cdfaba4 100644 --- a/Source/WebCore/inspector/front-end/NetworkItemView.js +++ b/Source/WebCore/inspector/front-end/NetworkItemView.js @@ -63,7 +63,7 @@ WebInspector.NetworkItemView = function(request) var timingView = new WebInspector.RequestTimingView(request); this.appendTab("timing", WebInspector.UIString("Timing"), timingView); } - + this._request = request; } WebInspector.NetworkItemView.prototype = { @@ -92,6 +92,14 @@ WebInspector.NetworkItemView.prototype = { { if (event.data.isUserGesture) WebInspector.settings.resourceViewTab.set(event.data.tabId); + }, + + /** + * @return {WebInspector.NetworkRequest} + */ + request: function() + { + return this._request; } } diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 0bfa3bb0c..a82a56168 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -1166,32 +1166,18 @@ WebInspector.NetworkLogView.prototype = { this._highlightNthMatchedRequest(newMatchedRequestIndex, false); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._matchedRequests.length) - return false; - if (!loop && this._currentMatchedRequestIndex <= 0) - return false; + return; this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + this._matchedRequests.length - 1) % this._matchedRequests.length, true); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._matchedRequests.length) - return false; - if (!loop && this._currentMatchedRequestIndex + 1 >= this._matchedRequests.length) - return false; + return; this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + 1) % this._matchedRequests.length, true); - return true; }, searchCanceled: function() @@ -1438,20 +1424,14 @@ WebInspector.NetworkPanel.prototype = { this._networkLogView.performSearch(searchQuery); }, - /** - * @param {boolean} loop - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { - this._networkLogView.jumpToPreviousSearchResult(loop); + this._networkLogView.jumpToPreviousSearchResult(); }, - /** - * @param {boolean} loop - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { - this._networkLogView.jumpToNextSearchResult(loop); + this._networkLogView.jumpToNextSearchResult(); }, searchCanceled: function() @@ -1467,6 +1447,8 @@ WebInspector.NetworkPanel.prototype = { { if (!(target instanceof WebInspector.NetworkRequest)) return; + if (this.visibleView && this.visibleView.isShowing() && this.visibleView.request() === target) + return; function reveal() { diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index a14641c8a..7891a0b5f 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -108,30 +108,19 @@ WebInspector.Panel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); }, - /** - * @param {boolean} loop - * @return {boolean} true iff operation is successful - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { - return false; }, - /** - * @param {boolean} loop - * @return {boolean} true iff operation is successful - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { - return false; }, /** diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 17c6e5300..ce1229620 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -739,9 +739,8 @@ WebInspector.ProfilesPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { this.searchCanceled(); @@ -816,14 +815,10 @@ WebInspector.ProfilesPanel.prototype = { this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this.showView || !this._searchResults || !this._searchResults.length) - return false; + return; var showFirstResult = false; @@ -853,17 +848,12 @@ WebInspector.ProfilesPanel.prototype = { currentView.jumpToFirstSearchResult(); else currentView.jumpToNextSearchResult(); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this.showView || !this._searchResults || !this._searchResults.length) - return false; + return; var showLastResult = false; @@ -893,7 +883,6 @@ WebInspector.ProfilesPanel.prototype = { currentView.jumpToLastSearchResult(); else currentView.jumpToPreviousSearchResult(); - return true; }, _searchableViews: function() diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index 71ff0a56d..113b95be9 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -637,9 +637,8 @@ WebInspector.ResourcesPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { this._resetSearchResults(); var regex = WebInspector.SourceFrame.createSearchRegex(query); @@ -749,32 +748,22 @@ WebInspector.ResourcesPanel.prototype = { this._forAllResourceTreeElements(callback); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this.currentSearchMatches) - return false; + return; var currentTreeElement = this.sidebarTree.selectedTreeElement; var nextSearchResult = this._searchController.nextSearchResult(currentTreeElement); this._showSearchResult(nextSearchResult); - return true; }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this.currentSearchMatches) - return false; + return; var currentTreeElement = this.sidebarTree.selectedTreeElement; var previousSearchResult = this._searchController.previousSearchResult(currentTreeElement); this._showSearchResult(previousSearchResult); - return true; }, _forAllResourceTreeElements: function(callback) diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index c2d8c0000..61758f666 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -103,9 +103,8 @@ WebInspector.ScriptsPanel = function(workspaceForTest) if (Preferences.exposeWorkersInspection && !WebInspector.WorkerManager.isWorkerFrontend()) { WorkerAgent.setWorkerInspectionEnabled(true); - this.sidebarPanes.workerList = new WebInspector.WorkerListSidebarPane(WebInspector.workerManager); - } else - this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane(); + this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebInspector.workerManager); + } this._debugSidebarContentsElement = document.createElement("div"); this._debugSidebarContentsElement.id = "scripts-debug-sidebar-contents"; @@ -364,8 +363,6 @@ WebInspector.ScriptsPanel.prototype = { this._updateScriptViewStatusBarItems(); this.sidebarPanes.jsBreakpoints.reset(); this.sidebarPanes.watchExpressions.reset(); - if (!preserveItems && this.sidebarPanes.workers) - this.sidebarPanes.workers.reset(); var uiSourceCodes = this._workspace.uiSourceCodes(); for (var i = 0; i < uiSourceCodes.length; ++i) @@ -573,6 +570,7 @@ WebInspector.ScriptsPanel.prototype = { // ScriptsNavigator does not need to update on EditorClosed. this._updateScriptViewStatusBarItems(); + WebInspector.searchController.resetSearch(); }, _editorSelected: function(event) @@ -581,6 +579,7 @@ WebInspector.ScriptsPanel.prototype = { var sourceFrame = this._showFile(uiSourceCode); this._navigatorController.hideNavigatorOverlay(); sourceFrame.focus(); + WebInspector.searchController.resetSearch(); }, _scriptSelected: function(event) @@ -878,9 +877,8 @@ WebInspector.ScriptsPanel.prototype = { /** * @param {string} query - * @param {boolean} loop */ - performSearch: function(query, loop) + performSearch: function(query) { WebInspector.searchController.updateSearchMatchesCount(0, this); @@ -899,57 +897,46 @@ WebInspector.ScriptsPanel.prototype = { return; WebInspector.searchController.updateSearchMatchesCount(searchMatches, this); - view.jumpToNextSearchResult(loop); + view.jumpToNextSearchResult(); WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex, this); } this._searchView.performSearch(query, finishedCallback.bind(this)); }, - /** - * @param {boolean} loop - * @return {boolean} - */ - jumpToNextSearchResult: function(loop) + jumpToNextSearchResult: function() { if (!this._searchView) - return false; + return; if (this._searchView !== this.visibleView) { - this.performSearch(this._searchQuery, loop); - return false; + this.performSearch(this._searchQuery); + return; } - if (this._searchView.showingLastSearchResult()) { - if (!loop) - return false; + if (this._searchView.showingLastSearchResult()) this._searchView.jumpToFirstSearchResult(); - } else + else this._searchView.jumpToNextSearchResult(); WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this); return true; }, - /** - * @param {boolean} loop - */ - jumpToPreviousSearchResult: function(loop) + jumpToPreviousSearchResult: function() { if (!this._searchView) return false; if (this._searchView !== this.visibleView) { - this.performSearch(this._searchQuery, loop); + this.performSearch(this._searchQuery); if (this._searchView) this._searchView.jumpToLastSearchResult(); return; } - if (this._searchView.showingFirstSearchResult()) { - if (!loop) - return false; + if (this._searchView.showingFirstSearchResult()) this._searchView.jumpToLastSearchResult(); - } else + else this._searchView.jumpToPreviousSearchResult(); WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this); }, @@ -968,7 +955,7 @@ WebInspector.ScriptsPanel.prototype = { */ replaceSelectionWith: function(text) { - var view = /** @type {WebInspector.SourceFrame} */ this._searchView; + var view = /** @type {WebInspector.SourceFrame} */ this.visibleView; view.replaceSearchMatchWith(text); }, @@ -978,7 +965,7 @@ WebInspector.ScriptsPanel.prototype = { */ replaceAllWith: function(query, text) { - var view = /** @type {WebInspector.SourceFrame} */ this._searchView; + var view = /** @type {WebInspector.SourceFrame} */ this.visibleView; view.replaceAllWith(query, text); }, diff --git a/Source/WebCore/inspector/front-end/SearchController.js b/Source/WebCore/inspector/front-end/SearchController.js index 6f4ec797c..d18e280e1 100644 --- a/Source/WebCore/inspector/front-end/SearchController.js +++ b/Source/WebCore/inspector/front-end/SearchController.js @@ -34,16 +34,18 @@ */ WebInspector.SearchController = function() { - this._element = document.createElement("div"); + this._element = document.createElement("table"); this._element.className = "toolbar-search"; + this._element.cellSpacing = 0; - var labelElement = this._element.createChild("span"); - labelElement.textContent = WebInspector.UIString("Find"); - - this._searchControlElement = this._element.createChild("div", "toolbar-search-control"); + this._firstRowElement = this._element.createChild("tr"); + this._secondRowElement = this._element.createChild("tr", "hidden"); + // Column 1 + this._searchControlElement = this._firstRowElement.createChild("td").createChild("span", "toolbar-search-control"); this._searchInputElement = this._searchControlElement.createChild("input", "search-replace"); this._searchInputElement.id = "search-input-field"; + this._searchInputElement.placeholder = WebInspector.UIString("Find"); this._matchesElement = this._searchControlElement.createChild("label", "search-results-matches"); this._matchesElement.setAttribute("for", "search-input-field"); @@ -62,38 +64,50 @@ WebInspector.SearchController = function() this._searchInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); - this._replaceElement = this._element.createChild("span"); - - this._replaceCheckboxElement = this._replaceElement.createChild("input"); - this._replaceCheckboxElement.type = "checkbox"; - this._replaceCheckboxElement.id = "search-replace-trigger"; - this._replaceCheckboxElement.tabIndex = -1; - this._replaceCheckboxElement.addEventListener("click", this._toggleReplaceVisibility.bind(this), false); - - this._replaceLabelElement = this._replaceElement.createChild("label"); - this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); - this._replaceLabelElement.setAttribute("for", "search-replace-trigger"); - - this._replaceDetailsElement = this._replaceElement.createChild("span", "hidden"); - - this._replaceInputElement = this._replaceDetailsElement.createChild("input", "search-replace toolbar-replace-control"); + this._replaceInputElement = this._secondRowElement.createChild("td").createChild("input", "search-replace toolbar-replace-control"); this._replaceInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); + this._replaceInputElement.placeholder = WebInspector.UIString("Replace"); + + // Column 2 + this._findButtonElement = this._firstRowElement.createChild("td").createChild("button", "hidden"); + this._findButtonElement.textContent = WebInspector.UIString("Find"); + this._findButtonElement.tabIndex = -1; + this._findButtonElement.addEventListener("click", this._onNextButtonSearch.bind(this), false); - this._replaceButtonElement = this._replaceDetailsElement.createChild("button"); + this._replaceButtonElement = this._secondRowElement.createChild("td").createChild("button"); this._replaceButtonElement.textContent = WebInspector.UIString("Replace"); + this._replaceButtonElement.disabled = true; + this._replaceButtonElement.tabIndex = -1; this._replaceButtonElement.addEventListener("click", this._replace.bind(this), false); - this._skipButtonElement = this._replaceDetailsElement.createChild("button"); - this._skipButtonElement.textContent = WebInspector.UIString("Skip"); - this._skipButtonElement.addEventListener("click", this._onNextButtonSearch.bind(this), false); + // Column 3 + this._prevButtonElement = this._firstRowElement.createChild("td").createChild("button", "hidden"); + this._prevButtonElement.textContent = WebInspector.UIString("Previous"); + this._prevButtonElement.disabled = true; + this._prevButtonElement.tabIndex = -1; + this._prevButtonElement.addEventListener("click", this._onPrevButtonSearch.bind(this), false); - this._replaceAllButtonElement = this._replaceDetailsElement.createChild("button"); + this._replaceAllButtonElement = this._secondRowElement.createChild("td").createChild("button"); this._replaceAllButtonElement.textContent = WebInspector.UIString("Replace All"); this._replaceAllButtonElement.addEventListener("click", this._replaceAll.bind(this), false); - var closeButtonElement = this._element.createChild("span", "drawer-header-close-button"); - closeButtonElement.textContent = WebInspector.UIString("\u00D7"); - closeButtonElement.addEventListener("click", this.cancelSearch.bind(this), false); + // Column 4 + this._replaceElement = this._firstRowElement.createChild("td").createChild("span"); + + this._replaceCheckboxElement = this._replaceElement.createChild("input"); + this._replaceCheckboxElement.type = "checkbox"; + this._replaceCheckboxElement.id = "search-replace-trigger"; + this._replaceCheckboxElement.addEventListener("click", this._updateSecondRowVisibility.bind(this), false); + + this._replaceLabelElement = this._replaceElement.createChild("label"); + this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); + this._replaceLabelElement.setAttribute("for", "search-replace-trigger"); + + // Column 5 + var cancelButtonElement = this._firstRowElement.createChild("td").createChild("button"); + cancelButtonElement.textContent = WebInspector.UIString("Cancel"); + cancelButtonElement.tabIndex = -1; + cancelButtonElement.addEventListener("click", this.cancelSearch.bind(this), false); } WebInspector.SearchController.prototype = { @@ -119,15 +133,20 @@ WebInspector.SearchController.prototype = { if (!this._searchIsVisible) return; delete this._searchIsVisible; - this._performSearch("", false, false, false); WebInspector.inspectorView.setFooterElement(null); - this._replaceCheckboxElement.checked = false; - this._toggleReplaceVisibility(); + this.resetSearch(); + }, + + resetSearch: function() + { + this._performSearch("", false, false); + this._updateReplaceVisibility(); + this._matchesElement.textContent = ""; }, disableSearchUntilExplicitAction: function(event) { - this._performSearch("", false, false, false); + this._performSearch("", false, false); }, /** @@ -163,10 +182,9 @@ WebInspector.SearchController.prototype = { var currentPanel = WebInspector.inspectorView.currentPanel(); if (isMac && event.metaKey && !event.ctrlKey && !event.altKey) { - if (event.shiftKey) { - if (currentPanel.jumpToPreviousSearchResult) - currentPanel.jumpToPreviousSearchResult(); - } else if (currentPanel.jumpToNextSearchResult) + if (event.shiftKey) + currentPanel.jumpToPreviousSearchResult(); + else currentPanel.jumpToNextSearchResult(); event.consume(true); return true; @@ -178,6 +196,8 @@ WebInspector.SearchController.prototype = { _updateSearchNavigationButtonState: function(enabled) { + this._replaceButtonElement.disabled = !enabled; + this._prevButtonElement.disabled = !enabled; var panel = WebInspector.inspectorView.currentPanel(); if (enabled) { this._searchNavigationPrevElement.addStyleClass("enabled"); @@ -211,10 +231,13 @@ WebInspector.SearchController.prototype = { _updateReplaceVisibility: function() { var panel = WebInspector.inspectorView.currentPanel(); - if (WebInspector.experimentsSettings.searchReplace.isEnabled() && panel.canSearchAndReplace()) + if (panel && panel.canSearchAndReplace()) this._replaceElement.removeStyleClass("hidden"); - else + else { this._replaceElement.addStyleClass("hidden"); + this._replaceCheckboxElement.checked = false; + this._updateSecondRowVisibility(); + } }, _onSearchFieldManualFocus: function(event) @@ -236,7 +259,7 @@ WebInspector.SearchController.prototype = { if (isEnterKey(event)) { if (event.target === this._searchInputElement) - this._performSearch(event.target.value, true, event.shiftKey, true); + this._performSearch(event.target.value, true, event.shiftKey); else if (event.target === this._replaceInputElement) this._replace(); } @@ -244,20 +267,22 @@ WebInspector.SearchController.prototype = { _onInput: function(event) { - this._performSearch(event.target.value, false, false, true); + this._performSearch(event.target.value, false, false); }, _onNextButtonSearch: function(event) { // Simulate next search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, false, true); + this._performSearch(this._searchInputElement.value, true, false); this._searchInputElement.focus(); }, _onPrevButtonSearch: function(event) { + if (!this._searchNavigationPrevElement.hasStyleClass("enabled")) + return; // Simulate previous search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, true, true); + this._performSearch(this._searchInputElement.value, true, true); this._searchInputElement.focus(); }, @@ -265,9 +290,8 @@ WebInspector.SearchController.prototype = { * @param {string} query * @param {boolean} forceSearch * @param {boolean} isBackwardSearch - * @param {boolean} loop */ - _performSearch: function(query, forceSearch, isBackwardSearch, loop) + _performSearch: function(query, forceSearch, isBackwardSearch) { if (!query || !query.length) { delete this._currentQuery; @@ -276,7 +300,7 @@ WebInspector.SearchController.prototype = { var panel = WebInspector.panels[panelName]; var hadCurrentQuery = !!panel.currentQuery; delete panel.currentQuery; - if (hadCurrentQuery && panel.searchCanceled) + if (hadCurrentQuery) panel.searchCanceled(); } this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); @@ -289,9 +313,9 @@ WebInspector.SearchController.prototype = { // search result for a good user experience. if (forceSearch) { if (!isBackwardSearch) - currentPanel.jumpToNextSearchResult(loop); + currentPanel.jumpToNextSearchResult(); else if (isBackwardSearch) - currentPanel.jumpToPreviousSearchResult(loop); + currentPanel.jumpToPreviousSearchResult(); } return; } @@ -302,16 +326,29 @@ WebInspector.SearchController.prototype = { this._currentQuery = query; currentPanel.currentQuery = query; - currentPanel.performSearch(query, loop); + currentPanel.performSearch(query); }, - _toggleReplaceVisibility: function() + _updateSecondRowVisibility: function() { + if (!this._searchIsVisible) + return; if (this._replaceCheckboxElement.checked) { - this._replaceDetailsElement.removeStyleClass("hidden"); + this._element.addStyleClass("toolbar-search-replace"); + this._secondRowElement.removeStyleClass("hidden"); + this._prevButtonElement.removeStyleClass("hidden"); + this._findButtonElement.removeStyleClass("hidden"); + this._replaceCheckboxElement.tabIndex = -1; this._replaceInputElement.focus(); - } else - this._replaceDetailsElement.addStyleClass("hidden"); + } else { + this._element.removeStyleClass("toolbar-search-replace"); + this._secondRowElement.addStyleClass("hidden"); + this._prevButtonElement.addStyleClass("hidden"); + this._findButtonElement.addStyleClass("hidden"); + this._replaceCheckboxElement.tabIndex = 0; + this._searchInputElement.focus(); + } + WebInspector.inspectorView.setFooterElement(this._element); }, _replace: function() @@ -320,13 +357,13 @@ WebInspector.SearchController.prototype = { currentPanel.replaceSelectionWith(this._replaceInputElement.value); var query = this._currentQuery; delete this._currentQuery; - this._performSearch(query, true, false, false); + this._performSearch(query, true, false); }, _replaceAll: function() { var currentPanel = WebInspector.inspectorView.currentPanel(); - currentPanel.replaceAllWith(this._currentQuery, this._replaceInputElement.value); + currentPanel.replaceAllWith(this._searchInputElement.value, this._replaceInputElement.value); } } diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index ba0b266a2..963d1f0ea 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -188,7 +188,6 @@ WebInspector.ExperimentsSettings = function() this.liveNativeMemoryChart = this._createExperiment("liveNativeMemoryChart", "Live native memory chart"); this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection"); this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline"); - this.searchReplace = this._createExperiment("searchReplace", "Search / Replace"); this._cleanUpSetting(); } diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index a8994f9d7..203718612 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -270,12 +270,9 @@ WebInspector.SourceFrame.prototype = { this._innerSetSelectionIfNeeded(); }, - /** - * @param {boolean} userInput - */ - beforeTextChanged: function(userInput) + beforeTextChanged: function() { - if (userInput) + if (!this._isReplacing) WebInspector.searchController.cancelSearch(); this.clearMessages(); }, @@ -355,7 +352,7 @@ WebInspector.SourceFrame.prototype = { if (shiftToIndex) this._searchResults = this._searchResults.rotate(shiftToIndex); - + callback(this, this._searchResults.length); } @@ -431,17 +428,16 @@ WebInspector.SourceFrame.prototype = { */ replaceSearchMatchWith: function(text) { - this.beforeTextChanged(false); - var range = this._searchResults[this._currentSearchResultIndex]; if (!range) return; this._textEditor.markAndRevealRange(null); - var newRange = this._textModel.editRange(range, text); - this.afterTextChanged(range, newRange); - // Collapse current match so that we don't replace things twice. - this._textEditor.markAndRevealRange(newRange.collapseToEnd()); + this._isReplacing = true; + var newRange = this._textEditor.editRange(range, text); + delete this._isReplacing; + + this._textEditor.setSelection(newRange.collapseToEnd()); }, /** @@ -450,12 +446,15 @@ WebInspector.SourceFrame.prototype = { */ replaceAllWith: function(query, replacement) { - this.beforeTextChanged(false); + this._textEditor.markAndRevealRange(null); + var text = this._textModel.text(); var range = this._textModel.range(); text = text.replace(WebInspector.SourceFrame.createSearchRegex(query, "g"), replacement); - var newRange = this._textModel.editRange(range, text); - this.afterTextChanged(range, newRange); + + this._isReplacing = true; + this._textEditor.editRange(range, text); + delete this._isReplacing; }, _collectRegexMatches: function(regexObject) @@ -645,7 +644,7 @@ WebInspector.TextEditorDelegateForSourceFrame = function(sourceFrame) WebInspector.TextEditorDelegateForSourceFrame.prototype = { beforeTextChanged: function() { - this._sourceFrame.beforeTextChanged(true); + this._sourceFrame.beforeTextChanged(); }, afterTextChanged: function(oldRange, newRange) diff --git a/Source/WebCore/inspector/front-end/TextEditor.js b/Source/WebCore/inspector/front-end/TextEditor.js index 9ca824d1e..fa6f4d209 100644 --- a/Source/WebCore/inspector/front-end/TextEditor.js +++ b/Source/WebCore/inspector/front-end/TextEditor.js @@ -232,6 +232,20 @@ WebInspector.TextEditor.prototype = { this._updatePanelOffsets(); }, + /** + * @param {WebInspector.TextRange} range + * @param {string} text + * @return {WebInspector.TextRange} + */ + editRange: function(range, text) + { + this._enterInternalTextChangeMode(); + this._textModel.markUndoableState(); + var newRange = this._textModel.editRange(range, text); + this._exitInternalTextChangeMode(range, newRange); + return newRange; + }, + _enterInternalTextChangeMode: function() { this._internalTextChangeMode = true; diff --git a/Source/WebCore/inspector/front-end/TimelineModel.js b/Source/WebCore/inspector/front-end/TimelineModel.js index b3b6a6617..a9c49e59a 100644 --- a/Source/WebCore/inspector/front-end/TimelineModel.js +++ b/Source/WebCore/inspector/front-end/TimelineModel.js @@ -35,6 +35,7 @@ WebInspector.TimelineModel = function() { this._records = []; + this._stringPool = new StringPool(); this._minimumRecordTime = -1; this._maximumRecordTime = -1; this._collectionEnabled = false; @@ -152,6 +153,7 @@ WebInspector.TimelineModel.prototype = { _addRecord: function(record) { + this._stringPool.internObjectStrings(record); this._records.push(record); this._updateBoundaries(record); this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordAdded, record); @@ -214,6 +216,7 @@ WebInspector.TimelineModel.prototype = { reset: function() { this._records = []; + this._stringPool.reset(); this._minimumRecordTime = -1; this._maximumRecordTime = -1; this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordsCleared); diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 360ac113b..baf6ab7e4 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -785,8 +785,6 @@ WebInspector.TimelinePanel.prototype = { var endTime = startTime + width * scale; var tasks = this._mainThreadTasks; - if (!tasks.length) - return; function compareEndTime(value, task) { @@ -794,8 +792,6 @@ WebInspector.TimelinePanel.prototype = { } var taskIndex = insertionIndexForObjectInListSortedByFunction(startTime, tasks, compareEndTime); - if (taskIndex === tasks.length) - return; var container = this._cpuBarsElement; var element = container.firstChild.nextSibling; @@ -1048,14 +1044,15 @@ WebInspector.TimelineRecordListRow.prototype = { if (this._dataElement.firstChild) this._dataElement.removeChildren(); - if (record.details) { + var details = record.details(); + if (details) { var detailsContainer = document.createElement("span"); - if (typeof record.details === "object") { + if (typeof details === "object") { detailsContainer.appendChild(document.createTextNode("(")); - detailsContainer.appendChild(record.details); + detailsContainer.appendChild(details); detailsContainer.appendChild(document.createTextNode(")")); } else - detailsContainer.textContent = "(" + record.details + ")"; + detailsContainer.textContent = "(" + details + ")"; this._dataElement.appendChild(detailsContainer); } }, diff --git a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js index 02ad99051..50a9cae75 100644 --- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +++ b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js @@ -57,12 +57,12 @@ WebInspector.TimelinePresentationModel.categories = function() }; /** - * @param {Object} record + * @return {!Object.<string, {title: string, category}>} */ -WebInspector.TimelinePresentationModel.recordStyle = function(record) +WebInspector.TimelinePresentationModel.initRecordStyles_ = function() { if (WebInspector.TimelinePresentationModel._recordStylesMap) - return WebInspector.TimelinePresentationModel._recordStylesMap[record.type]; + return WebInspector.TimelinePresentationModel._recordStylesMap; var recordTypes = WebInspector.TimelineModel.RecordType; var categories = WebInspector.TimelinePresentationModel.categories(); @@ -100,7 +100,24 @@ WebInspector.TimelinePresentationModel.recordStyle = function(record) recordStyles[recordTypes.FireAnimationFrame] = { title: WebInspector.UIString("Animation Frame Fired"), category: categories["scripting"] }; WebInspector.TimelinePresentationModel._recordStylesMap = recordStyles; - return recordStyles[record.type]; + return recordStyles; +} + +/** + * @param {Object} record + */ +WebInspector.TimelinePresentationModel.recordStyle = function(record) +{ + var recordStyles = WebInspector.TimelinePresentationModel.initRecordStyles_(); + var result = recordStyles[record.type]; + if (!result) { + result = { + title: WebInspector.UIString("Unknown: %s", record.type), + category: WebInspector.TimelinePresentationModel.categories()["program"] + }; + recordStyles[record.type] = result; + } + return result; } WebInspector.TimelinePresentationModel.categoryForRecord = function(record) @@ -385,31 +402,18 @@ WebInspector.TimelinePresentationModel.prototype.__proto__ = WebInspector.Object */ WebInspector.TimelinePresentationModel.Record = function(presentationModel, record, parentRecord, scriptDetails) { - this._presentationModel = presentationModel; - this._linkifier = this._presentationModel._linkifier; + this._linkifier = presentationModel._linkifier; this._aggregatedStats = []; - var recordTypes = WebInspector.TimelineModel.RecordType; - var style = WebInspector.TimelinePresentationModel.recordStyle(record); + this._record = record; + this._children = []; this.parent = parentRecord; if (parentRecord) parentRecord.children.push(this); - this.category = style.category; - this.title = record.type === recordTypes.TimeStamp ? record.data["message"] : style.title; - this.startTime = WebInspector.TimelineModel.startTimeInSeconds(record); - this.data = record.data; - this.type = record.type; - this.frameId = record.frameId; - this.endTime = WebInspector.TimelineModel.endTimeInSeconds(record); + this._selfTime = this.endTime - this.startTime; this._lastChildEndTime = this.endTime; - this._initiatorOffset = (parentRecord && parentRecord !== presentationModel._rootRecord) ? - parentRecord._initiatorOffset + this.startTime - parentRecord.startTime : 0; this._startTimeOffset = this.startTime - presentationModel._minimumRecordTime; - if (record.stackTrace && record.stackTrace.length) - this.stackTrace = record.stackTrace; - this.totalHeapSize = record.totalHeapSize; - this.usedHeapSize = record.usedHeapSize; if (record.data && record.data["url"]) this.url = record.data["url"]; if (scriptDetails) { @@ -417,6 +421,7 @@ WebInspector.TimelinePresentationModel.Record = function(presentationModel, reco this.scriptLine = scriptDetails.scriptLine; } + var recordTypes = WebInspector.TimelineModel.RecordType; switch (record.type) { case recordTypes.ResourceSendRequest: // Make resource receive record last since request was sent; make finish record last since response received. @@ -483,7 +488,6 @@ WebInspector.TimelinePresentationModel.Record = function(presentationModel, reco } break; } - this._refreshDetails(); } WebInspector.TimelinePresentationModel.Record.prototype = { @@ -517,23 +521,113 @@ WebInspector.TimelinePresentationModel.Record.prototype = { return (this._lastChildEndTime - this.startTime) > WebInspector.TimelinePresentationModel.shortRecordThreshold; }, + /** + * @return {Array.<WebInspector.TimelinePresentationModel.Record>} + */ get children() { - if (!this._children) - this._children = []; return this._children; }, + /** + * @return {number} + */ get visibleChildrenCount() { return this._visibleChildrenCount || 0; }, + /** + * @return {number} + */ get invisibleChildrenCount() { return this._invisibleChildrenCount || 0; }, + /** + * @return {WebInspector.TimelineCategory} + */ + get category() + { + return WebInspector.TimelinePresentationModel.recordStyle(this._record).category + }, + + /** + * @return {string} + */ + get title() + { + return this.type === WebInspector.TimelineModel.RecordType.TimeStamp ? this._record.data["message"] : + WebInspector.TimelinePresentationModel.recordStyle(this._record).title; + }, + + /** + * @return {number} + */ + get startTime() + { + return WebInspector.TimelineModel.startTimeInSeconds(this._record); + }, + + /** + * @return {number} + */ + get endTime() + { + return WebInspector.TimelineModel.endTimeInSeconds(this._record); + }, + + /** + * @return {Object} + */ + get data() + { + return this._record.data; + }, + + /** + * @return {string} + */ + get type() + { + return this._record.type; + }, + + /** + * @return {string} + */ + get frameId() + { + return this._record.frameId; + }, + + /** + * @return {number} + */ + get totalHeapSize() + { + return this._record.totalHeapSize; + }, + + /** + * @return {number} + */ + get usedHeapSize() + { + return this._record.usedHeapSize; + }, + + /** + * @return {Array.<DebuggerAgent.CallFrame>?} + */ + get stackTrace() + { + if (this._record.stackTrace && this._record.stackTrace.length) + return this._record.stackTrace; + return null; + }, + containsTime: function(time) { return this.startTime <= time && time <= this.endTime; @@ -547,7 +641,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = { Number.secondsToString(this._startTimeOffset)); contentHelper._appendTextRow(WebInspector.UIString("Duration"), text); - if (this._children && this._children.length) { + if (this._children.length) { contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime, true)); contentHelper._appendTextRow(WebInspector.UIString("CPU Time"), Number.secondsToString(this._cpuTime, true)); contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"), @@ -605,8 +699,8 @@ WebInspector.TimelinePresentationModel.Record.prototype = { contentHelper._appendTextRow(WebInspector.UIString("Interval Duration"), Number.secondsToString(this.intervalDuration, true)); break; default: - if (this.details) - contentHelper._appendTextRow(WebInspector.UIString("Details"), this.details); + if (this.details()) + contentHelper._appendTextRow(WebInspector.UIString("Details"), this.details()); break; } @@ -627,7 +721,17 @@ WebInspector.TimelinePresentationModel.Record.prototype = { _refreshDetails: function() { - this.details = this._getRecordDetails(); + delete this._details; + }, + + /** + * @return {Object?|string} + */ + details: function() + { + if (!this._details) + this._details = this._getRecordDetails(); + return this._details; }, _getRecordDetails: function() @@ -667,7 +771,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = { case WebInspector.TimelineModel.RecordType.TimeStamp: return this.data["message"]; default: - return null; + return this._linkifyScriptLocation() || this._linkifyTopCallFrame() || null; } }, @@ -712,15 +816,13 @@ WebInspector.TimelinePresentationModel.Record.prototype = { this._aggregatedStats[category] = 0; this._cpuTime = this._selfTime; - if (this._children) { - for (var index = this._children.length; index; --index) { - var child = this._children[index - 1]; - for (var category in categories) - this._aggregatedStats[category] += child._aggregatedStats[category]; - } - for (var category in this._aggregatedStats) - this._cpuTime += this._aggregatedStats[category]; + for (var index = this._children.length; index; --index) { + var child = this._children[index - 1]; + for (var category in categories) + this._aggregatedStats[category] += child._aggregatedStats[category]; } + for (var category in this._aggregatedStats) + this._cpuTime += this._aggregatedStats[category]; this._aggregatedStats[this.category.name] += this._selfTime; }, diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index b4fc85fd5..0f137fcfc 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -57,6 +57,7 @@ <file>ExtensionPanel.js</file> <file>ExtensionRegistryStub.js</file> <file>ExtensionServer.js</file> + <file>ExtensionView.js</file> <file>FileContentView.js</file> <file>FileManager.js</file> <file>FileSystemModel.js</file> @@ -78,7 +79,6 @@ <file>ImageView.js</file> <file>IndexedDBModel.js</file> <file>IndexedDBViews.js</file> - <file>InjectedFakeWorker.js</file> <file>inspector.js</file> <file>InspectorBackend.js</file> <file>InspectorFrontendAPI.js</file> diff --git a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js index 34826b52c..efa592161 100644 --- a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js +++ b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js @@ -30,86 +30,6 @@ /** * @constructor - * @extends {WebInspector.SidebarPane} - */ -WebInspector.WorkersSidebarPane = function() -{ - WebInspector.SidebarPane.call(this, WebInspector.UIString("Workers")); - - this._workers = {}; - - this._enableWorkersCheckbox = new WebInspector.Checkbox( - WebInspector.UIString("Debug"), - "sidebar-pane-subtitle", - WebInspector.UIString("Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation")); - this.titleElement.insertBefore(this._enableWorkersCheckbox.element, this.titleElement.firstChild); - - this._enableWorkersCheckbox.addEventListener(this._onTriggerInstrument.bind(this)); - this._enableWorkersCheckbox.checked = false; - - this._listElement = document.createElement("ol"); - this._listElement.className = "workers-list"; - - this.bodyElement.appendChild(this._listElement); - this._treeOutline = new TreeOutline(this._listElement); -} - -WebInspector.WorkersSidebarPane.prototype = { - addWorker: function(id, url, isShared) - { - if (id in this._workers) - return; - var worker = new WebInspector.Worker(id, url, isShared); - this._workers[id] = worker; - - var title = WebInspector.linkifyURLAsNode(url, WebInspector.displayNameForURL(url), "worker-item", true, url); - this._treeOutline.appendChild(new TreeElement(title, worker, false)); - }, - - removeWorker: function(id) - { - if (id in this._workers) { - this._treeOutline.removeChild(this._treeOutline.getCachedTreeElement(this._workers[id])); - delete this._workers[id]; - } - }, - - _setInstrumentation: function(enabled) - { - if (!enabled === !this._fakeWorkersScriptIdentifier) - return; - - if (enabled) { - this._enableWorkersCheckbox.disabled = true; - function callback(error, identifier) - { - this._fakeWorkersScriptIdentifier = identifier; - this._enableWorkersCheckbox.disabled = false; - } - PageAgent.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")", callback.bind(this)); - } else { - PageAgent.removeScriptToEvaluateOnLoad(this._fakeWorkersScriptIdentifier); - this._fakeWorkersScriptIdentifier = null; - } - }, - - reset: function() - { - this._setInstrumentation(this._enableWorkersCheckbox.checked); - this._treeOutline.removeChildren(); - this._workers = {}; - }, - - _onTriggerInstrument: function(event) - { - this._setInstrumentation(this._enableWorkersCheckbox.checked); - } -}; - -WebInspector.WorkersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; - -/** - * @constructor */ WebInspector.Worker = function(id, url, shared) { @@ -122,7 +42,7 @@ WebInspector.Worker = function(id, url, shared) * @constructor * @extends {WebInspector.SidebarPane} */ -WebInspector.WorkerListSidebarPane = function(workerManager) +WebInspector.WorkersSidebarPane = function(workerManager) { WebInspector.SidebarPane.call(this, WebInspector.UIString("Workers")); @@ -159,7 +79,7 @@ WebInspector.WorkerListSidebarPane = function(workerManager) workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkersCleared, this._workersCleared, this); } -WebInspector.WorkerListSidebarPane.prototype = { +WebInspector.WorkersSidebarPane.prototype = { _workerAdded: function(event) { this._addWorker(event.data.workerId, event.data.url, event.data.inspectorConnected); @@ -201,4 +121,4 @@ WebInspector.WorkerListSidebarPane.prototype = { } } -WebInspector.WorkerListSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; +WebInspector.WorkersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js index cbc827153..3f179751d 100644 --- a/Source/WebCore/inspector/front-end/externs.js +++ b/Source/WebCore/inspector/front-end/externs.js @@ -155,8 +155,6 @@ WebInspector.showConsole = function() {} */ WebInspector.evaluateInConsole = function(expression, showResultOnly) {} -var InjectedFakeWorker = function() {} - WebInspector.queryParamsObject = {} WebInspector.Events = { diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index f8faae15b..fdebbb998 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -269,14 +269,20 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { padding: 0 2px; margin: 0; width: 165px; - position: relative; - top: 1px; } .search-replace:focus { outline: none; } +.toolbar-search { + border-spacing: 1px; +} + +.toolbar-search td { + padding: 0 5px 0 0; +} + .toolbar-search-navigation-controls { position: absolute; top: 0; @@ -299,11 +305,6 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { opacity: 1.0; } -.toolbar-search { - line-height: 19px; - height: 22px; -} - .toolbar-search input[type="checkbox"] { position: relative; margin-top: -1px; @@ -314,9 +315,10 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { .toolbar-search button { border: 1px solid rgb(163, 163, 163); border-radius: 12px; - margin: 0 0 0 6px; + margin: 0 6px; font-size: 11px; background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220)); + width: 100%; } .toolbar-search button:active { @@ -328,17 +330,16 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { position: relative; background-color: white; border: 1px solid rgb(163, 163, 163); - margin: 1px 2px 1px 5px; height: 20px; border-radius: 2px; - padding-right: 36px; + padding-top: 1px; } .toolbar-replace-control { border: 1px solid rgb(163, 163, 163); height: 20px; border-radius: 2px; - margin-left: 5px; + width: 100%; } .toolbar-search-navigation.enabled:active { @@ -561,15 +562,16 @@ body.drawer-visible #main-panels { .glyph { position: absolute; top: -1px; + bottom: 1px; left: 0; right: 0; - bottom: 0; background-color: rgba(0, 0, 0, 0.75); z-index: 1; } .glyph.shadow { - top: 1px; + top: 0; + bottom: 0; background-color: white !important; z-index: 0; } @@ -594,6 +596,10 @@ button.status-bar-item { border-right: 1px solid rgb(202, 202, 202); } +.status-bar button.status-bar-item .glyph { + margin: 0 -1px; +} + .status-bar select.status-bar-item:active, .status-bar button.status-bar-item:active { background-color: rgb(163,163,163); @@ -624,7 +630,7 @@ button.status-bar-item.extension { background-image: url(Images/disclosureTriangleSmallDown.png); background-repeat: no-repeat; background-position-x: right; - background-position-y: 6px; + background-position-y: 5px; padding-right: 10px; border-right: 5px solid transparent; } @@ -641,6 +647,7 @@ select.status-bar-item { margin-right: -15px; position: relative; top: -1px; + height: 23px; } select.status-bar-item, select.status-bar-item:hover { @@ -2866,5 +2873,4 @@ body.platform-mac #drawer-status-bar .search-status-bar-progress { right: 0; font-size: 11px; height: auto; - padding-left: 5px; } diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html index 0f165d3e3..159798baa 100644 --- a/Source/WebCore/inspector/front-end/inspector.html +++ b/Source/WebCore/inspector/front-end/inspector.html @@ -119,7 +119,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StatusBarButton.js"></script> <script type="text/javascript" src="ElementsPanel.js"></script> <script type="text/javascript" src="NetworkPanel.js"></script> - <script type="text/javascript" src="InjectedFakeWorker.js"></script> <script type="text/javascript" src="TextEditor.js"></script> <script type="text/javascript" src="SourceFrame.js"></script> <script type="text/javascript" src="ResourceView.js"></script> @@ -136,6 +135,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="ExtensionAPI.js"></script> <script type="text/javascript" src="ExtensionAuditCategory.js"></script> <script type="text/javascript" src="ExtensionServer.js"></script> + <script type="text/javascript" src="ExtensionView.js"></script> <script type="text/javascript" src="ExtensionPanel.js"></script> <script type="text/javascript" src="AuditsPanel.js"></script> <script type="text/javascript" src="AuditResultView.js"></script> diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 1e6a01294..6db92866a 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -882,20 +882,6 @@ WebInspector.bringToFront = function() InspectorFrontendHost.bringToFront(); } -WebInspector.didCreateWorker = function() -{ - var workersPane = WebInspector.panels.scripts.sidebarPanes.workers; - if (workersPane) - workersPane.addWorker.apply(workersPane, arguments); -} - -WebInspector.didDestroyWorker = function() -{ - var workersPane = WebInspector.panels.scripts.sidebarPanes.workers; - if (workersPane) - workersPane.removeWorker.apply(workersPane, arguments); -} - /** * @param {string=} messageLevel * @param {boolean=} showConsole diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js index 01ed7e86c..35e0620e9 100644 --- a/Source/WebCore/inspector/front-end/utilities.js +++ b/Source/WebCore/inspector/front-end/utilities.js @@ -709,3 +709,59 @@ Map.prototype = { this._map = {}; } }; + + +/** + * @constructor + */ +function StringPool() +{ + this.reset(); +} + +StringPool.prototype = { + /** + * @param {string} string + * @return {string} + */ + intern: function(string) + { + // Do not mess with setting __proto__ to anything but null, just handle it explicitly. + if (string === "__proto__") + return "__proto__"; + var result = this._strings[string]; + if (result === undefined) { + this._strings[string] = string; + result = string; + } + return result; + }, + + reset: function() + { + this._strings = Object.create(null); + }, + + /** + * @param {Object} obj + * @param {number=} depthLimit + */ + internObjectStrings: function(obj, depthLimit) + { + if (typeof depthLimit !== "number") + depthLimit = 100; + else if (--depthLimit < 0) + throw "recursion depth limit reached in StringPool.deepIntern(), perhaps attempting to traverse cyclical references?"; + + for (var field in obj) { + switch (typeof obj[field]) { + case "string": + obj[field] = this.intern(obj[field]); + break; + case "object": + this.internObjectStrings(obj[field], depthLimit); + break; + } + } + } +} diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index f4d1209f0..e897f8a4e 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -125,6 +125,15 @@ inline Document* ImageLoader::document() void ImageLoader::setImage(CachedImage* newImage) { + setImageWithoutConsideringPendingLoadEvent(newImage); + + // Only consider updating the protection ref-count of the Element immediately before returning + // from this function as doing so might result in the destruction of this ImageLoader. + updatedHasPendingLoadEvent(); +} + +void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newImage) +{ ASSERT(m_failedLoadURL.isEmpty()); CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { @@ -150,10 +159,6 @@ void ImageLoader::setImage(CachedImage* newImage) if (RenderImageResource* imageResource = renderImageResource()) imageResource->resetAnimation(); - - // Only consider updating the protection ref-count of the Element immediately before returning - // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); } void ImageLoader::updateFromElement() @@ -263,7 +268,7 @@ void ImageLoader::notifyFinished(CachedResource* resource) && !document()->securityOrigin()->canRequest(image()->response().url()) && !resource->passesAccessControlCheck(document()->securityOrigin())) { - setImage(0); + setImageWithoutConsideringPendingLoadEvent(0); m_hasPendingErrorEvent = true; errorEventSender().dispatchEventSoon(this); @@ -272,6 +277,10 @@ void ImageLoader::notifyFinished(CachedResource* resource) document()->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage); ASSERT(!m_hasPendingLoadEvent); + + // Only consider updating the protection ref-count of the Element immediately before returning + // from this function as doing so might result in the destruction of this ImageLoader. + updatedHasPendingLoadEvent(); return; } diff --git a/Source/WebCore/loader/ImageLoader.h b/Source/WebCore/loader/ImageLoader.h index 269fa67be..178807198 100644 --- a/Source/WebCore/loader/ImageLoader.h +++ b/Source/WebCore/loader/ImageLoader.h @@ -91,6 +91,8 @@ private: RenderImageResource* renderImageResource(); void updateRenderer(); + void setImageWithoutConsideringPendingLoadEvent(CachedImage*); + ImageLoaderClient* m_client; CachedResourceHandle<CachedImage> m_image; AtomicString m_failedLoadURL; diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 6093652d0..fe7d1f9f2 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -266,7 +266,11 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, switch (contentPolicy) { case PolicyUse: { // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255). - bool isRemoteWebArchive = (equalIgnoringCase("application/x-webarchive", mimeType) || equalIgnoringCase("multipart/related", mimeType)) + bool isRemoteWebArchive = (equalIgnoringCase("application/x-webarchive", mimeType) +#if PLATFORM(GTK) + || equalIgnoringCase("message/rfc822", mimeType) +#endif + || equalIgnoringCase("multipart/related", mimeType)) && !m_substituteData.isValid() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()); if (!frameLoader()->client()->canShowMIMEType(mimeType) || isRemoteWebArchive) { frameLoader()->policyChecker()->cannotShowMIMEType(r); diff --git a/Source/WebCore/loader/archive/ArchiveFactory.cpp b/Source/WebCore/loader/archive/ArchiveFactory.cpp index 521deb1d7..f6970aa53 100644 --- a/Source/WebCore/loader/archive/ArchiveFactory.cpp +++ b/Source/WebCore/loader/archive/ArchiveFactory.cpp @@ -68,6 +68,9 @@ static ArchiveMIMETypesMap& archiveMIMETypes() #endif #if ENABLE(MHTML) mimeTypes.set("multipart/related", archiveFactoryCreate<MHTMLArchive>); +#if PLATFORM(GTK) + mimeTypes.set("message/rfc822", archiveFactoryCreate<MHTMLArchive>); +#endif #endif initialized = true; diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 986cbd882..3f4749f27 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -135,7 +135,7 @@ module window { attribute [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] DOMWindow opener; attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow parent; - attribute [Replaceable, DoNotCheckSecurityOnGetter, V8Unforgeable, V8ReadOnly] DOMWindow top; + readonly attribute [DoNotCheckSecurityOnGetter, V8Unforgeable] DOMWindow top; // DOM Level 2 AbstractView Interface readonly attribute Document document; @@ -406,7 +406,7 @@ module window { attribute HTMLButtonElementConstructor HTMLButtonElement; attribute HTMLCanvasElementConstructor HTMLCanvasElement; attribute HTMLDListElementConstructor HTMLDListElement; - attribute [Conditional=DATALIST] HTMLDataListElementConstructor HTMLDataListElement; + attribute [Conditional=DATALIST_ELEMENT] HTMLDataListElementConstructor HTMLDataListElement; attribute [Conditional=DIALOG_ELEMENT, V8EnabledPerContext=dialogElement] HTMLDialogElementConstructor HTMLDialogElement; attribute HTMLDirectoryElementConstructor HTMLDirectoryElement; attribute HTMLDivElementConstructor HTMLDivElement; @@ -432,7 +432,7 @@ module window { attribute HTMLMarqueeElementConstructor HTMLMarqueeElement; attribute HTMLMenuElementConstructor HTMLMenuElement; attribute HTMLMetaElementConstructor HTMLMetaElement; -#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG +#if defined(ENABLE_METER_ELEMENT) && ENABLE_METER_ELEMENT attribute HTMLMeterElementConstructor HTMLMeterElement; #endif attribute HTMLModElementConstructor HTMLModElement; @@ -444,7 +444,7 @@ module window { attribute HTMLParagraphElementConstructor HTMLParagraphElement; attribute HTMLParamElementConstructor HTMLParamElement; attribute HTMLPreElementConstructor HTMLPreElement; -#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG +#if defined(ENABLE_PROGRESS_ELEMENT) && ENABLE_PROGRESS_ELEMENT attribute HTMLProgressElementConstructor HTMLProgressElement; #endif attribute HTMLQuoteElementConstructor HTMLQuoteElement; diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index fc3ec9e8a..5146e735f 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -1108,10 +1108,9 @@ DragImageRef Frame::nodeImage(Node* node) paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), 1, ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB)); if (!buffer) return 0; - buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY())); @@ -1138,10 +1137,9 @@ DragImageRef Frame::dragImageForSelection() paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), 1, ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB)); if (!buffer) return 0; - buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY())); diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 6c3d37337..d8823bd95 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -185,7 +185,9 @@ Settings::Settings(Page* page) , m_needsSiteSpecificQuirks(false) , m_fontRenderingMode(0) , m_frameFlatteningEnabled(false) +#if ENABLE(WEB_ARCHIVE) , m_webArchiveDebugModeEnabled(false) +#endif , m_localFileContentSniffingEnabled(false) , m_inApplicationChromeMode(false) , m_offlineWebApplicationCacheEnabled(false) diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 3b23d625b..5be49dff1 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -680,7 +680,9 @@ namespace WebCore { bool m_needsSiteSpecificQuirks : 1; unsigned m_fontRenderingMode : 1; bool m_frameFlatteningEnabled : 1; +#if ENABLE(WEB_ARCHIVE) bool m_webArchiveDebugModeEnabled : 1; +#endif bool m_localFileContentSniffingEnabled : 1; bool m_inApplicationChromeMode : 1; bool m_offlineWebApplicationCacheEnabled : 1; diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp index cd460c0b7..cf4ba1bb3 100644 --- a/Source/WebCore/page/TouchAdjustment.cpp +++ b/Source/WebCore/page/TouchAdjustment.cpp @@ -239,6 +239,76 @@ float zoomableIntersectionQuotient(const IntPoint& touchHotspot, const IntRect& return rect.size().area() / (float)intersection.size().area(); } +FloatPoint contentsToWindow(FrameView *view, FloatPoint pt) +{ + int x = static_cast<int>(pt.x() + 0.5f); + int y = static_cast<int>(pt.y() + 0.5f); + IntPoint adjusted = view->contentsToWindow(IntPoint(x, y)); + return FloatPoint(adjusted.x(), adjusted.y()); +} + +bool snapTo(const SubtargetGeometry& geom, const IntPoint& touchPoint, const IntRect& touchArea, IntPoint& adjustedPoint) +{ + FrameView* view = geom.node()->document()->view(); + FloatQuad quad = geom.quad(); + + if (quad.isRectilinear()) { + IntRect contentBounds = geom.boundingBox(); + // Convert from frame coordinates to window coordinates. + IntRect bounds = view->contentsToWindow(contentBounds); + if (bounds.contains(touchPoint)) { + adjustedPoint = touchPoint; + return true; + } + if (bounds.intersects(touchArea)) { + bounds.intersect(touchArea); + adjustedPoint = bounds.center(); + return true; + } + return false; + } + + // Non-rectilinear element. + // Convert quad from content to window coordinates. + FloatPoint p1 = contentsToWindow(view, quad.p1()); + FloatPoint p2 = contentsToWindow(view, quad.p2()); + FloatPoint p3 = contentsToWindow(view, quad.p3()); + FloatPoint p4 = contentsToWindow(view, quad.p4()); + quad = FloatQuad(p1, p2, p3, p4); + + if (quad.containsPoint(touchPoint)) { + adjustedPoint = touchPoint; + return true; + } + + // Pull point towards the center of the element. + float cx = 0.25 * (p1.x() + p2.x() + p3.x() + p4.x()); + float cy = 0.25 * (p1.y() + p2.y() + p3.y() + p4.y()); + FloatPoint center = FloatPoint(cx, cy); + + FloatSize pullDirection = center - touchPoint; + float distanceToCenter = pullDirection.diagonalLength(); + + // Use distance from center to corner of touch area to limit adjustment distance. + float dx = 0.5f * touchArea.width(); + float dy = 0.5f * touchArea.height(); + float touchRadius = sqrt(dx * dx + dy * dy); + + float scaleFactor = touchRadius / distanceToCenter; + if (scaleFactor > 1) + scaleFactor = 1; + pullDirection.scale(scaleFactor); + + int x = static_cast<int>(touchPoint.x() + pullDirection.width()); + int y = static_cast<int>(touchPoint.y() + pullDirection.height()); + IntPoint point(x, y); + + if (quad.containsPoint(point)) { + adjustedPoint = point; + return true; + } + return false; +} // A generic function for finding the target node with the lowest distance metric. A distance metric here is the result // of a distance-like function, that computes how well the touch hits the node. @@ -249,17 +319,21 @@ bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, float bestDistanceMetric = std::numeric_limits<float>::infinity(); SubtargetGeometryList::const_iterator it = subtargets.begin(); const SubtargetGeometryList::const_iterator end = subtargets.end(); + IntPoint adjustedPoint; for (; it != end; ++it) { Node* node = it->node(); float distanceMetric = distanceFunction(touchHotspot, touchArea, *it); if (distanceMetric < bestDistanceMetric) { - targetPoint = roundedIntPoint(it->quad().center()); - targetArea = it->boundingBox(); - targetNode = node; - bestDistanceMetric = distanceMetric; + if (snapTo(*it, touchHotspot, touchArea, adjustedPoint)) { + targetPoint = adjustedPoint; + targetArea = it->boundingBox(); + targetNode = node; + bestDistanceMetric = distanceMetric; + } } else if (distanceMetric == bestDistanceMetric) { // Try to always return the inner-most element. - if (node->isDescendantOf(targetNode)) { + if (node->isDescendantOf(targetNode) && snapTo(*it, touchHotspot, touchArea, adjustedPoint)) { + targetPoint = adjustedPoint; targetNode = node; targetArea = it->boundingBox(); } @@ -267,9 +341,7 @@ bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, } if (targetNode) { targetArea = targetNode->document()->view()->contentsToWindow(targetArea); - targetPoint = targetNode->document()->view()->contentsToWindow(targetPoint); } - return (targetNode); } diff --git a/Source/WebCore/platform/ColorChooserClient.h b/Source/WebCore/platform/ColorChooserClient.h index 54fa5cc01..b39c037ce 100644 --- a/Source/WebCore/platform/ColorChooserClient.h +++ b/Source/WebCore/platform/ColorChooserClient.h @@ -4,6 +4,7 @@ #if ENABLE(INPUT_TYPE_COLOR) #include "ColorChooser.h" +#include "IntRect.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -17,6 +18,7 @@ public: virtual void didChooseColor(const Color&) = 0; virtual void didEndChooser() = 0; + virtual IntRect elementRectRelativeToWindow() const = 0; }; } // namespace WebCore diff --git a/Source/WebCore/platform/audio/FFTFrameStub.cpp b/Source/WebCore/platform/audio/FFTFrameStub.cpp index 19a800d35..6a27be5f6 100644 --- a/Source/WebCore/platform/audio/FFTFrameStub.cpp +++ b/Source/WebCore/platform/audio/FFTFrameStub.cpp @@ -69,7 +69,7 @@ void FFTFrame::multiply(const FFTFrame& frame) ASSERT_NOT_REACHED(); } -void FFTFrame::doFFT(float* data) +void FFTFrame::doFFT(const float* data) { ASSERT_NOT_REACHED(); } diff --git a/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp b/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp index 40f8925a5..dd8ace385 100644 --- a/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp +++ b/Source/WebCore/platform/chromium/DragImageChromiumSkia.cpp @@ -47,11 +47,13 @@ IntSize dragImageSize(DragImageRef image) if (!image) return IntSize(); - return IntSize(image->width(), image->height()); + return IntSize(image->bitmap->width(), image->bitmap->height()); } void deleteDragImage(DragImageRef image) { + if (image) + delete image->bitmap; delete image; } @@ -60,13 +62,14 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize scale) if (!image) return 0; - int imageWidth = scale.width() * image->width(); - int imageHeight = scale.height() * image->height(); - DragImageRef scaledImage = new SkBitmap( - skia::ImageOperations::Resize(*image, skia::ImageOperations::RESIZE_LANCZOS3, + int imageWidth = scale.width() * image->bitmap->width(); + int imageHeight = scale.height() * image->bitmap->height(); + SkBitmap* scaledImage = new SkBitmap( + skia::ImageOperations::Resize(*image->bitmap, skia::ImageOperations::RESIZE_LANCZOS3, imageWidth, imageHeight)); - delete image; - return scaledImage; + delete image->bitmap; + image->bitmap = scaledImage; + return image; } DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) @@ -74,12 +77,12 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) if (!image) return 0; - image->setIsOpaque(false); - image->lockPixels(); + image->bitmap->setIsOpaque(false); + image->bitmap->lockPixels(); - for (int row = 0; row < image->height(); ++row) { - for (int column = 0; column < image->width(); ++column) { - uint32_t* pixel = image->getAddr32(column, row); + for (int row = 0; row < image->bitmap->height(); ++row) { + for (int column = 0; column < image->bitmap->width(); ++column) { + uint32_t* pixel = image->bitmap->getAddr32(column, row); *pixel = SkPreMultiplyARGB(SkColorGetA(*pixel) * fraction, SkColorGetR(*pixel), SkColorGetG(*pixel), @@ -87,7 +90,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) } } - image->unlockPixels(); + image->bitmap->unlockPixels(); return image; } @@ -103,7 +106,10 @@ DragImageRef createDragImageFromImage(Image* image, RespectImageOrientationEnum) SkBitmap* dragImage = new SkBitmap(); bitmap->bitmap().copyTo(dragImage, SkBitmap::kARGB_8888_Config); - return dragImage; + DragImageChromium* dragImageChromium = new DragImageChromium; + dragImageChromium->bitmap = dragImage; + dragImageChromium->resolutionScale = bitmap->resolutionScale(); + return dragImageChromium; } DragImageRef createDragImageIconForCachedImage(CachedImage*) diff --git a/Source/WebCore/platform/chromium/DragImageRef.h b/Source/WebCore/platform/chromium/DragImageRef.h index 7a6aca889..0d03262ff 100644 --- a/Source/WebCore/platform/chromium/DragImageRef.h +++ b/Source/WebCore/platform/chromium/DragImageRef.h @@ -33,7 +33,12 @@ class SkBitmap; namespace WebCore { -typedef SkBitmap* DragImageRef; +struct DragImageChromium { + SkBitmap* bitmap; + float resolutionScale; +}; + +typedef DragImageChromium* DragImageRef; } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/PlatformSupport.h b/Source/WebCore/platform/chromium/PlatformSupport.h index f4e5ce519..c113f8ffd 100644 --- a/Source/WebCore/platform/chromium/PlatformSupport.h +++ b/Source/WebCore/platform/chromium/PlatformSupport.h @@ -117,18 +117,6 @@ public: // Forms -------------------------------------------------------------- static void notifyFormStateChanged(const Document*); - // Databases ---------------------------------------------------------- - // Returns a handle to the DB file and ooptionally a handle to its containing directory - static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags); - // Returns a SQLite code (SQLITE_OK = 0, on success) - static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false); - // Returns the attributes of the DB file - static long databaseGetFileAttributes(const String& vfsFileName); - // Returns the size of the DB file - static long long databaseGetFileSize(const String& vfsFileName); - // Returns the space available for the origin - static long long databaseGetSpaceAvailableForOrigin(const String& originIdentifier); - // IndexedDB ---------------------------------------------------------- static PassRefPtr<IDBFactoryBackendInterface> idbFactory(); // Extracts keyPath from values and returns the corresponding keys. diff --git a/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp index 63a29314d..2b5eabd05 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp @@ -31,15 +31,16 @@ using namespace WebCore; namespace WebKit { -PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) { - return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId)); + return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId, orientation)); } -WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::IOSurfaceContent, quadRect) , m_ioSurfaceSize(ioSurfaceSize) , m_ioSurfaceTextureId(ioSurfaceTextureId) + , m_orientation(orientation) { } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp index 7a02ca0ea..6d617cd84 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp @@ -41,6 +41,7 @@ namespace WebKit { WebCompositorQuad::WebCompositorQuad(const WebCompositorSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) : m_sharedQuadState(sharedQuadState) + , m_sharedQuadStateId(sharedQuadState->id) , m_material(material) , m_quadRect(quadRect) , m_quadVisibleRect(quadRect) @@ -94,4 +95,10 @@ unsigned WebCompositorQuad::size() const return sizeof(WebCompositorQuad); } +void WebCompositorQuad::setSharedQuadState(const WebCompositorSharedQuadState* sharedQuadState) +{ + m_sharedQuadState = sharedQuadState; + m_sharedQuadStateId = sharedQuadState->id; +} + } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp index 313564c00..91ef3eaf9 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp @@ -36,18 +36,20 @@ using WebCore::IntRect; namespace WebKit { WebCompositorSharedQuadState::WebCompositorSharedQuadState() - : opacity(0) + : id(0) + , opacity(0) , opaque(false) { } -PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) +PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(int id, const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) { - return adoptPtr(new WebCompositorSharedQuadState(quadTransform, visibleContentRect, scissorRect, opacity, opaque)); + return adoptPtr(new WebCompositorSharedQuadState(id, quadTransform, visibleContentRect, scissorRect, opacity, opaque)); } -WebCompositorSharedQuadState::WebCompositorSharedQuadState(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) - : quadTransform(quadTransform) +WebCompositorSharedQuadState::WebCompositorSharedQuadState(int id, const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) + : id(id) + , quadTransform(quadTransform) , visibleContentRect(visibleContentRect) , scissorRect(scissorRect) , opacity(opacity) diff --git a/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp index e5f45fdc4..dd0b67a41 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp @@ -31,14 +31,14 @@ using namespace WebCore; namespace WebKit { -PassOwnPtr<WebCompositorTextureQuad> WebCompositorTextureQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +PassOwnPtr<WebCompositorTextureQuad> WebCompositorTextureQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) { - return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped)); + return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, resourceId, premultipliedAlpha, uvRect, flipped)); } -WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TextureContent, quadRect) - , m_textureId(textureId) + , m_resourceId(resourceId) , m_premultipliedAlpha(premultipliedAlpha) , m_uvRect(uvRect) , m_flipped(flipped) diff --git a/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp index 27aa77508..de0e81dfc 100644 --- a/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp @@ -31,14 +31,14 @@ using namespace WebCore; namespace WebKit { -PassOwnPtr<WebCompositorTileQuad> WebCompositorTileQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +PassOwnPtr<WebCompositorTileQuad> WebCompositorTileQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) { - return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } -WebCompositorTileQuad::WebCompositorTileQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +WebCompositorTileQuad::WebCompositorTileQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TiledContent, quadRect) - , m_textureId(textureId) + , m_resourceId(resourceId) , m_textureOffset(textureOffset) , m_textureSize(textureSize) , m_textureFilter(textureFilter) diff --git a/Source/WebCore/platform/efl/ErrorsEfl.cpp b/Source/WebCore/platform/efl/ErrorsEfl.cpp new file mode 100644 index 000000000..106f8776e --- /dev/null +++ b/Source/WebCore/platform/efl/ErrorsEfl.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ErrorsEfl.h" + +#include "DocumentLoader.h" +#include "Frame.h" +#include "PrintContext.h" +#include "ResourceError.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" + +namespace WebCore { + +ResourceError cancelledError(const ResourceRequest& request) +{ + return ResourceError(errorDomainNetwork, NetworkErrorCancelled, request.url().string(), "Load request cancelled"); +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return ResourceError(errorDomainPolicy, PolicyErrorCannotUseRestrictedPort, request.url().string(), "Not allowed to use restricted network port"); +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return ResourceError(errorDomainPolicy, PolicyErrorCannotShowURL, request.url().string(), "URL cannot be shown"); +} + +ResourceError interruptedForPolicyChangeError(const ResourceRequest& request) +{ + return ResourceError(errorDomainPolicy, PolicyErrorFrameLoadInterruptedByPolicyChange, request.url().string(), "Frame load was interrupted"); +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return ResourceError(errorDomainPolicy, PolicyErrorCannotShowMimeType, response.url().string(), "Content with the specified MIME type cannot be shown"); +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return ResourceError(errorDomainNetwork, NetworkErrorFileDoesNotExist, response.url().string(), "File does not exist"); +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return ResourceError(errorDomainPlugin, PluginErrorWillHandleLoad, response.url().string(), "Plugin will handle load"); +} + +ResourceError downloadNetworkError(const ResourceError& networkError) +{ + return ResourceError(errorDomainDownload, DownloadErrorNetwork, networkError.failingURL(), networkError.localizedDescription()); +} + +ResourceError downloadCancelledByUserError(const ResourceResponse& response) +{ + return ResourceError(errorDomainDownload, DownloadErrorCancelledByUser, response.url().string(), "User cancelled the download"); +} + +ResourceError downloadDestinationError(const ResourceResponse& response, const String& errorMessage) +{ + return ResourceError(errorDomainDownload, DownloadErrorDestination, response.url().string(), errorMessage); +} + +ResourceError printError(const PrintContext* printContext, const String& errorMessage) +{ + DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader(); + + return ResourceError(errorDomainPrint, PrintErrorGeneral, documentLoader ? documentLoader->url() : KURL(), errorMessage); +} + +ResourceError printerNotFoundError(const PrintContext* printContext) +{ + DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader(); + + return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, documentLoader ? documentLoader->url() : KURL(), "Printer not found"); +} + +ResourceError invalidPageRangeToPrint(const PrintContext* printContext) +{ + DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader(); + + return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, documentLoader ? documentLoader->url() : KURL(), "Invalid page range"); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/efl/ErrorsEfl.h b/Source/WebCore/platform/efl/ErrorsEfl.h new file mode 100644 index 000000000..9372afe9c --- /dev/null +++ b/Source/WebCore/platform/efl/ErrorsEfl.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ErrorsEfl_h +#define ErrorsEfl_h + +#include "PlatformString.h" + +namespace WebCore { + +class PrintContext; +class ResourceError; +class ResourceRequest; +class ResourceResponse; + +static const char errorDomainNetwork[] = "WebKitNetworkError"; +static const char errorDomainPolicy[] = "WebKitPolicyError"; +static const char errorDomainPlugin[] = "WebKitPluginError"; +static const char errorDomainDownload[] = "WebKitDownloadError"; +static const char errorDomainPrint[] = "WebKitPrintError"; + +enum NetworkError { + NetworkErrorFailed = 399, + NetworkErrorTransport = 300, + NetworkErrorUnknownProtocol = 301, + NetworkErrorCancelled = 302, + NetworkErrorFileDoesNotExist = 303 +}; + +// Sync'd with Mac's WebKit Errors at: +// Source/WebKit/mac/Misc/WebKitErrors[Private].h +enum PolicyError { + PolicyErrorFailed = 199, + PolicyErrorCannotShowMimeType = 100, + PolicyErrorCannotShowURL = 101, + PolicyErrorFrameLoadInterruptedByPolicyChange = 102, + PolicyErrorCannotUseRestrictedPort = 103 +}; + +enum PluginError { + PluginErrorFailed = 299, + PluginErrorCannotFindPlugin = 200, + PluginErrorCannotLoadPlugin = 201, + PluginErrorJavaUnavailable = 202, + PluginErrorConnectionCancelled = 203, + PluginErrorWillHandleLoad = 204 +}; + +enum DownloadError { + DownloadErrorNetwork = 499, + DownloadErrorCancelledByUser = 400, + DownloadErrorDestination = 401 +}; + +enum PrintError { + PrintErrorGeneral = 599, + PrintErrorPrinterNotFound = 500, + PrintErrorInvalidPageRange = 501 +}; + +ResourceError cancelledError(const ResourceRequest&); +ResourceError blockedError(const ResourceRequest&); +ResourceError cannotShowURLError(const ResourceRequest&); +ResourceError interruptedForPolicyChangeError(const ResourceRequest&); +ResourceError cannotShowMIMETypeError(const ResourceResponse&); +ResourceError fileDoesNotExistError(const ResourceResponse&); +ResourceError pluginWillHandleLoadError(const ResourceResponse&); +ResourceError downloadNetworkError(const ResourceError&); +ResourceError downloadCancelledByUserError(const ResourceResponse&); +ResourceError downloadDestinationError(const ResourceResponse&, const String& errorMessage); +ResourceError printError(const PrintContext*, const String& errorMessage); +ResourceError printerNotFoundError(const PrintContext*); +ResourceError invalidPageRangeToPrint(const PrintContext*); + +} + +#endif // ErrorsEfl_h diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp index 902341aaa..e5784af03 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -339,7 +339,7 @@ bool RenderThemeEfl::paintThemePart(RenderObject* object, FormType type, const P msg->val[0] = 0; msg->val[1] = 0.1; edje_object_message_send(entry->o, EDJE_MESSAGE_FLOAT_SET, 0, msg); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) } else if (type == ProgressBar) { RenderProgress* renderProgress = toRenderProgress(object); Edje_Message_Float_Set* msg; @@ -566,7 +566,7 @@ const char* RenderThemeEfl::edjeGroupFromFormType(FormType type) const W("entry"), W("checkbox"), W("combo"), -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) W("progressbar"), #endif W("search/field"), @@ -786,6 +786,20 @@ void RenderThemeEfl::adjustSliderThumbSize(RenderStyle* style, Element*) const #endif } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeEfl::sliderTickSize() const +{ + // FIXME: We need to set this to the size of one tick mark. + return IntSize(0, 0); +} + +int RenderThemeEfl::sliderTickOffsetFromTrackCenter() const +{ + // FIXME: We need to set this to the position of the tick marks. + return 0; +} +#endif + bool RenderThemeEfl::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect) { // We've already painted it in paintSliderTrack(), no need to do anything here. @@ -1020,7 +1034,7 @@ void RenderThemeEfl::systemFont(int propId, FontDescription& fontDescription) co fontDescription.setItalic(false); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) void RenderThemeEfl::adjustProgressBarStyle(StyleResolver*, RenderStyle* style, Element*) const { style->setBoxShadow(nullptr); diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.h b/Source/WebCore/platform/efl/RenderThemeEfl.h index bbcb4e314..594377ab8 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.h +++ b/Source/WebCore/platform/efl/RenderThemeEfl.h @@ -48,7 +48,7 @@ enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType() TextField, CheckBox, ComboBox, -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) ProgressBar, #endif SearchField, @@ -161,6 +161,11 @@ public: virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const; @@ -168,7 +173,7 @@ public: static void setDefaultFontSize(int fontsize); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h index 9063ca7a2..c71e41fe3 100644 --- a/Source/WebCore/platform/graphics/FontCache.h +++ b/Source/WebCore/platform/graphics/FontCache.h @@ -130,7 +130,7 @@ private: // Don't purge if this count is > 0; int m_purgePreventCount; -#if USE(CORE_TEXT) || OS(ANDROID) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || OS(ANDROID) friend class ComplexTextController; #endif friend class SimpleFontData; // For getCachedFontData(const FontPlatformData*) diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index c2feec293..7433df626 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -510,7 +510,7 @@ public: PlatformLayer* platformLayer() const; #endif #elif PLATFORM(EFL) - PlatformGraphicsContext3D platformGraphicsContext3D() const; + PlatformGraphicsContext3D platformGraphicsContext3D(); Platform3DObject platformTexture() const { return m_texture; } #if USE(ACCELERATED_COMPOSITING) PlatformLayer* platformLayer() const; diff --git a/Source/WebCore/platform/graphics/SimpleFontData.h b/Source/WebCore/platform/graphics/SimpleFontData.h index 6fc918a43..425cf7302 100644 --- a/Source/WebCore/platform/graphics/SimpleFontData.h +++ b/Source/WebCore/platform/graphics/SimpleFontData.h @@ -36,11 +36,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/text/StringHash.h> -#if USE(ATSUI) -typedef struct OpaqueATSUStyle* ATSUStyle; -#endif - -#if PLATFORM(MAC) || USE(CORE_TEXT) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) #include <wtf/RetainPtr.h> #endif @@ -176,24 +172,11 @@ public: NSFont* getNSFont() const { return m_platformData.nsFont(); } #endif -#if PLATFORM(MAC) || USE(CORE_TEXT) - CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; -#endif - #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) + CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; #endif -#if USE(ATSUI) - void checkShapesArabic() const; - bool shapesArabic() const - { - if (!m_checkedShapesArabic) - checkShapesArabic(); - return m_shapesArabic; - } -#endif - #if PLATFORM(QT) #if !HAVE(QRAWFONT) QFont getQtFont() const { return m_platformData.font(); } @@ -290,22 +273,8 @@ private: float m_syntheticBoldOffset; #endif - -#if USE(ATSUI) -public: - mutable HashMap<unsigned, ATSUStyle> m_ATSUStyleMap; - mutable bool m_ATSUMirrors; - mutable bool m_checkedShapesArabic; - mutable bool m_shapesArabic; - -private: -#endif - -#if PLATFORM(MAC) || USE(CORE_TEXT) - mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; -#endif - #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) + mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport; #endif diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp index 781dfc5c8..27fdf6491 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp @@ -509,6 +509,11 @@ void MediaPlayerPrivate::updateStates() #if USE(ACCELERATED_COMPOSITING) setBuffering(false); m_mediaIsBuffering = false; + // Remove media player from platform layer (remove hole punch rect). + if (m_platformLayer) { + static_cast<VideoLayerWebKitThread*>(m_platformLayer.get())->setMediaPlayer(0); + m_platformLayer.clear(); + } #endif if (isFullscreen()) element->exitFullscreen(); @@ -517,6 +522,9 @@ void MediaPlayerPrivate::updateStates() #if USE(ACCELERATED_COMPOSITING) m_showBufferingImage = false; m_mediaIsBuffering = false; + // Create platform layer for video (create hole punch rect). + if (!m_platformLayer) + m_platformLayer = VideoLayerWebKitThread::create(m_webCorePlayer); #endif break; case MMRPlayer::MP_STATE_UNSUPPORTED: @@ -529,14 +537,8 @@ void MediaPlayerPrivate::updateStates() m_readyState = MediaPlayer::HaveEnoughData; } - if (m_readyState != oldReadyState) { + if (m_readyState != oldReadyState) m_webCorePlayer->readyStateChanged(); -#if USE(ACCELERATED_COMPOSITING) - // Create platform layer for video. - if (!m_platformLayer) - m_platformLayer = VideoLayerWebKitThread::create(m_webCorePlayer); -#endif - } if (m_networkState != oldNetworkState) m_webCorePlayer->networkStateChanged(); } diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index fdaa5274c..bd1c9bab9 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -232,6 +232,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + cairo_t* cr = platformContext()->cr(); cairo_save(cr); diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 2657d5412..cca3de0af 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -378,6 +378,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + CGContextRef context = platformContext(); CGContextFillRect(context, rect); diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp index d75cf054d..d244de674 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp @@ -33,8 +33,6 @@ #include "LayerPainterChromium.h" #include "PlatformColor.h" #include "PlatformContextSkia.h" -#include "TextureAllocator.h" -#include "cc/CCGraphicsContext.h" #include "skia/ext/platform_canvas.h" namespace WebCore { @@ -49,20 +47,19 @@ BitmapCanvasLayerTextureUpdater::Texture::~Texture() { } -void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) +void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) { - textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect); + textureUpdater()->updateTextureRect(resourceProvider, texture(), sourceRect, destRect); } -PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) { - return adoptRef(new BitmapCanvasLayerTextureUpdater(painter, useMapTexSubImage)); + return adoptRef(new BitmapCanvasLayerTextureUpdater(painter)); } -BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) : CanvasLayerTextureUpdater(painter) , m_opaque(false) - , m_texSubImage(useMapTexSubImage) { } @@ -84,8 +81,6 @@ LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampled void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) { - m_texSubImage.setSubImageSize(tileSize); - if (m_canvasSize != contentRect.size()) { m_canvasSize = contentRect.size(); m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_canvasSize.height(), m_opaque)); @@ -94,13 +89,12 @@ void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeightScale, resultingOpaqueRect); } -void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) +void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) { const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); bitmap.lockPixels(); - texture->bindTexture(context, allocator); - m_texSubImage.upload(static_cast<const uint8_t*>(bitmap.getPixels()), contentRect(), sourceRect, destRect, texture->format(), context); + texture->upload(resourceProvider, static_cast<const uint8_t*>(bitmap.getPixels()), contentRect(), sourceRect, destRect); bitmap.unlockPixels(); } diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h index 276e2b391..a7f11fa53 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h @@ -30,15 +30,12 @@ #if USE(ACCELERATED_COMPOSITING) #include "CanvasLayerTextureUpdater.h" -#include "LayerTextureSubImage.h" class SkCanvas; namespace WebCore { class LayerPainterChromium; -class CCGraphicsContext; -class TextureAllocator; // This class rasterizes the contentRect into a skia bitmap canvas. It then updates // textures by copying from the canvas into the texture, using MapSubImage if @@ -50,7 +47,7 @@ public: Texture(BitmapCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); virtual ~Texture(); - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -58,23 +55,22 @@ public: BitmapCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); + static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); virtual ~BitmapCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*); virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) OVERRIDE; - void updateTextureRect(CCGraphicsContext*, TextureAllocator*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); + void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); virtual void setOpaque(bool) OVERRIDE; private: - BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); + explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); OwnPtr<SkCanvas> m_canvas; IntSize m_canvasSize; bool m_opaque; - LayerTextureSubImage m_texSubImage; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp index 86fb2c8c3..285924253 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp @@ -34,8 +34,6 @@ #include "PlatformColor.h" #include "SkCanvas.h" #include "SkDevice.h" -#include "TextureAllocator.h" -#include "cc/CCGraphicsContext.h" namespace WebCore { @@ -55,24 +53,21 @@ void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRec textureUpdater()->paintContentsRect(&canvas, sourceRect); } -void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) +void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) { - texture()->bindTexture(context, allocator); - m_bitmap.lockPixels(); - textureUpdater()->updateTextureRect(context, texture()->format(), destRect, static_cast<uint8_t*>(m_bitmap.getPixels())); + texture()->upload(resourceProvider, static_cast<uint8_t*>(m_bitmap.getPixels()), destRect, destRect, destRect); m_bitmap.unlockPixels(); m_bitmap.reset(); } -PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) { - return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter, useMapTexSubImage)); + return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter)); } -BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) +BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) : SkPictureCanvasLayerTextureUpdater(painter) - , m_texSubImage(useMapTexSubImage) { } @@ -92,12 +87,6 @@ LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } -void BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) -{ - m_texSubImage.setSubImageSize(tileSize); - SkPictureCanvasLayerTextureUpdater::prepareToUpdate(contentRect, tileSize, contentsWidthScale, contentsHeightScale, resultingOpaqueRect); -} - void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect) { // Translate the origin of contentRect to that of sourceRect. @@ -106,10 +95,5 @@ void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canva drawPicture(canvas); } -void BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, GC3Denum format, const IntRect& destRect, const uint8_t* pixels) -{ - m_texSubImage.upload(pixels, destRect, destRect, destRect, format, context); -} - } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index 9f1388827..855d40585 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -28,14 +28,11 @@ #define BitmapSkPictureCanvasLayerTextureUpdater_h #if USE(ACCELERATED_COMPOSITING) -#include "LayerTextureSubImage.h" #include "SkBitmap.h" #include "SkPictureCanvasLayerTextureUpdater.h" namespace WebCore { -class TextureAllocator; - // This class records the contentRect into an SkPicture, then software rasterizes // the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting. class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { @@ -45,7 +42,7 @@ public: Texture(BitmapSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); virtual void prepareRect(const IntRect& sourceRect) OVERRIDE; - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -54,19 +51,15 @@ public: BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); + static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); virtual ~BitmapSkPictureCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; - virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect) OVERRIDE; void paintContentsRect(SkCanvas*, const IntRect& sourceRect); - void updateTextureRect(CCGraphicsContext*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels); private: - BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); - - LayerTextureSubImage m_texSubImage; + explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); }; } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 9f40f7fe1..719f9d899 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -122,9 +122,9 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() if (layerTreeHost()->settings().acceleratePainting) m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); else if (CCSettings::perTilePaintingEnabled()) - m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); else - m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); m_textureUpdater->setOpaque(opaque()); GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; diff --git a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp index 7e9ac0a6c..436f346d4 100644 --- a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp @@ -39,20 +39,16 @@ namespace WebCore { static PassOwnPtr<SkCanvas> createAcceleratedCanvas(GraphicsContext3D* context, - TextureAllocator* allocator, - CCPrioritizedTexture* texture) + IntSize canvasSize, + unsigned textureId) { - // Allocate so that we have a valid texture id. - texture->acquireBackingTexture(allocator); - GrContext* grContext = context->grContext(); - IntSize canvasSize = texture->size(); GrPlatformTextureDesc textureDesc; textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag; textureDesc.fWidth = canvasSize.width(); textureDesc.fHeight = canvasSize.height(); textureDesc.fConfig = kSkia8888_PM_GrPixelConfig; - textureDesc.fTextureHandle = texture->textureId(); + textureDesc.fTextureHandle = textureId; SkAutoTUnref<GrTexture> target(grContext->createPlatformTexture(textureDesc)); SkAutoTUnref<SkDevice> device(new SkGpuDevice(grContext, target.get())); return adoptPtr(new SkCanvas(device.get())); @@ -68,12 +64,12 @@ FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture() { } -void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext*, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) +void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) { RefPtr<GraphicsContext3D> sharedContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get(); if (!sharedContext) return; - textureUpdater()->updateTextureRect(sharedContext.release(), allocator, texture(), sourceRect, destRect); + textureUpdater()->updateTextureRect(sharedContext.release(), resourceProvider, texture(), sourceRect, destRect); } PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) @@ -101,15 +97,17 @@ LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUp return LayerTextureUpdater::SampledTexelFormatRGBA; } -void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(PassRefPtr<GraphicsContext3D> prpContext, TextureAllocator* allocator, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) +void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(PassRefPtr<GraphicsContext3D> prpContext, CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) { RefPtr<GraphicsContext3D> context(prpContext); // Make sure ganesh uses the correct GL context. context->makeContextCurrent(); + texture->acquireBackingTexture(resourceProvider); + CCScopedLockResourceForWrite lock(resourceProvider, texture->resourceId()); // Create an accelerated canvas to draw on. - OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context.get(), allocator, texture); + OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context.get(), texture->size(), lock.textureId()); // The compositor expects the textures to be upside-down so it can flip // the final composited image. Ganesh renders the image upright so we diff --git a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h index 8f630a922..44649e473 100644 --- a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h @@ -43,7 +43,7 @@ public: Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<CCPrioritizedTexture>); virtual ~Texture(); - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE; private: FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } @@ -56,7 +56,7 @@ public: virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; - void updateTextureRect(PassRefPtr<GraphicsContext3D>, TextureAllocator*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); + void updateTextureRect(PassRefPtr<GraphicsContext3D>, CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect); private: explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); diff --git a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp index c21726e9f..1eb237c4c 100644 --- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp @@ -663,11 +663,7 @@ void GraphicsLayerChromium::updateChildList() void GraphicsLayerChromium::updateLayerPosition() { - // Position is offset on the layer by the layer anchor point. - FloatPoint layerPosition(m_position.x() + m_anchorPoint.x() * m_size.width(), - m_position.y() + m_anchorPoint.y() * m_size.height()); - - primaryLayer().setPosition(layerPosition); + primaryLayer().setPosition(m_position); } void GraphicsLayerChromium::updateLayerSize() @@ -675,26 +671,18 @@ void GraphicsLayerChromium::updateLayerSize() IntSize layerSize(m_size.width(), m_size.height()); if (!m_transformLayer.isNull()) { m_transformLayer.setBounds(layerSize); - // The anchor of the contents layer is always at 0.5, 0.5, so the position is center-relative. - FloatPoint centerPoint(m_size.width() / 2, m_size.height() / 2); - m_layer.setPosition(centerPoint); + m_layer.setPosition(FloatPoint()); } m_layer.setBounds(layerSize); // Note that we don't resize m_contentsLayer. It's up the caller to do that. - - // If we've changed the bounds, we need to recalculate the position - // of the layer, taking anchor point into account. - updateLayerPosition(); } void GraphicsLayerChromium::updateAnchorPoint() { primaryLayer().setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y())); primaryLayer().setAnchorPointZ(m_anchorPoint.z()); - - updateLayerPosition(); } void GraphicsLayerChromium::updateTransform() @@ -729,7 +717,7 @@ void GraphicsLayerChromium::updateLayerPreserves3D() updateTransform(); updateChildrenTransform(); - m_layer.setPosition(FloatPoint(m_size.width() / 2.0f, m_size.height() / 2.0f)); + m_layer.setPosition(FloatPoint::zero()); m_layer.setAnchorPoint(FloatPoint(0.5f, 0.5f)); m_layer.setTransform(SkMatrix44()); diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 696563acf..ba6094379 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -34,7 +34,6 @@ #include "ImageLayerChromium.h" -#include "LayerTextureSubImage.h" #include "LayerTextureUpdater.h" #include "PlatformColor.h" #include "cc/CCLayerTreeHost.h" @@ -51,9 +50,9 @@ public: { } - virtual void updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE + virtual void updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect) OVERRIDE { - textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect); + textureUpdater()->updateTextureRect(resourceProvider, texture(), sourceRect, destRect); } private: @@ -62,9 +61,9 @@ public: ImageLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<ImageLayerTextureUpdater> create(bool useMapTexSubImage) + static PassRefPtr<ImageLayerTextureUpdater> create() { - return adoptRef(new ImageLayerTextureUpdater(useMapTexSubImage)); + return adoptRef(new ImageLayerTextureUpdater()); } virtual ~ImageLayerTextureUpdater() { } @@ -80,10 +79,8 @@ public: LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; } - void updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) + void updateTextureRect(CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) { - texture->bindTexture(context, allocator); - // Source rect should never go outside the image pixels, even if this // is requested because the texture extends outside the image. IntRect clippedSourceRect = sourceRect; @@ -95,7 +92,7 @@ public: clippedDestRect.setSize(clippedSourceRect.size()); SkAutoLockPixels lock(m_bitmap); - m_texSubImage.upload(static_cast<const uint8_t*>(m_bitmap.getPixels()), imageRect, clippedSourceRect, clippedDestRect, texture->format(), context); + texture->upload(resourceProvider, static_cast<const uint8_t*>(m_bitmap.getPixels()), imageRect, clippedSourceRect, clippedDestRect); } void setBitmap(const SkBitmap& bitmap) @@ -104,13 +101,9 @@ public: } private: - explicit ImageLayerTextureUpdater(bool useMapTexSubImage) - : m_texSubImage(useMapTexSubImage) - { - } + ImageLayerTextureUpdater() { } SkBitmap m_bitmap; - LayerTextureSubImage m_texSubImage; }; PassRefPtr<ImageLayerChromium> ImageLayerChromium::create() @@ -166,7 +159,7 @@ void ImageLayerChromium::createTextureUpdaterIfNeeded() if (m_textureUpdater) return; - m_textureUpdater = ImageLayerTextureUpdater::create(layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = ImageLayerTextureUpdater::create(); GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index a72674140..e5637a0fc 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -45,7 +45,7 @@ #include "SkColor.h" #include "ThrottledTextureUploader.h" #include "TraceEvent.h" -#include "TrackingTextureAllocator.h" +#include "cc/CCDamageTracker.h" #include "cc/CCLayerQuad.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" @@ -125,7 +125,7 @@ public: virtual bool isBusy() OVERRIDE { return false; } virtual void beginUploads() OVERRIDE { } virtual void endUploads() OVERRIDE { } - virtual void uploadTexture(CCGraphicsContext* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect) OVERRIDE { texture->updateRect(context, allocator, sourceRect, destRect); } + virtual void uploadTexture(LayerTextureUpdater::Texture* texture, CCResourceProvider* resourceProvider, const IntRect sourceRect, const IntRect destRect) OVERRIDE { texture->updateRect(resourceProvider, sourceRect, destRect); } protected: UnthrottledTextureUploader() { } @@ -133,9 +133,29 @@ protected: } // anonymous namespace -PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, WebGraphicsContext3D* context, TextureUploaderOption textureUploaderSetting) +class LayerRendererChromium::CachedTexture : public CCScopedTexture { + WTF_MAKE_NONCOPYABLE(CachedTexture); +public: + static PassOwnPtr<CachedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CachedTexture(resourceProvider)); } + virtual ~CachedTexture() { } + + bool isComplete() const { return m_isComplete; } + void setIsComplete(bool isComplete) { m_isComplete = isComplete; } + +protected: + explicit CachedTexture(CCResourceProvider* resourceProvider) + : CCScopedTexture(resourceProvider) + , m_isComplete(false) + { + } + +private: + bool m_isComplete; +}; + +PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) { - OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, context, textureUploaderSetting))); + OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, resourceProvider, textureUploaderSetting))); if (!layerRenderer->initialize()) return nullptr; @@ -143,14 +163,15 @@ PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient } LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, - WebGraphicsContext3D* context, + CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) : CCRenderer(client) , m_currentRenderPass(0) , m_currentTexture(0) , m_offscreenFramebufferId(0) , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f)) - , m_context(context) + , m_resourceProvider(resourceProvider) + , m_context(resourceProvider->graphicsContext3D()) , m_defaultRenderPass(0) , m_isViewportChanged(false) , m_isFramebufferDiscarded(false) @@ -318,7 +339,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]); Vector<int> passesToDelete; - HashMap<int, OwnPtr<CCScopedTexture> >::const_iterator passIterator; + HashMap<int, OwnPtr<CachedTexture> >::const_iterator passIterator; for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPassTextures.end(); ++passIterator) { const CCRenderPass* renderPassInFrame = passesInFrame.get(passIterator->first); if (!renderPassInFrame) { @@ -328,7 +349,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); - CCScopedTexture* texture = passIterator->second.get(); + CachedTexture* texture = passIterator->second.get(); ASSERT(texture); if (texture->id() && (texture->size() != requiredSize || texture->format() != requiredFormat)) @@ -341,7 +362,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) { - OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(m_implTextureAllocator.get()); + OwnPtr<CachedTexture> texture = CachedTexture::create(m_resourceProvider); m_renderPassTextures.set(renderPassesInDrawOrder[i]->id(), texture.release()); } } @@ -349,8 +370,21 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa bool LayerRendererChromium::haveCachedResourcesForRenderPassId(int id) const { - CCScopedTexture* texture = m_renderPassTextures.get(id); - return texture && texture->id(); + CachedTexture* texture = m_renderPassTextures.get(id); + return texture && texture->id() && texture->isComplete(); +} + +void LayerRendererChromium::drawFrame(const CCRenderPassList& renderPasses, const FloatRect& rootScissorRect) +{ + const CCRenderPass* rootRenderPass = renderPasses.last(); + beginDrawingFrame(rootRenderPass); + + for (size_t i = 0; i < renderPasses.size(); ++i) { + const CCRenderPass* renderPass = renderPasses[i]; + + FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(rootScissorRect); + drawRenderPass(renderPass, rootScissorRectInCurrentSurface); + } } void LayerRendererChromium::beginDrawingFrame(const CCRenderPass* rootRenderPass) @@ -515,7 +549,9 @@ static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const layerRenderer->context()->flush(); - return CCRenderSurfaceFilters::apply(filters, sourceTexture->id(), sourceTexture->size(), filterContext.get()); + CCScopedLockResourceForWrite lock(layerRenderer->resourceProvider(), sourceTexture->id()); + SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext.get()); + return source; } PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform) @@ -555,7 +591,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C deviceRect.intersect(m_currentRenderPass->framebufferOutputRect()); - OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_implTextureAllocator.get()); + OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_resourceProvider); if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) return nullptr; @@ -566,8 +602,8 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.getTexture()); int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); - OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_implTextureAllocator.get()); - if (!backgroundTexture->allocate(quad->quadRect().size(), GraphicsContext3D::RGBA)) + OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resourceProvider); + if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) return nullptr; const CCRenderPass* targetRenderPass = m_currentRenderPass; @@ -594,7 +630,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) { - CCScopedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); + CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) return; @@ -612,16 +648,21 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. // Apply filters to the contents texture. SkBitmap filterBitmap = applyFilters(this, quad->filters(), contentsTexture); - int contentsTextureId = contentsTexture->id(); + OwnPtr<CCScopedLockResourceForRead> contentsResourceLock; + unsigned contentsTextureId = 0; if (filterBitmap.getTexture()) { GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture()); contentsTextureId = texture->getTextureHandle(); + } else { + contentsResourceLock = adoptPtr(new CCScopedLockResourceForRead(m_resourceProvider, contentsTexture->id())); + contentsTextureId = contentsResourceLock->textureId(); } // Draw the background texture if there is one. if (backgroundTexture) { ASSERT(backgroundTexture->size() == quad->quadRect().size()); - copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->drawTransform()); + CCScopedLockResourceForRead lock(m_resourceProvider, backgroundTexture->id()); + copyTextureToFramebuffer(lock.textureId(), quad->quadRect().size(), quad->drawTransform()); } bool clipped = false; @@ -637,7 +678,12 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) deviceLayerEdges.inflateAntiAliasingDistance(); } - bool useMask = quad->maskTextureId(); + OwnPtr<CCScopedLockResourceForRead> maskResourceLock; + unsigned maskTextureId = 0; + if (quad->maskResourceId()) { + maskResourceLock = adoptPtr(new CCScopedLockResourceForRead(m_resourceProvider, quad->maskResourceId())); + maskTextureId = maskResourceLock->textureId(); + } // FIXME: use the backgroundTexture and blend the background in with this draw instead of having a separate copy of the background texture. @@ -649,7 +695,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) int shaderMaskSamplerLocation = -1; int shaderMatrixLocation = -1; int shaderAlphaLocation = -1; - if (useAA && useMask) { + if (useAA && maskTextureId) { const RenderPassMaskProgramAA* program = renderPassMaskProgramAA(); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -659,7 +705,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) shaderMaskSamplerLocation = program->fragmentShader().maskSamplerLocation(); shaderMatrixLocation = program->vertexShader().matrixLocation(); shaderAlphaLocation = program->fragmentShader().alphaLocation(); - } else if (!useAA && useMask) { + } else if (!useAA && maskTextureId) { const RenderPassMaskProgram* program = renderPassMaskProgram(); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -667,7 +713,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) shaderMaskSamplerLocation = program->fragmentShader().maskSamplerLocation(); shaderMatrixLocation = program->vertexShader().matrixLocation(); shaderAlphaLocation = program->fragmentShader().alphaLocation(); - } else if (useAA && !useMask) { + } else if (useAA && !maskTextureId) { const RenderPassProgramAA* program = renderPassProgramAA(); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -688,7 +734,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) if (shaderMaskSamplerLocation != -1) { GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); - context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->maskTextureId()); + context()->bindTexture(GraphicsContext3D::TEXTURE_2D, maskTextureId); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); } @@ -823,7 +869,8 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) GLC(context(), context()->useProgram(uniforms.program)); GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->textureId())); + CCScopedLockResourceForRead quadResourceLock(m_resourceProvider, quad->resourceId()); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId())); GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, quad->textureFilter())); GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, quad->textureFilter())); @@ -917,12 +964,15 @@ void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad) const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); const CCVideoLayerImpl::FramePlane& vPlane = quad->vPlane(); + CCScopedLockResourceForRead yPlaneLock(m_resourceProvider, yPlane.resourceId); + CCScopedLockResourceForRead uPlaneLock(m_resourceProvider, uPlane.resourceId); + CCScopedLockResourceForRead vPlaneLock(m_resourceProvider, vPlane.resourceId); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlane.textureId)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlaneLock.textureId())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE2)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, uPlane.textureId)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, uPlaneLock.textureId())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE3)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, vPlane.textureId)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, vPlaneLock.textureId())); GLC(context(), context()->useProgram(program->program())); @@ -1033,7 +1083,8 @@ void LayerRendererChromium::drawTextureQuad(const CCTextureDrawQuad* quad) GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->textureId())); + CCScopedLockResourceForRead quadResourceLock(m_resourceProvider, quad->resourceId()); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId())); // FIXME: setting the texture parameters every time is redundant. Move this code somewhere // where it will only happen once per texture. @@ -1072,18 +1123,14 @@ void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad) GLC(context(), context()->useProgram(binding.programId)); GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); - GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); + if (quad->orientation() == CCIOSurfaceDrawQuad::Flipped) + GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, quad->ioSurfaceSize().height(), quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height() * -1.0)); + else + GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId())); - // FIXME: setting the texture parameters every time is redundant. Move this code somewhere - // where it will only happen once per texture. - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - WebTransformationMatrix quadTransform = quad->quadTransform(); IntRect quadRect = quad->quadRect(); quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); @@ -1105,7 +1152,8 @@ void LayerRendererChromium::drawHeadsUpDisplay(const CCScopedTexture* hudTexture const HeadsUpDisplayProgram* program = headsUpDisplayProgram(); ASSERT(program && program->initialized()); GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, hudTexture->id())); + CCScopedLockResourceForRead lock(m_resourceProvider, hudTexture->id()); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId())); GLC(m_context, m_context->useProgram(program->program())); GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -1119,6 +1167,7 @@ void LayerRendererChromium::drawHeadsUpDisplay(const CCScopedTexture* hudTexture void LayerRendererChromium::finishDrawingFrame() { + m_currentFramebufferLock.clear(); GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); } @@ -1353,10 +1402,11 @@ bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, cons { ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); - if (!texture->id() && !texture->allocate(deviceRect.size(), GraphicsContext3D::RGB)) + if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny)) return false; - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture->id())); + CCScopedLockResourceForWrite lock(m_resourceProvider, texture->id()); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId())); GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(), deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0)); return true; @@ -1373,15 +1423,18 @@ bool LayerRendererChromium::useRenderPass(const CCRenderPass* renderPass) m_currentTexture = 0; if (renderPass == m_defaultRenderPass) { + m_currentFramebufferLock.clear(); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); setDrawFramebufferRect(renderPass->framebufferOutputRect(), true); return true; } - CCScopedTexture* texture = m_renderPassTextures.get(renderPass->id()); + CachedTexture* texture = m_renderPassTextures.get(renderPass->id()); ASSERT(texture); - if (!texture->id() && !texture->allocate(renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass))) + texture->setIsComplete(!renderPass->hasOcclusionFromOutsideTargetSurface()); + + if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::TextureUsageFramebuffer)) return false; return bindFramebufferToTexture(texture, renderPass->framebufferOutputRect()); @@ -1390,7 +1443,6 @@ bool LayerRendererChromium::useRenderPass(const CCRenderPass* renderPass) bool LayerRendererChromium::useScopedTexture(const CCScopedTexture* texture, const IntRect& viewportRect) { ASSERT(texture->id()); - m_currentRenderPass = 0; m_currentTexture = texture; @@ -1402,7 +1454,8 @@ bool LayerRendererChromium::bindFramebufferToTexture(const CCScopedTexture* text ASSERT(texture->id()); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); - GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, texture->id(), 0)); + m_currentFramebufferLock = adoptPtr(new CCScopedLockResourceForWrite(m_resourceProvider, texture->id())); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_currentFramebufferLock->textureId(), 0)); #if !defined ( NDEBUG ) if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { @@ -1479,14 +1532,6 @@ bool LayerRendererChromium::initializeSharedObjects() m_textureUploader = ThrottledTextureUploader::create(m_context); else m_textureUploader = UnthrottledTextureUploader::create(); - m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context, m_capabilities.maxTextureSize); - m_implTextureAllocator = TrackingTextureAllocator::create(m_context, m_capabilities.maxTextureSize); - if (m_capabilities.usingTextureUsageHint) - m_implTextureAllocator->setTextureUsageHint(TrackingTextureAllocator::FramebufferAttachment); - if (m_capabilities.usingTextureStorageExtension) { - m_contentsTextureAllocator->setUseTextureStorageExt(true); - m_implTextureAllocator->setUseTextureStorageExt(true); - } return true; } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 415520d7f..198aef9a3 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -36,7 +36,6 @@ #include "Extensions3DChromium.h" #include "TextureCopier.h" -#include "TrackingTextureAllocator.h" #include "cc/CCCheckerboardDrawQuad.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCIOSurfaceDrawQuad.h" @@ -66,7 +65,7 @@ class LayerRendererChromium : public CCRenderer, public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { WTF_MAKE_NONCOPYABLE(LayerRendererChromium); public: - static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, WebKit::WebGraphicsContext3D*, TextureUploaderOption); + static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); virtual ~LayerRendererChromium(); @@ -81,8 +80,7 @@ public: virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) OVERRIDE; virtual bool haveCachedResourcesForRenderPassId(int id) const OVERRIDE; - virtual void beginDrawingFrame(const CCRenderPass* defaultRenderPass) OVERRIDE; - virtual void drawRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect) OVERRIDE; + virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) OVERRIDE; virtual void finishDrawingFrame() OVERRIDE; virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) OVERRIDE; @@ -103,10 +101,6 @@ public: virtual TextureCopier* textureCopier() const OVERRIDE { return m_textureCopier.get(); } virtual TextureUploader* textureUploader() const OVERRIDE { return m_textureUploader.get(); } - virtual TextureAllocator* implTextureAllocator() const OVERRIDE { return m_implTextureAllocator.get(); } - virtual TextureAllocator* contentsTextureAllocator() const OVERRIDE { return m_contentsTextureAllocator.get(); } - - virtual void setScissorToRect(const IntRect&) OVERRIDE; virtual bool isContextLost() OVERRIDE; @@ -116,9 +110,11 @@ public: float width, float height, float opacity, const FloatQuad&, int matrixLocation, int alphaLocation, int quadLocation); void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebKit::WebTransformationMatrix& drawMatrix); + CCResourceProvider* resourceProvider() const { return m_resourceProvider; } protected: - LayerRendererChromium(CCRendererClient*, WebKit::WebGraphicsContext3D*, TextureUploaderOption); + LayerRendererChromium(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); + bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } bool initialize(); @@ -128,6 +124,9 @@ protected: private: static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); + void beginDrawingFrame(const CCRenderPass* rootRenderPass); + void drawRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect); + void drawQuad(const CCDrawQuad*); void drawCheckerboardQuad(const CCCheckerboardDrawQuad*); void drawDebugBorderQuad(const CCDebugBorderDrawQuad*); @@ -140,6 +139,8 @@ private: void drawTileQuad(const CCTileDrawQuad*); void drawYUVVideoQuad(const CCYUVVideoDrawQuad*); + void setScissorToRect(const IntRect&); + void setDrawFramebufferRect(const IntRect&, bool flipY); // The current drawing target is either a RenderPass or ScopedTexture. Use these functions to switch to a new drawing target. @@ -175,11 +176,14 @@ private: const CCRenderPass* m_currentRenderPass; const CCScopedTexture* m_currentTexture; + OwnPtr<CCScopedLockResourceForWrite> m_currentFramebufferLock; unsigned m_offscreenFramebufferId; OwnPtr<GeometryBinding> m_sharedGeometry; FloatQuad m_sharedGeometryQuad; + class CachedTexture; + // This block of bindings defines all of the programs used by the compositor itself. // Tiled layer shaders. @@ -200,7 +204,7 @@ private: // Texture shaders. typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexAlpha> TextureProgram; typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexFlipAlpha> TextureProgramFlip; - typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectFlipAlpha> TextureIOSurfaceProgram; + typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectAlpha> TextureIOSurfaceProgram; // Video shaders. typedef ProgramBinding<VertexShaderVideoTransform, FragmentShaderOESImageExternal> VideoStreamTextureProgram; @@ -260,12 +264,11 @@ private: OwnPtr<SolidColorProgram> m_solidColorProgram; OwnPtr<HeadsUpDisplayProgram> m_headsUpDisplayProgram; + CCResourceProvider* m_resourceProvider; OwnPtr<AcceleratedTextureCopier> m_textureCopier; OwnPtr<TextureUploader> m_textureUploader; - OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator; - OwnPtr<TrackingTextureAllocator> m_implTextureAllocator; - HashMap<int, OwnPtr<CCScopedTexture> > m_renderPassTextures; + HashMap<int, OwnPtr<CachedTexture> > m_renderPassTextures; WebKit::WebGraphicsContext3D* m_context; diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp index b87b43d94..b66d79e04 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp @@ -32,12 +32,15 @@ #include "Extensions3DChromium.h" #include "LayerRendererChromium.h" // For GLC() macro #include "TraceEvent.h" -#include "cc/CCGraphicsContext.h" +#include <public/WebGraphicsContext3D.h> + +using WebKit::WebGraphicsContext3D; namespace WebCore { LayerTextureSubImage::LayerTextureSubImage(bool useMapTexSubImage) : m_useMapTexSubImage(useMapTexSubImage) + , m_subImageSize(0) { } @@ -45,18 +48,9 @@ LayerTextureSubImage::~LayerTextureSubImage() { } -void LayerTextureSubImage::setSubImageSize(const IntSize& subImageSize) -{ - if (subImageSize == m_subImageSize) - return; - - m_subImageSize = subImageSize; - m_subImage.clear(); -} - void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext* context) + GC3Denum format, WebGraphicsContext3D* context) { if (m_useMapTexSubImage) uploadWithMapTexSubImage(image, imageRect, sourceRect, destRect, format, context); @@ -66,11 +60,9 @@ void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext* context) + GC3Denum format, WebGraphicsContext3D* context) { TRACE_EVENT0("cc", "LayerTextureSubImage::uploadWithTexSubImage"); - if (!m_subImage) - m_subImage = adoptArrayPtr(new uint8_t[m_subImageSize.width() * m_subImageSize.height() * 4]); // Offset from image-rect to source-rect. IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y()); @@ -79,6 +71,11 @@ void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const Int if (imageRect.width() == sourceRect.width() && !offset.x()) pixelSource = &image[4 * offset.y() * imageRect.width()]; else { + size_t neededSize = 4 * destRect.width() * destRect.height(); + if (m_subImageSize < neededSize) { + m_subImage = adoptArrayPtr(new uint8_t[neededSize]); + m_subImageSize = neededSize; + } // Strides not equal, so do a row-by-row memcpy from the // paint results into a temp buffer for uploading. for (int row = 0; row < destRect.height(); ++row) @@ -89,30 +86,19 @@ void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const Int pixelSource = &m_subImage[0]; } - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - GLC(context3d, context3d->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); + GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); } void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext* context) + GC3Denum format, WebGraphicsContext3D* context) { TRACE_EVENT0("cc", "LayerTextureSubImage::uploadWithMapTexSubImage"); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - // Offset from image-rect to source-rect. IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y()); // Upload tile data via a mapped transfer buffer - uint8_t* pixelDest = static_cast<uint8_t*>(context3d->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); + uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); if (!pixelDest) { uploadWithTexSubImage(image, imageRect, sourceRect, destRect, format, context); @@ -136,7 +122,7 @@ void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const &image[4 * (offset.x() + (offset.y() + row) * imageRect.width())], destRect.width() * componentsPerPixel * bytesPerComponent); } - GLC(context3d, context3d->unmapTexSubImage2DCHROMIUM(pixelDest)); + GLC(context, context->unmapTexSubImage2DCHROMIUM(pixelDest)); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h index 4f1c41521..357b64134 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h @@ -34,30 +34,31 @@ #include "IntSize.h" #include <wtf/OwnArrayPtr.h> -namespace WebCore { +namespace WebKit { +class WebGraphicsContext3D; +} -class CCGraphicsContext; +namespace WebCore { class LayerTextureSubImage { public: explicit LayerTextureSubImage(bool useMapSubForUpload); ~LayerTextureSubImage(); - void setSubImageSize(const IntSize&); void upload(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext*); + GC3Denum format, WebKit::WebGraphicsContext3D*); private: void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext*); + GC3Denum format, WebKit::WebGraphicsContext3D*); void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect, - GC3Denum format, CCGraphicsContext*); + GC3Denum format, WebKit::WebGraphicsContext3D*); bool m_useMapTexSubImage; - IntSize m_subImageSize; + size_t m_subImageSize; OwnArrayPtr<uint8_t> m_subImage; }; diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h index fd8ed883c..189942e25 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h @@ -30,16 +30,13 @@ #if USE(ACCELERATED_COMPOSITING) #include "GraphicsTypes3D.h" -#include "cc/CCGraphicsContext.h" #include "cc/CCPrioritizedTexture.h" #include <wtf/RefCounted.h> namespace WebCore { -class CCGraphicsContext; class IntRect; class IntSize; -class TextureAllocator; class TextureManager; class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { @@ -52,7 +49,7 @@ public: CCPrioritizedTexture* texture() { return m_texture.get(); } void swapTextureWith(OwnPtr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); } virtual void prepareRect(const IntRect& /* sourceRect */) { } - virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) = 0; + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) = 0; protected: explicit Texture(PassOwnPtr<CCPrioritizedTexture> texture) : m_texture(texture) { } diff --git a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp index e00a26e39..4988b327f 100644 --- a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp @@ -77,19 +77,19 @@ void ScrollbarLayerChromium::pushPropertiesTo(CCLayerImpl* layer) scrollbarLayer->setScrollbarOverlayStyle(m_scrollbarOverlayStyle); if (m_backTrack && m_backTrack->texture()->haveBackingTexture()) - scrollbarLayer->setBackTrackTextureId(m_backTrack->texture()->textureId()); + scrollbarLayer->setBackTrackResourceId(m_backTrack->texture()->resourceId()); else - scrollbarLayer->setBackTrackTextureId(0); + scrollbarLayer->setBackTrackResourceId(0); if (m_foreTrack && m_foreTrack->texture()->haveBackingTexture()) - scrollbarLayer->setForeTrackTextureId(m_foreTrack->texture()->textureId()); + scrollbarLayer->setForeTrackResourceId(m_foreTrack->texture()->resourceId()); else - scrollbarLayer->setForeTrackTextureId(0); + scrollbarLayer->setForeTrackResourceId(0); if (m_thumb && m_thumb->texture()->haveBackingTexture()) - scrollbarLayer->setThumbTextureId(m_thumb->texture()->textureId()); + scrollbarLayer->setThumbResourceId(m_thumb->texture()->resourceId()); else - scrollbarLayer->setThumbTextureId(0); + scrollbarLayer->setThumbResourceId(0); Vector<IntRect> tickmarks; m_scrollbar->getTickmarks(tickmarks); @@ -205,24 +205,23 @@ void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() { - bool useMapSubImage = layerTreeHost()->layerRendererCapabilities().usingMapSub; m_textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; if (!m_backTrackUpdater) - m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), BackTrackPart), useMapSubImage); + m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), BackTrackPart)); if (!m_backTrack) m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); // Only create two-part track if we think the two parts could be different in appearance. if (m_scrollbar->isCustomScrollbar()) { if (!m_foreTrackUpdater) - m_foreTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), ForwardTrackPart), useMapSubImage); + m_foreTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme(), ForwardTrackPart)); if (!m_foreTrack) m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } if (!m_thumbUpdater) - m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbPainter::create(m_scrollbar.get(), theme()), useMapSubImage); + m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbPainter::create(m_scrollbar.get(), theme())); if (!m_thumb) m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } diff --git a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp index 33243c855..0b59597a5 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp @@ -66,55 +66,54 @@ AcceleratedTextureCopier::~AcceleratedTextureCopier() GLC(m_context, m_context->deleteFramebuffer(m_fbo)); } -void AcceleratedTextureCopier::copyTexture(CCGraphicsContext* ccContext, unsigned sourceTextureId, unsigned destTextureId, const IntSize& size) +void AcceleratedTextureCopier::copyTexture(unsigned sourceTextureId, unsigned destTextureId, const IntSize& size) { TRACE_EVENT0("cc", "TextureCopier::copyTexture"); - WebKit::WebGraphicsContext3D* context = ccContext->context3D(); - if (!context) { - // FIXME: Implement this path for software compositing. - return; - } - // Note: this code does not restore the viewport, bound program, 2D texture, framebuffer, buffer or blend enable. - GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo)); - GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, destTextureId, 0)); + GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo)); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, destTextureId, 0)); #if OS(ANDROID) // Clear destination to improve performance on tiling GPUs. // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. - GLC(context, context->clear(GraphicsContext3D::COLOR_BUFFER_BIT)); + GLC(m_context, m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT)); #endif - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, sourceTextureId)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, sourceTextureId)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); if (!m_blitProgram->initialized()) - m_blitProgram->initialize(context, m_usingBindUniforms); + m_blitProgram->initialize(m_context, m_usingBindUniforms); // TODO: Use EXT_framebuffer_blit if available. - GLC(context, context->useProgram(m_blitProgram->program())); + GLC(m_context, m_context->useProgram(m_blitProgram->program())); const int kPositionAttribute = 0; - GLC(context, context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer)); - GLC(context, context->vertexAttribPointer(kPositionAttribute, 4, GraphicsContext3D::FLOAT, false, 0, 0)); - GLC(context, context->enableVertexAttribArray(kPositionAttribute)); - GLC(context, context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0)); + GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer)); + GLC(m_context, m_context->vertexAttribPointer(kPositionAttribute, 4, GraphicsContext3D::FLOAT, false, 0, 0)); + GLC(m_context, m_context->enableVertexAttribArray(kPositionAttribute)); + GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0)); - GLC(context, context->viewport(0, 0, size.width(), size.height())); - GLC(context, context->disable(GraphicsContext3D::BLEND)); - GLC(context, context->drawArrays(GraphicsContext3D::TRIANGLE_FAN, 0, 4)); + GLC(m_context, m_context->viewport(0, 0, size.width(), size.height())); + GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); + GLC(m_context, m_context->drawArrays(GraphicsContext3D::TRIANGLE_FAN, 0, 4)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - GLC(context, context->disableVertexAttribArray(kPositionAttribute)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + GLC(m_context, m_context->disableVertexAttribArray(kPositionAttribute)); - GLC(context, context->useProgram(0)); + GLC(m_context, m_context->useProgram(0)); - GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, 0, 0)); - GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); + GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, 0, 0)); + GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); + GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); +} + +void AcceleratedTextureCopier::flush() +{ + GLC(m_context, m_context->flush()); } } diff --git a/Source/WebCore/platform/graphics/chromium/TextureCopier.h b/Source/WebCore/platform/graphics/chromium/TextureCopier.h index c2bcd427c..b385f45e5 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureCopier.h +++ b/Source/WebCore/platform/graphics/chromium/TextureCopier.h @@ -28,7 +28,6 @@ #include "GraphicsContext3D.h" #include "ProgramBinding.h" #include "ShaderChromium.h" -#include "cc/CCGraphicsContext.h" namespace WebKit { class WebGraphicsContext3D; @@ -42,7 +41,8 @@ public: // Copy the base level contents of |sourceTextureId| to |destTextureId|. Both texture objects // must be complete and have a base level of |size| dimensions. The color formats do not need // to match, but |destTextureId| must have a renderable format. - virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&) = 0; + virtual void copyTexture(unsigned sourceTextureId, unsigned destTextureId, const IntSize&) = 0; + virtual void flush() = 0; protected: virtual ~TextureCopier() { } @@ -59,7 +59,8 @@ public: } virtual ~AcceleratedTextureCopier(); - virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&); + virtual void copyTexture(unsigned sourceTextureId, unsigned destTextureId, const IntSize&); + virtual void flush(); protected: AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUniforms); diff --git a/Source/WebCore/platform/graphics/chromium/TextureUploader.h b/Source/WebCore/platform/graphics/chromium/TextureUploader.h index 0eae2e65d..92870cb5a 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureUploader.h +++ b/Source/WebCore/platform/graphics/chromium/TextureUploader.h @@ -36,7 +36,7 @@ public: virtual bool isBusy() = 0; virtual void beginUploads() = 0; virtual void endUploads() = 0; - virtual void uploadTexture(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) = 0; + virtual void uploadTexture(LayerTextureUpdater::Texture*, CCResourceProvider*, const IntRect sourceRect, const IntRect destRect) = 0; }; } diff --git a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp index a8253d065..281e08ff0 100644 --- a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp +++ b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp @@ -120,9 +120,9 @@ void ThrottledTextureUploader::endUploads() m_pendingQueries.append(m_availableQueries.takeFirst()); } -void ThrottledTextureUploader::uploadTexture(CCGraphicsContext* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect) +void ThrottledTextureUploader::uploadTexture(LayerTextureUpdater::Texture* texture, CCResourceProvider* resourceProvider, const IntRect sourceRect, const IntRect destRect) { - texture->updateRect(context, allocator, sourceRect, destRect); + texture->updateRect(resourceProvider, sourceRect, destRect); } void ThrottledTextureUploader::processQueries() diff --git a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h index ae5b7491f..f8c43dc2d 100644 --- a/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h +++ b/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h @@ -51,7 +51,7 @@ public: virtual bool isBusy() OVERRIDE; virtual void beginUploads() OVERRIDE; virtual void endUploads() OVERRIDE; - virtual void uploadTexture(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) OVERRIDE; + virtual void uploadTexture(LayerTextureUpdater::Texture*, CCResourceProvider*, const IntRect sourceRect, const IntRect destRect) OVERRIDE; private: class Query { diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index eed5cfc9a..8e489195e 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -226,7 +226,7 @@ void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) if (tile->isDirtyForCurrentFrame()) continue; - tiledLayer->pushTileProperties(i, j, tile->managedTexture()->textureId(), tile->opaqueRect()); + tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(), tile->opaqueRect()); tile->isInUseOnImpl = true; } for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter) diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp deleted file mode 100644 index 7ae29f912..000000000 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2011, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "TrackingTextureAllocator.h" - -#include "Extensions3DChromium.h" -#include "GraphicsContext3D.h" -#include "IntRect.h" -#include "LayerRendererChromium.h" // For the GLC() macro - -namespace WebCore { - -TrackingTextureAllocator::TrackingTextureAllocator(WebKit::WebGraphicsContext3D* context, int maxTextureSize) - : m_context(context) - , m_maxTextureSize(maxTextureSize) - , m_currentMemoryUseBytes(0) - , m_textureUsageHint(Any) - , m_useTextureStorageExt(false) -{ - ASSERT(m_context); -} - -TrackingTextureAllocator::~TrackingTextureAllocator() -{ - ASSERT(!m_currentMemoryUseBytes); -} - -static GC3Denum textureToStorageFormat(GC3Denum textureFormat) -{ - GC3Denum storageFormat = Extensions3D::RGBA8_OES; - switch (textureFormat) { - case GraphicsContext3D::RGBA: - break; - case Extensions3D::BGRA_EXT: - storageFormat = Extensions3DChromium::BGRA8_EXT; - break; - default: - ASSERT_NOT_REACHED(); - break; - } - - return storageFormat; -} - -static bool isTextureFormatSupportedForStorage(GC3Denum format) -{ - return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EXT); -} - -unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum format) -{ - if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) - return 0; - - m_currentMemoryUseBytes += CCTexture::memorySizeBytes(size, format); - - unsigned textureId = 0; - GLC(m_context, textureId = m_context->createTexture()); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - // Do basic linear filtering on resize. - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE. - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - - if (m_textureUsageHint == FramebufferAttachment) - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); - if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { - GC3Denum storageFormat = textureToStorageFormat(format); - m_context->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height()); - } else - GLC(m_context, m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); - m_allocatedTextureIds.add(textureId); - return textureId; -} - -void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format) -{ - m_currentMemoryUseBytes -= CCTexture::memorySizeBytes(size, format); - GLC(m_context, m_context->deleteTexture(textureId)); - GLC(m_context, m_context->deleteTexture(textureId)); - ASSERT(m_allocatedTextureIds.contains(textureId)); - m_allocatedTextureIds.remove(textureId); -} - -void TrackingTextureAllocator::deleteAllTextures() -{ - for (HashSet<unsigned>::const_iterator it = m_allocatedTextureIds.begin(); it != m_allocatedTextureIds.end(); ++it) - GLC(m_context, m_context->deleteTexture(*it)); - m_currentMemoryUseBytes = 0; - m_allocatedTextureIds.clear(); -} - -} - diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h deleted file mode 100644 index 38f7ca043..000000000 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2011, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TrackingTextureAllocator_h -#define TrackingTextureAllocator_h - -#include "TextureAllocator.h" -#include <wtf/HashSet.h> -#include <wtf/PassRefPtr.h> - -namespace WebKit { -class WebGraphicsContext3D; -} - -namespace WebCore { - -class TrackingTextureAllocator : public TextureAllocator { - WTF_MAKE_NONCOPYABLE(TrackingTextureAllocator); -public: - static PassOwnPtr<TrackingTextureAllocator> create(WebKit::WebGraphicsContext3D* context, int maxTextureSize) - { - return adoptPtr(new TrackingTextureAllocator(context, maxTextureSize)); - } - virtual ~TrackingTextureAllocator(); - - virtual unsigned createTexture(const IntSize&, GC3Denum format) OVERRIDE; - virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum format) OVERRIDE; - virtual void deleteAllTextures() OVERRIDE; - - size_t currentMemoryUseBytes() const { return m_currentMemoryUseBytes; } - - enum TextureUsageHint { Any, FramebufferAttachment }; - - void setTextureUsageHint(TextureUsageHint hint) { m_textureUsageHint = hint; } - void setUseTextureStorageExt(bool useStorageExt) { m_useTextureStorageExt = useStorageExt; } - -protected: - TrackingTextureAllocator(WebKit::WebGraphicsContext3D*, int maxTextureSize); - - WebKit::WebGraphicsContext3D* m_context; - int m_maxTextureSize; - size_t m_currentMemoryUseBytes; - TextureUsageHint m_textureUsageHint; - bool m_useTextureStorageExt; - HashSet<unsigned> m_allocatedTextureIds; -}; - -} - -#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp index d6dff06ab..d5a7d4295 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp @@ -28,6 +28,7 @@ #include "CCFrameRateCounter.h" #include "CCProxy.h" +#include <public/Platform.h> #include <wtf/CurrentTime.h> namespace WebCore { @@ -57,6 +58,14 @@ CCFrameRateCounter::CCFrameRateCounter() void CCFrameRateCounter::markBeginningOfFrame(double timestamp) { + if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) { + double lastFrameTimestamp = frameIndex(m_currentFrameNumber - 1); + double drawDelaySeconds = timestamp - lastFrameTimestamp; + double drawDelayMs = drawDelaySeconds * 1000.0; + + WebKit::Platform::current()->histogramCustomCounts("Renderer4.CompositorThreadImplDrawDelay", static_cast<int>(drawDelayMs), 1, 120, 60); + } + m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp index be19983ef..0f6f6ee0e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp @@ -34,7 +34,6 @@ #include "cc/CCDebugRectHistory.h" #include "cc/CCFrameRateCounter.h" #include "cc/CCLayerTreeHostImpl.h" -#include <public/WebGraphicsContext3D.h> #include <wtf/text/WTFString.h> namespace WebCore { @@ -68,13 +67,8 @@ bool CCHeadsUpDisplay::showDebugRects(const CCLayerTreeSettings& settings) const void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) { CCRenderer* layerRenderer = layerTreeHostImpl->layerRenderer(); - WebKit::WebGraphicsContext3D* context = layerTreeHostImpl->context()->context3D(); - if (!context) { - // FIXME: Implement this path for software compositing. - return; - } if (!m_hudTexture) - m_hudTexture = CCScopedTexture::create(layerRenderer->implTextureAllocator()); + m_hudTexture = CCScopedTexture::create(layerTreeHostImpl->resourceProvider()); const CCLayerTreeSettings& settings = layerTreeHostImpl->settings(); // Use a fullscreen texture only if we need to... @@ -87,7 +81,7 @@ void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) hudSize.setHeight(128); } - if (!m_hudTexture->id() && !m_hudTexture->allocate(hudSize, GraphicsContext3D::RGBA)) + if (!m_hudTexture->id() && !m_hudTexture->allocate(CCRenderer::ImplPool, hudSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) return; // Render pixels into the texture. @@ -102,22 +96,8 @@ void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl) // Upload to GL. { PlatformCanvas::AutoLocker locker(&canvas); - - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_hudTexture->id())); - bool uploadedViaMap = false; - if (layerRenderer->capabilities().usingMapSub) { - uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); - - if (pixelDest) { - uploadedViaMap = true; - memcpy(pixelDest, locker.pixels(), hudSize.width() * hudSize.height() * 4); - context->unmapTexSubImage2DCHROMIUM(pixelDest); - } - } - - if (!uploadedViaMap) { - GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); - } + IntRect rect(IntPoint(0, 0), hudSize); + layerTreeHostImpl->resourceProvider()->upload(m_hudTexture->id(), locker.pixels(), rect, rect, rect); } layerRenderer->drawHeadsUpDisplay(m_hudTexture.get(), hudSize); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp index d1157ed03..473de259b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp @@ -35,7 +35,7 @@ #include "cc/CCGraphicsContext.h" #include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerTreeHostImpl.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include <public/WebGraphicsContext3D.h> namespace WebCore { @@ -60,12 +60,12 @@ CCIOSurfaceLayerImpl::~CCIOSurfaceLayerImpl() context3d->deleteTexture(m_ioSurfaceTextureId); } -void CCIOSurfaceLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context) +void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) { - CCLayerImpl::willDraw(layerRenderer, context); + CCLayerImpl::willDraw(resourceProvider); if (m_ioSurfaceChanged) { - WebKit::WebGraphicsContext3D* context3d = context->context3D(); + WebKit::WebGraphicsContext3D* context3d = resourceProvider->graphicsContext3D(); if (!context3d) { // FIXME: Implement this path for software compositing. return; @@ -96,10 +96,10 @@ void CCIOSurfaceLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext } } -void CCIOSurfaceLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId)); + quadList.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped)); } void CCIOSurfaceLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h index 28a35cd0f..018804e18 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h @@ -41,9 +41,9 @@ public: void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE; + virtual void willDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 9434dc59c..717d96d10 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -35,7 +35,7 @@ #include "cc/CCLayerSorter.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include <wtf/text/WTFString.h> using WebKit::WebTransformationMatrix; @@ -145,7 +145,7 @@ bool CCLayerImpl::descendantDrawsContent() return false; } -PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const +PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState(int id) const { WebTransformationMatrix quadTransformation = drawTransform(); if (!contentBounds().isEmpty() && !bounds().isEmpty()) { @@ -154,10 +154,10 @@ PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const quadTransformation.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0); } - return CCSharedQuadState::create(quadTransformation, m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); + return CCSharedQuadState::create(id, quadTransformation, m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); } -void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*) +void CCLayerImpl::willDraw(CCResourceProvider*) { #ifndef NDEBUG // willDraw/didDraw must be matched. @@ -166,7 +166,7 @@ void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*) #endif } -void CCLayerImpl::didDraw() +void CCLayerImpl::didDraw(CCResourceProvider*) { #ifndef NDEBUG ASSERT(m_betweenWillDrawAndDidDraw); @@ -174,7 +174,7 @@ void CCLayerImpl::didDraw() #endif } -void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState) const +void CCLayerImpl::appendDebugBorderQuad(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState) const { if (!hasDebugBorders()) return; @@ -183,7 +183,7 @@ void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth())); } -unsigned CCLayerImpl::contentsTextureId() const +CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const { ASSERT_NOT_REACHED(); return 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index a5cacd64b..6196c2c4d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -34,6 +34,7 @@ #include "cc/CCInputHandler.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCRenderSurface.h" +#include "cc/CCResourceProvider.h" #include "cc/CCSharedQuadState.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> @@ -44,11 +45,10 @@ namespace WebCore { -class CCGraphicsContext; class CCLayerSorter; class CCLayerTreeHostImpl; -class CCQuadCuller; class CCRenderer; +class CCQuadSink; class LayerChromium; class CCLayerImpl : public CCLayerAnimationControllerClient { @@ -87,17 +87,17 @@ public: CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } - PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; + PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; // willDraw must be called before appendQuads. If willDraw is called, // didDraw is guaranteed to be called before another willDraw or before // the layer is destroyed. To enforce this, any class that overrides // willDraw/didDraw must call the base class version. - virtual void willDraw(CCRenderer*, CCGraphicsContext*); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) { } - virtual void didDraw(); - void appendDebugBorderQuad(CCQuadCuller&, const CCSharedQuadState*) const; + virtual void willDraw(CCResourceProvider*); + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) { } + virtual void didDraw(CCResourceProvider*); + void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*) const; - virtual unsigned contentsTextureId() const; + virtual CCResourceProvider::ResourceId contentsResourceId() const; // Returns true if this layer has content to draw. void setDrawsContent(bool); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 1f51f19d4..377f74d54 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -151,7 +151,7 @@ void CCLayerTreeHost::initializeLayerRenderer() // Update m_settings based on partial update capability. m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); - m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize); + m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize, CCRenderer::ContentPool); m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); m_layerRendererInitialized = true; @@ -197,11 +197,11 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() return RecreateFailedAndGaveUp; } -void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator) +void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); if (m_layerRendererInitialized) - m_contentsTextureManager->clearAllMemory(allocator); + m_contentsTextureManager->clearAllMemory(resourceProvider); } void CCLayerTreeHost::acquireLayerTextures() @@ -230,7 +230,7 @@ void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) ASSERT(CCProxy::isImplThread()); TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); - m_contentsTextureManager->reduceMemory(hostImpl->contentsTextureAllocator()); + m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); } // This function commits the CCLayerTreeHost to an impl tree. When modifying diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index bd65650f4..839785905 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -52,7 +52,6 @@ class CCLayerTreeHostImpl; class CCLayerTreeHostImplClient; class CCTextureUpdater; class Region; -class TextureAllocator; class CCPrioritizedTextureManager; struct CCRenderingStats; struct CCScrollAndScaleSet; @@ -182,7 +181,7 @@ public: void willCommit() { m_client->willCommit(); } void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } - void deleteContentsTexturesOnImplThread(TextureAllocator*); + void deleteContentsTexturesOnImplThread(CCResourceProvider*); virtual void acquireLayerTextures(); // Returns false if we should abort this frame due to initialization failure. bool initializeLayerRendererIfNeeded(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index c75d548f8..3946c23dc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -414,15 +414,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // the transform to the anchor point is specified in "pixel layer space", where the bounds // of the layer map to [bounds.width(), bounds.height()]. // - // 3. The value of layer->position() is actually the position of the anchor point with respect to the position - // of the layer's origin. That is: - // layer->position() = positionOfLayerOrigin + anchorPoint (in pixel units) - // - // Or, equivalently, - // positionOfLayerOrigin.x = layer->position.x - (layer->anchorPoint.x * bounds.width) - // positionOfLayerOrigin.y = layer->position.y - (layer->anchorPoint.y * bounds.height) - // - // 4. Definition of various transforms used: + // 3. Definition of various transforms used: // M[parent] is the parent matrix, with respect to the nearest render surface, passed down recursively. // M[root] is the full hierarchy, with respect to the root, passed down recursively. // Tr[origin] is the translation matrix from the parent's origin to this layer's origin. @@ -433,7 +425,6 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // Tr[anchor2center] is the translation offset from the anchor point and the center of the layer // // Some shortcuts and substitutions are used in the code to reduce matrix multiplications: - // Translating by the value of layer->position(), Tr[layer->position()] = Tr[origin] * Tr[origin2anchor] // Tr[anchor2center] = Tr[origin2anchor].inverse() * Tr[origin2center] // // Some composite transforms can help in understanding the sequence of transforms: @@ -443,7 +434,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // In words, the layer transform is applied about the anchor point, and the sublayer transform is // applied about the center of the layer. // - // 5. When a layer (or render surface) is drawn, it is drawn into a "target render surface". Therefore the draw + // 4. When a layer (or render surface) is drawn, it is drawn into a "target render surface". Therefore the draw // transform does not necessarily transform from screen space to local layer space. Instead, the draw transform // is the transform between the "target render surface space" and local layer space. Note that render surfaces, // except for the root, also draw themselves into a different target render surface, and so their draw @@ -487,11 +478,11 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay // M[surface2root] = M[owningLayer->screenspace] * S[contentsScale].inverse() // // The replica draw transform is: - // M[replicaDraw] = M[surfaceOrigin] * S[contentsScale] * Tr[replica->position()] * Tr[replica] * Tr[anchor2center] * S[contentsScale].inverse() - // = M[owningLayer->draw] * Tr[origin2center].inverse() * S[contentsScale] * Tr[replica->position()] * Tr[replica] * Tr[anchor2clippedCenter] * S[contentsScale].inverse() + // M[replicaDraw] = M[surfaceOrigin] * S[contentsScale] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[anchor2center] * S[contentsScale].inverse() + // = M[owningLayer->draw] * Tr[origin2center].inverse() * S[contentsScale] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[anchor2clippedCenter] * S[contentsScale].inverse() // // The replica origin transform to its target surface origin is: - // M[replicaOrigin] = S[contentsScale] * M[surfaceOrigin] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].invers() + // M[replicaOrigin] = S[contentsScale] * M[surfaceOrigin] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].invers() // // The replica origin transform to the root (screen space) origin is: // M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse() @@ -516,13 +507,13 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay float centerOffsetY = (0.5 - anchorPoint.y()) * bounds.height(); WebTransformationMatrix layerLocalTransform; - // LT = Tr[origin] * S[pageScaleDelta] + // LT = S[pageScaleDelta] layerLocalTransform.scale(layer->pageScaleDelta()); - // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] - layerLocalTransform.translate3d(position.x(), position.y(), layer->anchorPointZ()); - // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] * M[layer] + // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] + layerLocalTransform.translate3d(position.x() + anchorPoint.x() * bounds.width(), position.y() + anchorPoint.y() * bounds.height(), layer->anchorPointZ()); + // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] * M[layer] layerLocalTransform.multiply(layer->transform()); - // LT = Tr[origin] * S[pageScaleDelta] * Tr[origin2anchor] * M[layer] * Tr[anchor2center] + // LT = S[pageScaleDelta] * Tr[origin] * Tr[origin2anchor] * M[layer] * Tr[anchor2center] layerLocalTransform.translate3d(centerOffsetX, centerOffsetY, -layer->anchorPointZ()); // The combinedTransform that gets computed below is effectively the layer's drawTransform, unless @@ -781,20 +772,22 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay WebTransformationMatrix replicaDrawTransform = renderSurface->originTransform(); replicaDrawTransform.scale(contentsScale); - replicaDrawTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y()); + replicaDrawTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), + layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); replicaDrawTransform.multiply(layer->replicaLayer()->transform()); FloatPoint layerSpaceSurfaceCenter = surfaceCenter; layerSpaceSurfaceCenter.scale(1 / contentsScale, 1 / contentsScale); - replicaDrawTransform.translate(layerSpaceSurfaceCenter.x() - anchorPoint.x() * bounds.width(), layerSpaceSurfaceCenter.y() - anchorPoint.y() * bounds.height()); + replicaDrawTransform.translate(layerSpaceSurfaceCenter.x() - layer->replicaLayer()->anchorPoint().x() * bounds.width(), layerSpaceSurfaceCenter.y() - layer->replicaLayer()->anchorPoint().y() * bounds.height()); replicaDrawTransform.scale(1 / contentsScale); renderSurface->setReplicaDrawTransform(replicaDrawTransform); WebTransformationMatrix surfaceOriginToReplicaOriginTransform; surfaceOriginToReplicaOriginTransform.scale(contentsScale); - surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y()); + surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(), + layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height()); surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer()->transform()); - surfaceOriginToReplicaOriginTransform.translate(-anchorPoint.x() * bounds.width(), -anchorPoint.y() * bounds.height()); + surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y() * bounds.height()); surfaceOriginToReplicaOriginTransform.scale(1 / contentsScale); // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 04bb78671..7f1240432 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -29,7 +29,6 @@ #include "LayerRendererChromium.h" #include "TextStream.h" #include "TraceEvent.h" -#include "TrackingTextureAllocator.h" #include "cc/CCActiveGestureAnimation.h" #include "cc/CCDamageTracker.h" #include "cc/CCDebugRectHistory.h" @@ -329,11 +328,16 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) if (it.representsContributingRenderSurface() && !it->renderSurface()->scissorRect().isEmpty()) { CCRenderPass* contributingRenderPass = surfacePassMap.get(it->renderSurface()); pass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker); - } else if (it.representsItself() && !occlusionTracker.occluded(*it, it->visibleContentRect()) && !it->visibleContentRect().isEmpty() && !it->scissorRect().isEmpty()) { - it->willDraw(m_layerRenderer.get(), context()); - frame.willDrawLayers.append(*it); - - pass->appendQuadsForLayer(*it, &occlusionTracker, hadMissingTiles); + } else if (it.representsItself() && !it->visibleContentRect().isEmpty() && !it->scissorRect().isEmpty()) { + bool hasOcclusionFromOutsideTargetSurface; + if (occlusionTracker.occluded(*it, it->visibleContentRect(), &hasOcclusionFromOutsideTargetSurface)) { + if (hasOcclusionFromOutsideTargetSurface) + pass->setHasOcclusionFromOutsideTargetSurface(hasOcclusionFromOutsideTargetSurface); + } else { + it->willDraw(m_resourceProvider.get()); + frame.willDrawLayers.append(*it); + pass->appendQuadsForLayer(*it, &occlusionTracker, hadMissingTiles); + } } if (hadMissingTiles) { @@ -523,7 +527,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) void CCLayerTreeHostImpl::releaseContentsTextures() { - contentsTextureAllocator()->deleteAllTextures(); + m_resourceProvider->deleteOwnedResources(CCRenderer::ContentPool); m_contentsTexturesWerePurgedSinceLastCommit = true; m_client->setNeedsCommitOnImplThread(); } @@ -547,30 +551,19 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) // FIXME: use the frame begin time from the overall compositor scheduler. // This value is currently inaccessible because it is up in Chromium's // RenderWidget. - - // The root RenderPass is the last one to be drawn. - const CCRenderPass* rootRenderPass = frame.renderPasses.last(); - m_fpsCounter->markBeginningOfFrame(currentTime()); - m_layerRenderer->beginDrawingFrame(rootRenderPass); - - for (size_t i = 0; i < frame.renderPasses.size(); ++i) { - const CCRenderPass* renderPass = frame.renderPasses[i]; - FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(m_rootScissorRect); - m_layerRenderer->drawRenderPass(renderPass, rootScissorRectInCurrentSurface); + m_layerRenderer->drawFrame(frame.renderPasses, m_rootScissorRect); + if (m_headsUpDisplay->enabled(settings())) + m_headsUpDisplay->draw(this); + m_layerRenderer->finishDrawingFrame(); - renderPass->targetSurface()->damageTracker()->didDrawDamagedArea(); - } + for (unsigned int i = 0; i < frame.renderPasses.size(); i++) + frame.renderPasses[i]->targetSurface()->damageTracker()->didDrawDamagedArea(); if (m_debugRectHistory->enabled(settings())) m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, settings()); - if (m_headsUpDisplay->enabled(settings())) - m_headsUpDisplay->draw(this); - - m_layerRenderer->finishDrawingFrame(); - ++m_sourceAnimationFrameNumber; // The next frame should start by assuming nothing has changed, and changes are noted as they occur. @@ -580,7 +573,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) void CCLayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) { for (size_t i = 0; i < frame.willDrawLayers.size(); ++i) - frame.willDrawLayers[i]->didDraw(); + frame.willDrawLayers[i]->didDraw(m_resourceProvider.get()); } void CCLayerTreeHostImpl::finishAllRendering() @@ -599,11 +592,6 @@ const LayerRendererCapabilities& CCLayerTreeHostImpl::layerRendererCapabilities( return m_layerRenderer->capabilities(); } -TextureAllocator* CCLayerTreeHostImpl::contentsTextureAllocator() const -{ - return m_layerRenderer ? m_layerRenderer->contentsTextureAllocator() : 0; -} - bool CCLayerTreeHostImpl::swapBuffers() { ASSERT(m_layerRenderer); @@ -709,8 +697,11 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> return false; } + OwnPtr<CCGraphicsContext> contextRef(context); + OwnPtr<CCResourceProvider> resourceProvider = CCResourceProvider::create(contextRef.get()); OwnPtr<LayerRendererChromium> layerRenderer; - layerRenderer = LayerRendererChromium::create(this, context3d, textureUploader); + if (resourceProvider.get()) + layerRenderer = LayerRendererChromium::create(this, resourceProvider.get(), textureUploader); // Since we now have a new context/layerRenderer, we cannot continue to use the old // resources (i.e. renderSurfaces and texture IDs). @@ -720,8 +711,9 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> } m_layerRenderer = layerRenderer.release(); + m_resourceProvider = resourceProvider.release(); if (m_layerRenderer) - m_context = context; + m_context = contextRef.release(); if (!m_visible && m_layerRenderer) m_layerRenderer->setVisible(m_visible); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 753aa384a..f936e34dd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -46,8 +46,8 @@ class CCLayerImpl; class CCLayerTreeHostImplTimeSourceAdapter; class CCPageScaleAnimation; class CCRenderPassDrawQuad; +class CCResourceProvider; class LayerRendererChromium; -class TextureAllocator; struct LayerRendererCapabilities; // CCLayerTreeHost->CCProxy callback interface. @@ -127,7 +127,6 @@ public: bool isContextLost(); CCRenderer* layerRenderer() { return m_layerRenderer.get(); } const LayerRendererCapabilities& layerRendererCapabilities() const; - TextureAllocator* contentsTextureAllocator() const; bool swapBuffers(); @@ -177,6 +176,7 @@ public: CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); } + CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); } class CullRenderPassesWithCachedTextures { public: @@ -252,6 +252,7 @@ private: void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const; OwnPtr<CCGraphicsContext> m_context; + OwnPtr<CCResourceProvider> m_resourceProvider; OwnPtr<CCRenderer> m_layerRenderer; OwnPtr<CCLayerImpl> m_rootLayerImpl; CCLayerImpl* m_rootScrollLayerImpl; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp index 0d01593cf..0083ad1dd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp @@ -377,8 +377,11 @@ static inline bool testContentRectOccluded(const IntRect& contentRect, const Web } template<typename LayerType, typename RenderSurfaceType> -bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* layer, const IntRect& contentRect) const +bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = false; + ASSERT(!m_stack.isEmpty()); if (m_stack.isEmpty()) return false; @@ -387,10 +390,15 @@ bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerT ASSERT(layer->renderTarget() == m_stack.last().target); - if (layerTransformsToScreenKnown(layer) && testContentRectOccluded(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen)) - return true; if (layerTransformsToTargetKnown(layer) && testContentRectOccluded(contentRect, contentToTargetSurfaceTransform<LayerType>(layer), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget)) return true; + + if (layerTransformsToScreenKnown(layer) && testContentRectOccluded(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen)) { + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = true; + return true; + } + return false; } @@ -417,7 +425,7 @@ static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, c } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect) const +IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { ASSERT(!m_stack.isEmpty()); if (m_stack.isEmpty()) @@ -434,18 +442,18 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR if (layerTransformsToScreenKnown(layer)) unoccludedInScreen = computeUnoccludedContentRect(contentRect, contentToScreenSpaceTransform<LayerType>(layer), m_scissorRectInScreenSpace, m_stack.last().occlusionInScreen); - if (unoccludedInScreen.isEmpty()) - return unoccludedInScreen; - IntRect unoccludedInTarget = contentRect; if (layerTransformsToTargetKnown(layer)) unoccludedInTarget = computeUnoccludedContentRect(contentRect, contentToTargetSurfaceTransform<LayerType>(layer), layerScissorRectInTargetSurface(layer), m_stack.last().occlusionInTarget); + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget); + return intersection(unoccludedInScreen, unoccludedInTarget); } template<typename LayerType, typename RenderSurfaceType> -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect) const +IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { ASSERT(!m_stack.isEmpty()); // The layer is a contributing renderTarget so it should have a surface. @@ -484,9 +492,6 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_scissorRectInScreenSpace, Region()); } - if (unoccludedInScreen.isEmpty()) - return unoccludedInScreen; - IntRect unoccludedInTarget = contentRect; if (surfaceTransformsToTargetKnown(surface)) { if (hasOcclusion) { @@ -496,6 +501,9 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu unoccludedInTarget = computeUnoccludedContentRect(contentRect, transformToTarget, surfaceClipRect, Region()); } + if (hasOcclusionFromOutsideTargetSurface) + *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget); + return intersection(unoccludedInScreen, unoccludedInTarget); } @@ -517,9 +525,9 @@ template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::ente template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::finishedRenderTarget(const LayerChromium* finishedTarget); template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::leaveToRenderTarget(const LayerChromium* newTarget); template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::markOccludedBehindLayer(const LayerChromium*); -template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const LayerChromium*, bool forReplica, const IntRect& contentRect) const; +template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const LayerChromium*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::layerScissorRectInTargetSurface(const LayerChromium*) const; template CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::CCOcclusionTrackerBase(IntRect scissorRectInScreenSpace, bool recordMetricsForFrame); @@ -529,9 +537,9 @@ template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::enterRenderT template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::finishedRenderTarget(const CCLayerImpl* finishedTarget); template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::leaveToRenderTarget(const CCLayerImpl* newTarget); template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::markOccludedBehindLayer(const CCLayerImpl*); -template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect) const; -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCLayerImpl*, bool forReplica, const IntRect& contentRect) const; +template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; +template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCLayerImpl*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::layerScissorRectInTargetSurface(const CCLayerImpl*) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h index ae85751ea..a601b6d39 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h @@ -54,13 +54,13 @@ public: void leaveLayer(const CCLayerIteratorPosition<LayerType>&); // Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface. - bool occluded(const LayerType*, const IntRect& contentRect) const; + bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Used when considering occlusion for a layer that paints/draws something. - IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect) const; + IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Gives an unoccluded sub-rect of |contentRect| in the content space of the renderTarget owned by the layer. // Used when considering occlusion for a contributing surface that is rendering into another target. - IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect) const; + IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const; // Report operations for recording overdraw metrics. CCOverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp index 1df771386..60cf1a1e2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp @@ -29,7 +29,6 @@ #include "CCPrioritizedTextureManager.h" #include "CCPriorityCalculator.h" #include "LayerRendererChromium.h" -#include "TextureAllocator.h" #include <algorithm> using namespace std; @@ -90,46 +89,29 @@ bool CCPrioritizedTexture::requestLate() return m_manager->requestLate(this); } -void CCPrioritizedTexture::acquireBackingTexture(TextureAllocator* allocator) +void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourceProvider) { ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) - m_manager->acquireBackingTextureIfNeeded(this, allocator); + m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); } -unsigned CCPrioritizedTexture::textureId() +CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const { if (m_backing) return m_backing->id(); return 0; } -void CCPrioritizedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator) +void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider, + const uint8_t* image, const IntRect& imageRect, + const IntRect& sourceRect, const IntRect& destRect) { ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) - acquireBackingTexture(allocator); + acquireBackingTexture(resourceProvider); ASSERT(m_backing); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId()); -} - -void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, TextureAllocator* allocator) -{ - ASSERT(m_isAbovePriorityCutoff); - if (m_isAbovePriorityCutoff) - acquireBackingTexture(allocator); - ASSERT(m_backing); - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - context3d->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId(), 0); + resourceProvider->upload(resourceId(), image, imageRect, sourceRect, destRect); } void CCPrioritizedTexture::link(Backing* backing) @@ -159,4 +141,3 @@ void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) } } // namespace WebCore - diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h index 46073c5f3..764cbeced 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h @@ -25,18 +25,16 @@ #ifndef CCPrioritizedTexture_h #define CCPrioritizedTexture_h -#include "CCPriorityCalculator.h" -#include "CCTexture.h" #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" +#include "cc/CCPriorityCalculator.h" +#include "cc/CCResourceProvider.h" +#include "cc/CCTexture.h" namespace WebCore { class CCPrioritizedTextureManager; -class CCPriorityCalculator; -class CCGraphicsContext; -class TextureAllocator; class CCPrioritizedTexture { WTF_MAKE_NONCOPYABLE(CCPrioritizedTexture); @@ -76,7 +74,7 @@ public: // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire // a backing texture for use. Call this whenever the texture is actually needed. - void acquireBackingTexture(TextureAllocator*); + void acquireBackingTexture(CCResourceProvider*); // FIXME: Request late is really a hack for when we are totally out of memory // (all textures are visible) but we can still squeeze into the limit @@ -87,11 +85,10 @@ public: // regress OOMs situations. bool requestLate(); - // These functions will acquire the texture if possible. If neither haveBackingTexture() - // nor canAcquireBackingTexture() is true, an ID of zero will be used/returned. - void bindTexture(CCGraphicsContext*, TextureAllocator*); - void framebufferTexture2D(CCGraphicsContext*, TextureAllocator*); - unsigned textureId(); + // Uploads pixels into the backing resource. This functions will aquire the backing if needed. + void upload(CCResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect); + + CCResourceProvider::ResourceId resourceId() const; // Self-managed textures are accounted for when prioritizing other textures, // but they are not allocated/recycled/deleted, so this needs to be done diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp index d19e5aa19..4a24179c5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp @@ -36,11 +36,12 @@ using namespace std; namespace WebCore { -CCPrioritizedTextureManager::CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int) +CCPrioritizedTextureManager::CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int, int pool) : m_maxMemoryLimitBytes(maxMemoryLimitBytes) , m_memoryUseBytes(0) , m_memoryAboveCutoffBytes(0) , m_memoryAvailableBytes(0) + , m_pool(pool) { } @@ -49,7 +50,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() while (m_textures.size() > 0) unregisterTexture(*m_textures.begin()); - // Each remaining backing is a leaked opengl texture. We don't have the allocator + // Each remaining backing is a leaked opengl texture. We don't have the resourceProvider // to delete the textures at this time so clearMemory() needs to be called before this. while (m_backings.size() > 0) destroyBacking(*m_backings.begin(), 0); @@ -168,7 +169,7 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) return true; } -void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, TextureAllocator* allocator) +void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, CCResourceProvider* resourceProvider) { ASSERT(!texture->isSelfManaged()); ASSERT(texture->isAbovePriorityCutoff()); @@ -190,8 +191,8 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex // Otherwise reduce memory and just allocate a new backing texures. if (!backing) { - reduceMemory(m_memoryAvailableBytes - texture->bytes(), allocator); - backing = createBacking(texture->size(), texture->format(), allocator); + reduceMemory(m_memoryAvailableBytes - texture->bytes(), resourceProvider); + backing = createBacking(texture->size(), texture->format(), resourceProvider); } // Move the used backing texture to the end of the eviction list. @@ -202,7 +203,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex m_backings.add(backing); } -void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocator* allocator) +void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, CCResourceProvider* resourceProvider) { if (memoryUseBytes() <= limitBytes) return; @@ -212,13 +213,13 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocat BackingSet::iterator it = m_backings.begin(); if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) break; - destroyBacking((*it), allocator); + destroyBacking((*it), resourceProvider); } } -void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator) +void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider) { - reduceMemory(m_memoryAvailableBytes, allocator); + reduceMemory(m_memoryAvailableBytes, resourceProvider); ASSERT(memoryUseBytes() <= maxMemoryLimitBytes()); // We currently collect backings from deleted textures for later recycling. @@ -235,17 +236,17 @@ void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator) size_t tenPercentOfMemory = m_memoryAvailableBytes / 10; if (wastedMemory <= tenPercentOfMemory) return; - reduceMemory(memoryUseBytes() - (wastedMemory - tenPercentOfMemory), allocator); + reduceMemory(memoryUseBytes() - (wastedMemory - tenPercentOfMemory), resourceProvider); } -void CCPrioritizedTextureManager::clearAllMemory(TextureAllocator* allocator) +void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider) { // Unlink and destroy all backing textures. while (m_backings.size() > 0) { BackingSet::iterator it = m_backings.begin(); if ((*it)->owner()) (*it)->owner()->unlink(); - destroyBacking((*it), allocator); + destroyBacking((*it), resourceProvider); } } @@ -253,7 +254,7 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted() { // Same as clearAllMemory, except all our textures were already // deleted externally, so we don't delete them. Passing no - // allocator results in leaking the (now invalid) texture ids. + // resourceProvider results in leaking the (now invalid) texture ids. clearAllMemory(0); } @@ -291,26 +292,27 @@ void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* tex } } -CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, TextureAllocator* allocator) +CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider) { - ASSERT(allocator); + ASSERT(resourceProvider); - CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(allocator->createTexture(size, format), size, format); + CCResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, CCResourceProvider::TextureUsageAny); + CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, size, format); m_memoryUseBytes += backing->bytes(); // Put backing texture at the front for eviction, since it isn't in use yet. m_backings.insertBefore(m_backings.begin(), backing); return backing; } -void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, TextureAllocator* allocator) +void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, CCResourceProvider* resourceProvider) { ASSERT(backing); ASSERT(!backing->owner() || !backing->owner()->isAbovePriorityCutoff()); ASSERT(!backing->owner() || !backing->owner()->isSelfManaged()); ASSERT(m_backings.find(backing) != m_backings.end()); - if (allocator) - allocator->deleteTexture(backing->id(), backing->size(), backing->format()); + if (resourceProvider) + resourceProvider->deleteResource(backing->id()); if (backing->owner()) backing->owner()->unlink(); m_memoryUseBytes -= backing->bytes(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h index 019c45cf4..b16ec1034 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h @@ -40,9 +40,9 @@ class CCPriorityCalculator; class CCPrioritizedTextureManager { WTF_MAKE_NONCOPYABLE(CCPrioritizedTextureManager); public: - static PassOwnPtr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize) + static PassOwnPtr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool) { - return adoptPtr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize)); + return adoptPtr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool)); } PassOwnPtr<CCPrioritizedTexture> createTexture(IntSize size, GC3Denum format) { @@ -73,11 +73,11 @@ public: bool requestLate(CCPrioritizedTexture*); - void reduceMemory(TextureAllocator*); - void clearAllMemory(TextureAllocator*); + void reduceMemory(CCResourceProvider*); + void clearAllMemory(CCResourceProvider*); void allBackingTexturesWereDeleted(); - void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, TextureAllocator*); + void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*); void registerTexture(CCPrioritizedTexture*); void unregisterTexture(CCPrioritizedTexture*); @@ -105,18 +105,19 @@ private: return CCPriorityCalculator::priorityIsLower(priorityA, priorityB); } - CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize); + CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); - void reduceMemory(size_t limit, TextureAllocator*); + void reduceMemory(size_t limit, CCResourceProvider*); - CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, TextureAllocator*); - void destroyBacking(CCPrioritizedTexture::Backing*, TextureAllocator*); + CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*); + void destroyBacking(CCPrioritizedTexture::Backing*, CCResourceProvider*); size_t m_maxMemoryLimitBytes; unsigned m_priorityCutoff; size_t m_memoryUseBytes; size_t m_memoryAboveCutoffBytes; size_t m_memoryAvailableBytes; + int m_pool; typedef HashSet<CCPrioritizedTexture*> TextureSet; typedef ListHashSet<CCPrioritizedTexture::Backing*> BackingSet; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index 65f78788e..0684f3ee5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -33,7 +33,9 @@ #include "SkColor.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" +#include "cc/CCOcclusionTracker.h" #include "cc/CCOverdrawMetrics.h" +#include "cc/CCRenderPass.h" #include <public/WebTransformationMatrix.h> using namespace std; @@ -46,11 +48,13 @@ static const int debugTileBorderColorRed = 160; static const int debugTileBorderColorGreen = 100; static const int debugTileBorderColorBlue = 0; -CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads) +CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) : m_quadList(quadList) , m_layer(layer) , m_occlusionTracker(occlusionTracker) , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) + , m_forSurface(forSurface) + , m_hasOcclusionFromOutsideTargetSurface(false) { } @@ -78,13 +82,15 @@ static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad) { - IntRect culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDrawQuad->quadRect()); - return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads); -} + IntRect culledRect; + bool hasOcclusionFromOutsideTargetSurface; + + if (m_forSurface) + culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurface); + else + culledRect = m_occlusionTracker->unoccludedContentRect(m_layer, passDrawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurface); + m_hasOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface; -bool CCQuadCuller::appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad) -{ - IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, passDrawQuad->quadRect()); return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker, m_showCullingWithDebugBorderQuads); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h index 2999b6ad5..7f0802782 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h @@ -26,27 +26,33 @@ #ifndef CCQuadCuller_h #define CCQuadCuller_h -#include "cc/CCRenderPass.h" +#include "CCQuadSink.h" namespace WebCore { class CCLayerImpl; -class CCOverdrawMetrics; +class CCRenderSurface; +class CCQuadList; +template<typename LayerType, typename SurfaceType> +class CCOcclusionTrackerBase; -class CCQuadCuller { +class CCQuadCuller : public CCQuadSink { public: - // Passing 0 for CCOverdrawCounts* is valid, and disable the extra computation - // done to estimate over draw statistics. - CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerImpl*, bool showCullingWithDebugBorderQuads); + CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); + + virtual ~CCQuadCuller() { } // Returns true if the quad is added to the list, and false if the quad is entirely culled. - virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad); - virtual bool appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad); + virtual bool append(PassOwnPtr<WebKit::WebCompositorQuad> passDrawQuad) OVERRIDE; + + bool hasOcclusionFromOutsideTargetSurface() { return m_hasOcclusionFromOutsideTargetSurface; } private: CCQuadList& m_quadList; CCLayerImpl* m_layer; - const CCOcclusionTrackerImpl* m_occlusionTracker; + const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker; bool m_showCullingWithDebugBorderQuads; + bool m_forSurface; + bool m_hasOcclusionFromOutsideTargetSurface; }; } diff --git a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h index 58de11522..f2a9c62ae 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h @@ -1,49 +1,46 @@ /* - * Copyright (C) 2012, Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef CCQuadSink_h +#define CCQuadSink_h -#ifndef TextureAllocator_h -#define TextureAllocator_h +#include <wtf/PassOwnPtr.h> -#include "GraphicsContext3D.h" -#include "IntRect.h" -#include "IntSize.h" +namespace WebKit { +class WebCompositorQuad; +} namespace WebCore { -class TextureAllocator { +class CCQuadSink { public: - virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0; - virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0; - virtual void deleteAllTextures() = 0; + virtual ~CCQuadSink() { } -protected: - virtual ~TextureAllocator() { } + // Returns true if the quad is added to the list, and false if the quad is entirely culled. + virtual bool append(PassOwnPtr<WebKit::WebCompositorQuad> passDrawQuad) = 0; }; } - -#endif - - +#endif // CCQuadCuller_h diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 532665fbe..75b4e2d67 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -29,6 +29,7 @@ #include "cc/CCLayerImpl.h" #include "cc/CCMathUtil.h" +#include "cc/CCOcclusionTracker.h" #include "cc/CCQuadCuller.h" #include "cc/CCSharedQuadState.h" #include "cc/CCSolidColorDrawQuad.h" @@ -47,6 +48,7 @@ CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface, int id) , m_targetSurface(targetSurface) , m_framebufferOutputRect(targetSurface->contentRect()) , m_hasTransparentBackground(true) + , m_hasOcclusionFromOutsideTargetSurface(false) { ASSERT(targetSurface); ASSERT(id > 0); @@ -54,35 +56,43 @@ CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface, int id) void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, bool& hadMissingTiles) { - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders()); + const bool forSurface = false; + CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(m_sharedQuadStateList.size()); layer->appendDebugBorderQuad(quadCuller, sharedQuadState.get()); layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); m_sharedQuadStateList.append(sharedQuadState.release()); + + m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker) { // FIXME: render surface layers should be a CCLayerImpl-derived class and // not be handled specially here. - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders()); + const bool forSurface = true; + CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); CCRenderSurface* surface = layer->renderSurface(); - OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(m_sharedQuadStateList.size()); bool isReplica = false; surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(sharedQuadState.release()); + m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); + if (!layer->hasReplica()) return; // Add replica after the surface so that it appears below the surface. - OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(); + OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(m_sharedQuadStateList.size()); isReplica = true; surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(replicaSharedQuadState.release()); + + m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl& occlusionTracker) @@ -96,7 +106,7 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree // Manually create the quad state for the gutter quads, as the root layer // doesn't have any bounds and so can't generate this itself. - OwnPtr<CCSharedQuadState> sharedQuadState = rootLayer->createSharedQuadState(); + OwnPtr<CCSharedQuadState> sharedQuadState = rootLayer->createSharedQuadState(m_sharedQuadStateList.size()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 010a7674b..816481c97 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -71,6 +71,8 @@ public: bool hasTransparentBackground() const { return m_hasTransparentBackground; } void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; } + bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; } + void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; } protected: CCRenderPass(CCRenderSurface*, int id); @@ -80,6 +82,7 @@ protected: IntRect m_framebufferOutputRect; Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList; bool m_hasTransparentBackground; + bool m_hasOcclusionFromOutsideTargetSurface; }; typedef Vector<CCRenderPass*> CCRenderPassList; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp index 59abfbbcc..2d74a2278 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp @@ -31,19 +31,19 @@ using WebKit::WebCompositorQuad; namespace WebCore { -PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) +PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) { - return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); + return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame)); } -CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) +CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame) : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect) , m_renderPassId(renderPassId) , m_isReplica(isReplica) , m_drawTransform(drawTransform) , m_filters(filters) , m_backgroundFilters(backgroundFilters) - , m_maskTextureId(maskTextureId) + , m_maskResourceId(maskResourceId) , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame) { ASSERT(m_renderPassId > 0); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h index a12f204ca..6f399be67 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h @@ -26,6 +26,7 @@ #ifndef CCRenderPassDrawQuad_h #define CCRenderPassDrawQuad_h +#include "cc/CCResourceProvider.h" #include <public/WebCompositorQuad.h> #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> @@ -38,11 +39,11 @@ class CCRenderPass; class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad); public: - static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); + static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); int renderPassId() const { return m_renderPassId; } bool isReplica() const { return m_isReplica; } - unsigned maskTextureId() const { return m_maskTextureId; } + CCResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; } const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; } // FIXME: This should be removed and we should draw the RenderPass with the quadTransform. @@ -53,14 +54,14 @@ public: static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); + CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame); int m_renderPassId; bool m_isReplica; WebKit::WebTransformationMatrix m_drawTransform; WebKit::WebFilterOperations m_filters; WebKit::WebFilterOperations m_backgroundFilters; - unsigned m_maskTextureId; + CCResourceProvider::ResourceId m_maskResourceId; IntRect m_contentsChangedSinceLastFrame; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index e7260966a..22434c203 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -36,7 +36,7 @@ #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" #include "cc/CCMathUtil.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCRenderPassDrawQuad.h" #include "cc/CCSharedQuadState.h" #include <public/WebTransformationMatrix.h> @@ -163,16 +163,16 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const return m_surfacePropertyChanged && !m_owningLayer->layerPropertyChanged(); } -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState() const +PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState(int id) const { bool isOpaque = false; - return CCSharedQuadState::create(m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); + return CCSharedQuadState::create(id, m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState() const +PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState(int id) const { bool isOpaque = false; - return CCSharedQuadState::create(m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); + return CCSharedQuadState::create(id, m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const @@ -181,7 +181,7 @@ FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRec return CCMathUtil::projectClippedRect(inverseScreenSpaceTransform, rootScissorRect); } -void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) +void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) { ASSERT(!forReplica || m_owningLayer->hasReplica()); @@ -190,7 +190,7 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen; int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue; SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue); - quadList.appendSurface(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); + quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); } // FIXME: By using the same RenderSurface for both the content and its reflection, @@ -209,14 +209,14 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha maskLayer = 0; } - int maskTextureId = maskLayer ? maskLayer->contentsTextureId() : 0; + CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); const WebKit::WebFilterOperations& filters = m_owningLayer->filters(); const WebKit::WebFilterOperations& backgroundFilters = m_owningLayer->backgroundFilters(); - quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); + quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame)); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 9f7d876ee..79fdac4ec 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -39,7 +39,7 @@ namespace WebCore { class CCDamageTracker; -class CCQuadCuller; +class CCQuadSink; class CCRenderPass; class CCLayerImpl; class LayerRendererChromium; @@ -114,10 +114,10 @@ public: CCDamageTracker* damageTracker() const { return m_damageTracker.get(); } - PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; - PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState() const; + PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; + PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState(int id) const; - void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, int renderPassId); + void appendQuads(CCQuadSink&, CCSharedQuadState*, bool forReplica, int renderPassId); FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const; @@ -157,6 +157,7 @@ private: // For CCLayerIteratorActions int m_targetRenderSurfaceLayerIndexHistory; int m_currentLayerIndexHistory; + friend struct CCLayerIteratorActions; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp index 2f031bf21..9b62946bd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp @@ -193,12 +193,7 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter source.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); source.setPixelRef(new SkGrTexturePixelRef(texture.get()))->unref(); - GrContext::TextureCacheEntry dest; - for (unsigned i = 0; i < filters.size(); ++i) { - // Save the previous texture cache destination (if any), and keep it - // locked during draw to prevent it be re-used as destination. - GrContext::TextureCacheEntry sourceEntry = dest; const WebKit::WebFilterOperation& op = filters.at(i); // Allocate a destination texture. GrTextureDesc desc; @@ -208,10 +203,11 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter desc.fHeight = size.height(); desc.fConfig = kSkia8888_PM_GrPixelConfig; // FIXME: could we use approximate match, and fix texcoords on draw - dest = gr->lockScratchTexture(desc, GrContext::kExact_ScratchTexMatch); - if (!dest.texture()) + GrAutoScratchTexture scratchTexture(gr, desc, GrContext::kExact_ScratchTexMatch); + SkAutoTUnref<GrTexture> destination(scratchTexture.detach()); + if (!destination.get()) return SkBitmap(); - SkGpuDevice device(gr, dest.texture()); + SkGpuDevice device(gr, destination.get()); SkCanvas canvas(&device); canvas.clear(0x0); switch (op.type()) { @@ -289,13 +285,8 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter break; } // Dest texture from this filter becomes source bitmap for next filter. - source.setPixelRef(new SkGrTexturePixelRef(dest.texture()))->unref(); - // Unlock the previous texture cache entry. - if (sourceEntry.texture()) - gr->unlockTexture(sourceEntry); + source.setPixelRef(new SkGrTexturePixelRef(destination.get()))->unref(); } - if (dest.texture()) - gr->unlockTexture(dest); context3D->flush(); return source; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h index ded0efdc3..d931022dc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h @@ -36,9 +36,7 @@ namespace WebCore { class CCScopedTexture; -class TextureAllocator; class TextureCopier; -class TextureManager; class TextureUploader; enum TextureUploaderOption { ThrottledUploader, UnthrottledUploader }; @@ -57,6 +55,13 @@ public: class CCRenderer { WTF_MAKE_NONCOPYABLE(CCRenderer); public: + // This enum defines the various resource pools for the CCResourceProvider + // where textures get allocated. + enum ResourcePool { + ImplPool = 1, // This pool is for textures that get allocated on the impl thread (e.g. RenderSurfaces). + ContentPool // This pool is for textures that get allocated on the main thread (e.g. tiles). + }; + virtual ~CCRenderer() { } virtual const LayerRendererCapabilities& capabilities() const = 0; @@ -67,24 +72,23 @@ public: int viewportWidth() { return viewportSize().width(); } int viewportHeight() { return viewportSize().height(); } - virtual void viewportChanged() = 0; + virtual void viewportChanged() { } const WebKit::WebTransformationMatrix& projectionMatrix() const { return m_projectionMatrix; } const WebKit::WebTransformationMatrix& windowMatrix() const { return m_windowMatrix; } - virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) = 0; - virtual bool haveCachedResourcesForRenderPassId(int) const = 0; + virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { } + virtual bool haveCachedResourcesForRenderPassId(int) const { return false; } - virtual void beginDrawingFrame(const CCRenderPass* defaultRenderPass) = 0; - virtual void drawRenderPass(const CCRenderPass*, const FloatRect& rootScissorRectInCurrentPass) = 0; - virtual void finishDrawingFrame() = 0; + virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) = 0; + virtual void finishDrawingFrame() { } virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) = 0; // waits for rendering to finish virtual void finish() = 0; - virtual void doNoOp() = 0; + virtual void doNoOp() { } // puts backbuffer onscreen virtual bool swapBuffers(const IntRect& subBuffer) = 0; @@ -92,12 +96,8 @@ public: virtual TextureCopier* textureCopier() const = 0; virtual TextureUploader* textureUploader() const = 0; - virtual TextureAllocator* implTextureAllocator() const = 0; - virtual TextureAllocator* contentsTextureAllocator() const = 0; - - virtual void setScissorToRect(const IntRect&) = 0; - virtual bool isContextLost() = 0; + virtual bool isContextLost() { return false; } virtual void setVisible(bool) = 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp new file mode 100644 index 000000000..ef82bf22a --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp @@ -0,0 +1,250 @@ +/* + * Copyright (C) 2012, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "cc/CCResourceProvider.h" + +#include "Extensions3DChromium.h" +#include "IntRect.h" +#include "LayerRendererChromium.h" // For the GLC() macro +#include "LayerTextureSubImage.h" +#include "cc/CCGraphicsContext.h" +#include "cc/CCProxy.h" +#include <public/WebGraphicsContext3D.h> + +using WebKit::WebGraphicsContext3D; + +namespace WebCore { + +static GC3Denum textureToStorageFormat(GC3Denum textureFormat) +{ + GC3Denum storageFormat = Extensions3D::RGBA8_OES; + switch (textureFormat) { + case GraphicsContext3D::RGBA: + break; + case Extensions3D::BGRA_EXT: + storageFormat = Extensions3DChromium::BGRA8_EXT; + break; + default: + ASSERT_NOT_REACHED(); + break; + } + + return storageFormat; +} + +static bool isTextureFormatSupportedForStorage(GC3Denum format) +{ + return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EXT); +} + +PassOwnPtr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* context) +{ + OwnPtr<CCResourceProvider> resourceProvider(adoptPtr(new CCResourceProvider(context))); + if (!resourceProvider->initialize()) + return nullptr; + return resourceProvider.release(); +} + +CCResourceProvider::~CCResourceProvider() +{ +} + +WebGraphicsContext3D* CCResourceProvider::graphicsContext3D() +{ + ASSERT(CCProxy::isImplThread()); + return m_context->context3D(); +} + +bool CCResourceProvider::inUseByConsumer(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end()); + return !!it->second.lockForReadCount; +} + +CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint) +{ + ASSERT(CCProxy::isImplThread()); + unsigned textureId = 0; + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return 0; + } + GLC(context3d, textureId = context3d->createTexture()); + GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); + + if (m_useTextureUsageHint && hint == TextureUsageFramebuffer) + GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); + if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { + GC3Denum storageFormat = textureToStorageFormat(format); + GLC(context3d, context3d->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height())); + } else + GLC(context3d, context3d->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); + ResourceId id = m_nextId++; + Resource resource = {textureId, pool, 0, false, false, size, format}; + m_resources.add(id, resource); + return id; +} + +CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTexture(unsigned textureId) +{ + ASSERT(CCProxy::isImplThread()); + ResourceId id = m_nextId++; + Resource resource = {textureId, 0, 0, false, true, IntSize(), 0}; + m_resources.add(id, resource); + return id; +} + +void CCResourceProvider::deleteResource(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return; + } + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount); + if (!it->second.external) + GLC(context3d, context3d->deleteTexture(it->second.glId)); + m_resources.remove(it); +} + +void CCResourceProvider::deleteOwnedResources(int pool) +{ + ASSERT(CCProxy::isImplThread()); + Vector<ResourceId> toDelete; + for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) { + if (it->second.pool == pool && !it->second.external) + toDelete.append(it->first); + } + for (Vector<ResourceId>::iterator it = toDelete.begin(); it != toDelete.end(); ++it) + deleteResource(*it); +} + +void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect) +{ + ASSERT(CCProxy::isImplThread()); + ASSERT(m_texSubImage.get()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return; + } + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external); + + context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, it->second.glId); + m_texSubImage->upload(image, imageRect, sourceRect, destRect, it->second.format, context3d); +} + +unsigned CCResourceProvider::lockForWrite(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external); + it->second.lockedForWrite = true; + return it->second.glId; +} + +void CCResourceProvider::unlockForWrite(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && it->second.lockedForWrite && !it->second.external); + it->second.lockedForWrite = false; +} + +void CCResourceProvider::flush() +{ + ASSERT(CCProxy::isImplThread()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d) { + // FIXME: Implement this path for software compositing. + return; + } + context3d->flush(); +} + +unsigned CCResourceProvider::lockForRead(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && !it->second.lockedForWrite); + ++(it->second.lockForReadCount); + return it->second.glId; +} + +void CCResourceProvider::unlockForRead(ResourceId id) +{ + ASSERT(CCProxy::isImplThread()); + ResourceMap::iterator it = m_resources.find(id); + ASSERT(it != m_resources.end() && it->second.lockForReadCount > 0); + --(it->second.lockForReadCount); +} + +CCResourceProvider::CCResourceProvider(CCGraphicsContext* context) + : m_context(context) + , m_nextId(1) + , m_useTextureStorageExt(false) + , m_useTextureUsageHint(false) + , m_maxTextureSize(0) +{ +} + +bool CCResourceProvider::initialize() +{ + ASSERT(CCProxy::isImplThread()); + WebGraphicsContext3D* context3d = m_context->context3D(); + if (!context3d || !context3d->makeContextCurrent()) { + // FIXME: Implement this path for software compositing. + return false; + } + String extensionsString = context3d->getString(GraphicsContext3D::EXTENSIONS); + Vector<String> extensions; + extensionsString.split(' ', extensions); + bool useMapSub = false; + for (size_t i = 0; i < extensions.size(); ++i) { + if (extensions[i] == "GL_EXT_texture_storage") + m_useTextureStorageExt = true; + else if (extensions[i] == "GL_ANGLE_texture_usage") + m_useTextureUsageHint = true; + else if (extensions[i] == "GL_CHROMIUM_map_sub") + useMapSub = true; + } + + m_texSubImage = adoptPtr(new LayerTextureSubImage(useMapSub)); + GLC(context3d, context3d->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize)); + return true; +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h new file mode 100644 index 000000000..0476f0e88 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef CCResourceProvider_h +#define CCResourceProvider_h + +#include "GraphicsContext3D.h" +#include "IntSize.h" +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { +class WebGraphicsContext3D; +} + +namespace WebCore { + +class CCGraphicsContext; +class CCScopedLockResourceForRead; +class CCScopedLockResourceForWrite; +class LayerTextureSubImage; + +// Thread-safety notes: this class is not thread-safe and can only be called +// from the thread it was created on (in practice, the compositor thread). +class CCResourceProvider { + WTF_MAKE_NONCOPYABLE(CCResourceProvider); +public: + typedef unsigned ResourceId; + enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; + + static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*); + + virtual ~CCResourceProvider(); + + WebKit::WebGraphicsContext3D* graphicsContext3D(); + int maxTextureSize() const { return m_maxTextureSize; } + unsigned numResources() const { return m_resources.size(); } + + // Checks whether a resource is in use by a consumer. + bool inUseByConsumer(ResourceId); + + + // Producer interface. + + // Creates a resource of the given size/format, into the given pool. + ResourceId createResource(int pool, const IntSize&, GC3Denum format, TextureUsageHint); + + // Wraps an external texture into a resource. + ResourceId createResourceFromExternalTexture(unsigned textureId); + void deleteResource(ResourceId); + + // Deletes all resources owned by a given pool. + void deleteOwnedResources(int pool); + + // Upload data from image, copying sourceRect (in image) into destRect (in the resource). + void upload(ResourceId, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntRect& destRect); + + // Flush all context operations, kicking uploads and ensuring ordering with + // respect to other contexts. + void flush(); + +private: + friend class CCScopedLockResourceForRead; + friend class CCScopedLockResourceForWrite; + + struct Resource { + unsigned glId; + int pool; + int lockForReadCount; + bool lockedForWrite; + bool external; + IntSize size; + GC3Denum format; + }; + typedef HashMap<ResourceId, Resource> ResourceMap; + + explicit CCResourceProvider(CCGraphicsContext*); + bool initialize(); + + // Gets a GL texture id representing the resource, that can be rendered into. + unsigned lockForWrite(ResourceId); + void unlockForWrite(ResourceId); + + // Gets a GL texture id representing the resource, that can be rendered with. + unsigned lockForRead(ResourceId); + void unlockForRead(ResourceId); + + CCGraphicsContext* m_context; + ResourceId m_nextId; + ResourceMap m_resources; + + bool m_useTextureStorageExt; + bool m_useTextureUsageHint; + OwnPtr<LayerTextureSubImage> m_texSubImage; + int m_maxTextureSize; +}; + +class CCScopedLockResourceForRead { + WTF_MAKE_NONCOPYABLE(CCScopedLockResourceForRead); +public: + CCScopedLockResourceForRead(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) + : m_resourceProvider(resourceProvider) + , m_resourceId(resourceId) + , m_textureId(resourceProvider->lockForRead(resourceId)) { } + + ~CCScopedLockResourceForRead() + { + m_resourceProvider->unlockForRead(m_resourceId); + } + + unsigned textureId() const { return m_textureId; } + +private: + CCResourceProvider* m_resourceProvider; + CCResourceProvider::ResourceId m_resourceId; + unsigned m_textureId; +}; + +class CCScopedLockResourceForWrite { + WTF_MAKE_NONCOPYABLE(CCScopedLockResourceForWrite); +public: + CCScopedLockResourceForWrite(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId) + : m_resourceProvider(resourceProvider) + , m_resourceId(resourceId) + , m_textureId(resourceProvider->lockForWrite(resourceId)) { } + + ~CCScopedLockResourceForWrite() + { + m_resourceProvider->unlockForWrite(m_resourceId); + } + + unsigned textureId() const { return m_textureId; } + +private: + CCResourceProvider* m_resourceProvider; + CCResourceProvider::ResourceId m_resourceId; + unsigned m_textureId; +}; + +} + +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp index b9f75d184..21ef99a65 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp @@ -26,14 +26,12 @@ #include "config.h" #include "cc/CCScopedTexture.h" -#include "TextureAllocator.h" - namespace WebCore { -CCScopedTexture::CCScopedTexture(TextureAllocator* allocator) - : m_allocator(allocator) +CCScopedTexture::CCScopedTexture(CCResourceProvider* resourceProvider) + : m_resourceProvider(resourceProvider) { - ASSERT(m_allocator); + ASSERT(m_resourceProvider); } CCScopedTexture::~CCScopedTexture() @@ -41,13 +39,13 @@ CCScopedTexture::~CCScopedTexture() free(); } -bool CCScopedTexture::allocate(const IntSize& size, GC3Denum format) +bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, CCResourceProvider::TextureUsageHint hint) { ASSERT(!id()); ASSERT(!size.isEmpty()); setDimensions(size, format); - setId(m_allocator->createTexture(size, format)); + setId(m_resourceProvider->createResource(pool, size, format, hint)); #if !ASSERT_DISABLED m_allocateThreadIdentifier = WTF::currentThread(); @@ -60,7 +58,7 @@ void CCScopedTexture::free() { if (id()) { ASSERT(m_allocateThreadIdentifier == WTF::currentThread()); - m_allocator->deleteTexture(id(), size(), format()); + m_resourceProvider->deleteResource(id()); } setId(0); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h index 9f7241f51..734420e90 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h @@ -26,7 +26,6 @@ #ifndef CCScopedTexture_h #define CCScopedTexture_h -#include "TextureAllocator.h" #include "cc/CCTexture.h" #if !ASSERT_DISABLED @@ -35,11 +34,10 @@ namespace WebCore { - class CCScopedTexture : protected CCTexture { WTF_MAKE_NONCOPYABLE(CCScopedTexture); public: - static PassOwnPtr<CCScopedTexture> create(TextureAllocator* allocator) { return adoptPtr(new CCScopedTexture(allocator)); } + static PassOwnPtr<CCScopedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CCScopedTexture(resourceProvider)); } virtual ~CCScopedTexture(); using CCTexture::id; @@ -47,15 +45,15 @@ public: using CCTexture::format; using CCTexture::bytes; - bool allocate(const IntSize&, GC3Denum format); + bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider::TextureUsageHint); void free(); void leak(); protected: - explicit CCScopedTexture(TextureAllocator*); + explicit CCScopedTexture(CCResourceProvider*); private: - TextureAllocator* m_allocator; + CCResourceProvider* m_resourceProvider; #if !ASSERT_DISABLED ThreadIdentifier m_allocateThreadIdentifier; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp index f38fbda01..1fcd1da8b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp @@ -31,7 +31,7 @@ #include "ScrollbarTheme.h" #include "ScrollbarThemeComposite.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCTextureDrawQuad.h" namespace WebCore { @@ -45,9 +45,9 @@ CCScrollbarLayerImpl::CCScrollbarLayerImpl(int id) : CCLayerImpl(id) , m_scrollLayer(0) , m_scrollbar(this) - , m_backTrackTextureId(0) - , m_foreTrackTextureId(0) - , m_thumbTextureId(0) + , m_backTrackResourceId(0) + , m_foreTrackResourceId(0) + , m_thumbResourceId(0) { } @@ -62,7 +62,7 @@ FloatRect toUVRect(const IntRect& r, const IntRect& bounds) } -void CCScrollbarLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { ScrollbarThemeComposite* theme = static_cast<ScrollbarThemeComposite*>(ScrollbarTheme::theme()); if (!theme) @@ -76,23 +76,23 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQua IntRect thumbRect, backTrackRect, foreTrackRect; theme->splitTrack(&m_scrollbar, theme->trackRect(&m_scrollbar), backTrackRect, thumbRect, foreTrackRect); - if (m_thumbTextureId && theme->hasThumb(&m_scrollbar) && !thumbRect.isEmpty()) { - OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, thumbRect, m_thumbTextureId, premultipledAlpha, uvRect, flipped); + if (m_thumbResourceId && theme->hasThumb(&m_scrollbar) && !thumbRect.isEmpty()) { + OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, thumbRect, m_thumbResourceId, premultipledAlpha, uvRect, flipped); quad->setNeedsBlending(); quadList.append(quad.release()); } - if (!m_backTrackTextureId) + if (!m_backTrackResourceId) return; // We only paint the track in two parts if we were given a texture for the forward track part. - if (m_foreTrackTextureId && !foreTrackRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, foreTrackRect, m_foreTrackTextureId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); + if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) + quadList.append(CCTextureDrawQuad::create(sharedQuadState, foreTrackRect, m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); // Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and // fore track quads. The back track texture contains (and displays) the buttons. if (!boundsRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, boundsRect, m_backTrackTextureId, premultipledAlpha, uvRect, flipped)); + quadList.append(CCTextureDrawQuad::create(sharedQuadState, boundsRect, m_backTrackResourceId, premultipledAlpha, uvRect, flipped)); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h index ece2b9571..faa3361ba 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h @@ -53,14 +53,14 @@ public: void setEnabled(bool enabled) { m_enabled = enabled; } - void setBackTrackTextureId(unsigned id) { m_backTrackTextureId = id; } - void setForeTrackTextureId(unsigned id) { m_foreTrackTextureId = id; } - void setThumbTextureId(unsigned id) { m_thumbTextureId = id; } + void setBackTrackResourceId(CCResourceProvider::ResourceId id) { m_backTrackResourceId = id; } + void setForeTrackResourceId(CCResourceProvider::ResourceId id) { m_foreTrackResourceId = id; } + void setThumbResourceId(CCResourceProvider::ResourceId id) { m_thumbResourceId = id; } CCLayerImpl* scrollLayer() const { return m_scrollLayer; } void setScrollLayer(CCLayerImpl* scrollLayer) { m_scrollLayer = scrollLayer; } - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; protected: explicit CCScrollbarLayerImpl(int id); @@ -124,9 +124,9 @@ private: }; CCScrollbar m_scrollbar; - unsigned m_backTrackTextureId; - unsigned m_foreTrackTextureId; - unsigned m_thumbTextureId; + CCResourceProvider::ResourceId m_backTrackResourceId; + CCResourceProvider::ResourceId m_foreTrackResourceId; + CCResourceProvider::ResourceId m_thumbResourceId; ScrollbarOverlayStyle m_scrollbarOverlayStyle; Vector<IntRect> m_tickmarks; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 678efdff0..002c7a7bf 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -158,7 +158,7 @@ bool CCSingleThreadProxy::recreateContext() bool initialized; { DebugScopedSetImplThread impl; - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); initialized = m_layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); if (initialized) { m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); @@ -213,7 +213,7 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdater& updater) // here as the throttled uploader isn't used in single thread mode. // For correctness, loop until no more updates are pending. while (updater.hasMoreUpdates()) - updater.update(m_layerTreeHostImpl->context(), m_layerTreeHostImpl->contentsTextureAllocator(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), maxPartialTextureUpdates()); + updater.update(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), maxPartialTextureUpdates()); m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); @@ -262,7 +262,7 @@ void CCSingleThreadProxy::stop() DebugScopedSetImplThread impl; if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit()) - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_layerTreeHostImpl.clear(); } m_layerTreeHost = 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp index 4d52c15dd..f52c797c0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp @@ -29,7 +29,7 @@ #include "cc/CCSolidColorLayerImpl.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCSolidColorDrawQuad.h" #include <wtf/MathExtras.h> #include <wtf/text/WTFString.h> @@ -49,7 +49,7 @@ CCSolidColorLayerImpl::~CCSolidColorLayerImpl() { } -void CCSolidColorLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { // We create a series of smaller quads instead of just one large one so that the // culler can reduce the total pixels drawn. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h index e3005845e..7153f21ab 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h @@ -41,7 +41,7 @@ public: } virtual ~CCSolidColorLayerImpl(); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; protected: explicit CCSolidColorLayerImpl(int id); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h index 0d5d9f768..d3e4b8f7e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h @@ -28,6 +28,7 @@ #include "GraphicsContext3D.h" #include "IntSize.h" +#include "cc/CCResourceProvider.h" #include "cc/CCTexture.h" namespace WebCore { @@ -40,11 +41,11 @@ public: , m_size(size) , m_format(format) { } - unsigned id() const { return m_id; } + CCResourceProvider::ResourceId id() const { return m_id; } const IntSize& size() const { return m_size; } GC3Denum format() const { return m_format; } - void setId(unsigned id) { m_id = id; } + void setId(CCResourceProvider::ResourceId id) { m_id = id; } void setDimensions(const IntSize&, GC3Denum format); size_t bytes() const; @@ -52,7 +53,7 @@ public: static size_t memorySizeBytes(const IntSize&, GC3Denum format); private: - unsigned m_id; + CCResourceProvider::ResourceId m_id; IntSize m_size; GC3Denum m_format; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp index 6df2fb6bd..7cbbece16 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp @@ -30,7 +30,8 @@ #include "cc/CCTextureLayerImpl.h" #include "TextStream.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" +#include "cc/CCRenderer.h" #include "cc/CCTextureDrawQuad.h" namespace WebCore { @@ -38,6 +39,7 @@ namespace WebCore { CCTextureLayerImpl::CCTextureLayerImpl(int id) : CCLayerImpl(id) , m_textureId(0) + , m_externalTextureResource(0) , m_premultipliedAlpha(true) , m_flipped(true) , m_uvRect(0, 0, 1, 1) @@ -48,10 +50,28 @@ CCTextureLayerImpl::~CCTextureLayerImpl() { } -void CCTextureLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) { + ASSERT(!m_externalTextureResource); + m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); +} + +void CCTextureLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +{ + ASSERT(m_externalTextureResource); IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_textureId, m_premultipliedAlpha, m_uvRect, m_flipped)); + quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); +} + +void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) +{ + ASSERT(m_externalTextureResource); + // FIXME: the following assert will not be true when sending resources to a + // parent compositor. A synchronization scheme (double-buffering or + // pipelining of updates) for the client will need to exist to solve this. + ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource)); + resourceProvider->deleteResource(m_externalTextureResource); + m_externalTextureResource = 0; } void CCTextureLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h index 4abdb51ff..e5453148d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h @@ -38,7 +38,9 @@ public: } virtual ~CCTextureLayerImpl(); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void willDraw(CCResourceProvider*) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; @@ -56,6 +58,7 @@ private: virtual const char* layerTypeAsString() const OVERRIDE { return "TextureLayer"; } unsigned m_textureId; + CCResourceProvider::ResourceId m_externalTextureResource; bool m_premultipliedAlpha; bool m_flipped; FloatRect m_uvRect; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp index bc1ed75af..967ad5e3f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp @@ -85,7 +85,7 @@ bool CCTextureUpdater::hasMoreUpdates() const return m_fullEntries.size() || m_partialEntries.size() || m_copyEntries.size(); } -void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allocator, TextureCopier* copier, TextureUploader* uploader, size_t count) +void CCTextureUpdater::update(CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader, size_t count) { size_t index; @@ -99,15 +99,15 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo size_t maxIndex = min(m_entryIndex + count, m_fullEntries.size()); for (index = m_entryIndex; index < maxIndex; ++index) { UpdateEntry& entry = m_fullEntries[index]; - uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect); + uploader->uploadTexture(entry.texture, resourceProvider, entry.sourceRect, entry.destRect); fullUploadCount++; if (!(fullUploadCount % kUploadFlushPeriod)) - context->flush(); + resourceProvider->flush(); } // Make sure there are no dangling uploads without a flush. if (fullUploadCount % kUploadFlushPeriod) - context->flush(); + resourceProvider->flush(); bool moreUploads = maxIndex < m_fullEntries.size(); @@ -125,34 +125,30 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo for (index = 0; index < m_partialEntries.size(); ++index) { UpdateEntry& entry = m_partialEntries[index]; - uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect); + uploader->uploadTexture(entry.texture, resourceProvider, entry.sourceRect, entry.destRect); if (!((index+1) % kUploadFlushPeriod)) - context->flush(); + resourceProvider->flush(); } // Make sure there are no dangling partial uploads without a flush. // Note: We don't need to use (index+1) in this case because index was // incremented at the end of the for loop. if (index % kUploadFlushPeriod) - context->flush(); + resourceProvider->flush(); uploader->endUploads(); } for (index = 0; index < m_copyEntries.size(); ++index) { CopyEntry& copyEntry = m_copyEntries[index]; - copier->copyTexture(context, copyEntry.sourceTexture, copyEntry.destTexture, copyEntry.size); + copier->copyTexture(copyEntry.sourceTexture, copyEntry.destTexture, copyEntry.size); } // If we've performed any texture copies, we need to insert a flush here into the compositor context // before letting the main thread proceed as it may make draw calls to the source texture of one of // our copy operations. - if (m_copyEntries.size()) { - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (context3d) - context3d->flush(); - // FIXME: Implement this path for software compositing. - } + if (m_copyEntries.size()) + copier->flush(); // If no entries left to process, auto-clear. clear(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h index 8a437942b..972a1c0ec 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h @@ -32,7 +32,7 @@ namespace WebCore { -class TextureAllocator; +class CCResourceProvider; class TextureCopier; class TextureUploader; @@ -48,7 +48,7 @@ public: bool hasMoreUpdates() const; // Update some textures. - void update(CCGraphicsContext*, TextureAllocator*, TextureCopier*, TextureUploader*, size_t count); + void update(CCResourceProvider*, TextureCopier*, TextureUploader*, size_t count); void clear(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp index 9973a974b..9b6dfe3ac 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp @@ -75,7 +75,6 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) : m_animateRequested(false) , m_commitRequested(false) , m_forcedCommitRequested(false) - , m_contextLost(false) , m_layerTreeHost(layerTreeHost) , m_compositorIdentifier(-1) , m_layerRendererInitialized(false) @@ -600,7 +599,7 @@ void CCThreadProxy::scheduledActionUpdateMoreResources() { TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionUpdateMoreResources"); ASSERT(m_currentTextureUpdaterOnImplThread); - m_currentTextureUpdaterOnImplThread->update(m_layerTreeHostImpl->context(), m_layerTreeHostImpl->contentsTextureAllocator(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), textureUpdatesPerFrame); + m_currentTextureUpdaterOnImplThread->update(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), textureUpdatesPerFrame); } void CCThreadProxy::scheduledActionCommit() @@ -849,7 +848,7 @@ void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); ASSERT(isImplThread()); if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit()) - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_inputHandlerOnImplThread.clear(); m_layerTreeHostImpl.clear(); m_schedulerOnImplThread.clear(); @@ -884,7 +883,7 @@ void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, C { TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); ASSERT(isImplThread()); - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator()); + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptPtr(contextPtr), textureUploader); if (*recreateSucceeded) { *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h index e10c3dcb0..0f8a35404 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h @@ -152,7 +152,6 @@ private: bool m_animateRequested; bool m_commitRequested; bool m_forcedCommitRequested; - bool m_contextLost; OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; CCLayerTreeHost* m_layerTreeHost; int m_compositorIdentifier; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index da9a10a99..ee4965187 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -35,7 +35,7 @@ #include "cc/CCCheckerboardDrawQuad.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerTilingData.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" #include "cc/CCSolidColorDrawQuad.h" #include "cc/CCTileDrawQuad.h" #include <wtf/text/WTFString.h> @@ -59,13 +59,13 @@ class DrawableTile : public CCLayerTilingData::Tile { public: static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile()); } - Platform3DObject textureId() const { return m_textureId; } - void setTextureId(Platform3DObject textureId) { m_textureId = textureId; } + CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } + void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; } private: - DrawableTile() : m_textureId(0) { } + DrawableTile() : m_resourceId(0) { } - Platform3DObject m_textureId; + CCResourceProvider::ResourceId m_resourceId; }; CCTiledLayerImpl::CCTiledLayerImpl(int id) @@ -79,7 +79,7 @@ CCTiledLayerImpl::~CCTiledLayerImpl() { } -unsigned CCTiledLayerImpl::contentsTextureId() const +CCResourceProvider::ResourceId CCTiledLayerImpl::contentsResourceId() const { // This function is only valid for single texture layers, e.g. masks. ASSERT(m_tiler); @@ -87,10 +87,10 @@ unsigned CCTiledLayerImpl::contentsTextureId() const ASSERT(m_tiler->numTilesY() == 1); DrawableTile* tile = tileAt(0, 0); - Platform3DObject textureId = tile ? tile->textureId() : 0; - ASSERT(textureId); + CCResourceProvider::ResourceId resourceId = tile ? tile->resourceId() : 0; + ASSERT(resourceId); - return textureId; + return resourceId; } void CCTiledLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const @@ -107,7 +107,7 @@ bool CCTiledLayerImpl::hasTileAt(int i, int j) const bool CCTiledLayerImpl::hasTextureIdForTileAt(int i, int j) const { - return hasTileAt(i, j) && tileAt(i, j)->textureId(); + return hasTileAt(i, j) && tileAt(i, j)->resourceId(); } DrawableTile* CCTiledLayerImpl::tileAt(int i, int j) const @@ -123,7 +123,7 @@ DrawableTile* CCTiledLayerImpl::createTile(int i, int j) return addedTile; } -void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) +void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) { const IntRect& contentRect = visibleContentRect(); @@ -140,7 +140,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta IntRect tileRect = m_tiler->tileBounds(i, j); SkColor borderColor; - if (m_skipsDraw || !tile || !tile->textureId()) + if (m_skipsDraw || !tile || !tile->resourceId()) borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorderMissingTileColorBlue); else borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); @@ -163,7 +163,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta if (tileRect.isEmpty()) continue; - if (!tile || !tile->textureId()) { + if (!tile || !tile->resourceId()) { if (drawCheckerboardForMissingTiles()) hadMissingTiles |= quadList.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect)); else @@ -190,7 +190,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; - quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->textureId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } } } @@ -204,12 +204,12 @@ void CCTiledLayerImpl::setTilingData(const CCLayerTilingData& tiler) *m_tiler = tiler; } -void CCTiledLayerImpl::pushTileProperties(int i, int j, unsigned textureId, const IntRect& opaqueRect) +void CCTiledLayerImpl::pushTileProperties(int i, int j, CCResourceProvider::ResourceId resourceId, const IntRect& opaqueRect) { DrawableTile* tile = tileAt(i, j); if (!tile) tile = createTile(i, j); - tile->setTextureId(textureId); + tile->setResourceId(resourceId); tile->setOpaqueRect(opaqueRect); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h index 4052fe97c..015fdc306 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h @@ -42,15 +42,15 @@ public: } virtual ~CCTiledLayerImpl(); - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual unsigned contentsTextureId() const OVERRIDE; + virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; } void setTilingData(const CCLayerTilingData& tiler); - void pushTileProperties(int, int, unsigned textureId, const IntRect& opaqueRect); + void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect); void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; } bool contentsSwizzled() const { return m_contentsSwizzled; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index b524596f0..fa201d112 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -31,15 +31,13 @@ #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" // For GLC macro -#include "LayerTextureSubImage.h" #include "NotImplemented.h" #include "TextStream.h" -#include "TextureAllocator.h" -#include "cc/CCGraphicsContext.h" +#include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCProxy.h" -#include "cc/CCQuadCuller.h" +#include "cc/CCQuadSink.h" +#include "cc/CCResourceProvider.h" #include "cc/CCStreamVideoDrawQuad.h" #include "cc/CCTextureDrawQuad.h" #include "cc/CCYUVVideoDrawQuad.h" @@ -52,6 +50,7 @@ CCVideoLayerImpl::CCVideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provid : CCLayerImpl(id) , m_provider(provider) , m_frame(0) + , m_externalTextureResource(0) { // This matrix is the default transformation for stream textures, and flips on the Y axis. m_streamTextureMatrix = WebKit::WebTransformationMatrix( @@ -76,11 +75,12 @@ CCVideoLayerImpl::~CCVideoLayerImpl() m_provider->setVideoFrameProviderClient(0); m_provider = 0; } - freePlaneData(layerTreeHostImpl()->context()); + freePlaneData(layerTreeHostImpl()->resourceProvider()); #if !ASSERT_DISABLED for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i) - ASSERT(!m_framePlanes[i].textureId); + ASSERT(!m_framePlanes[i].resourceId); + ASSERT(!m_externalTextureResource); #endif } @@ -111,10 +111,10 @@ static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) return GraphicsContext3D::INVALID_VALUE; } -void CCVideoLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context) +void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); - CCLayerImpl::willDraw(layerRenderer, context); + CCLayerImpl::willDraw(resourceProvider); // Explicitly lock and unlock the provider mutex so it can be held from // willDraw to didDraw. Since the compositor thread is in the middle of @@ -125,16 +125,17 @@ void CCVideoLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* co // lock should not cause a deadlock. m_providerMutex.lock(); - willDrawInternal(layerRenderer, context); - freeUnusedPlaneData(context); + willDrawInternal(resourceProvider); + freeUnusedPlaneData(resourceProvider); if (!m_frame) m_providerMutex.unlock(); } -void CCVideoLayerImpl::willDrawInternal(CCRenderer* layerRenderer, CCGraphicsContext* context) +void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); + ASSERT(!m_externalTextureResource); if (!m_provider) { m_frame = 0; @@ -160,20 +161,23 @@ void CCVideoLayerImpl::willDrawInternal(CCRenderer* layerRenderer, CCGraphicsCon return; } - if (!allocatePlaneData(layerRenderer, context)) { + if (!allocatePlaneData(resourceProvider)) { m_provider->putCurrentFrame(m_frame); m_frame = 0; return; } - if (!copyPlaneData(layerRenderer, context)) { + if (!copyPlaneData(resourceProvider)) { m_provider->putCurrentFrame(m_frame); m_frame = 0; return; } + + if (m_format == GraphicsContext3D::TEXTURE_2D) + m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_frame->textureId()); } -void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) { ASSERT(CCProxy::isImplThread()); @@ -203,7 +207,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta bool premultipliedAlpha = true; FloatRect uvRect(0, 0, widthScaleFactor, 1); bool flipped = false; - OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.textureId, premultipliedAlpha, uvRect, flipped); + OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); quadList.append(textureQuad.release()); break; } @@ -214,14 +218,20 @@ void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta #if defined(OS_CHROMEOS) && defined(__ARMEL__) bool flipped = true; // Under the covers, implemented by OpenMAX IL. #elif OS(WINDOWS) - bool flipped = true; // Under the covers, implemented by DXVA. + bool flipped = false; // Under the covers, implemented by DXVA. #else bool flipped = false; // LibVA (cros/intel), MacOS. #endif - OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), premultipliedAlpha, uvRect, flipped); + OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped); quadList.append(textureQuad.release()); break; } + case Extensions3D::TEXTURE_RECTANGLE_ARB: { + IntSize textureSize(m_frame->width(), m_frame->height()); + OwnPtr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQuad::Unflipped); + quadList.append(ioSurfaceQuad.release()); + break; + } case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { // StreamTexture hardware decoder. OwnPtr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); @@ -233,14 +243,24 @@ void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta } } -void CCVideoLayerImpl::didDraw() +void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); - CCLayerImpl::didDraw(); + CCLayerImpl::didDraw(resourceProvider); if (!m_frame) return; + if (m_format == GraphicsContext3D::TEXTURE_2D) { + ASSERT(m_externalTextureResource); + // FIXME: the following assert will not be true when sending resources to a + // parent compositor. We will probably need to hold on to m_frame for + // longer, and have several "current frames" in the pipeline. + ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource)); + resourceProvider->deleteResource(m_externalTextureResource); + m_externalTextureResource = 0; + } + m_provider->putCurrentFrame(m_frame); m_frame = 0; @@ -283,45 +303,27 @@ IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, return IntSize(visibleWidth, visibleHeight); } -bool CCVideoLayerImpl::FramePlane::allocateData(CCGraphicsContext* context) +bool CCVideoLayerImpl::FramePlane::allocateData(CCResourceProvider* resourceProvider) { - if (textureId) + if (resourceId) return true; - WebKit::WebGraphicsContext3D* context3D = context->context3D(); - if (!context3D) - return false; - - GLC(context3D, textureId = context3D->createTexture()); - GLC(context3D, context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - // Do basic linear filtering on resize. - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE. - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - - GLC(context3D, context3D->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); - - return textureId; + resourceId = resourceProvider->createResource(CCRenderer::ImplPool, size, format, CCResourceProvider::TextureUsageAny); + return resourceId; } -void CCVideoLayerImpl::FramePlane::freeData(CCGraphicsContext* context) +void CCVideoLayerImpl::FramePlane::freeData(CCResourceProvider* resourceProvider) { - if (!textureId) - return; - - WebKit::WebGraphicsContext3D* context3D = context->context3D(); - if (!context3D) + if (!resourceId) return; - GLC(context3D, context3D->deleteTexture(textureId)); - textureId = 0; + resourceProvider->deleteResource(resourceId); + resourceId = 0; } -bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsContext* context) +bool CCVideoLayerImpl::allocatePlaneData(CCResourceProvider* resourceProvider) { - int maxTextureSize = layerRenderer->capabilities().maxTextureSize; + int maxTextureSize = resourceProvider->maxTextureSize(); for (unsigned planeIndex = 0; planeIndex < m_frame->planes(); ++planeIndex) { CCVideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; @@ -331,13 +333,13 @@ bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsCo return false; if (plane.size != requiredTextureSize || plane.format != m_format) { - plane.freeData(context); + plane.freeData(resourceProvider); plane.size = requiredTextureSize; plane.format = m_format; } - if (!plane.textureId) { - if (!plane.allocateData(context)) + if (!plane.resourceId) { + if (!plane.allocateData(resourceProvider)) return false; plane.visibleSize = computeVisibleSize(*m_frame, planeIndex); } @@ -345,42 +347,32 @@ bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsCo return true; } -bool CCVideoLayerImpl::copyPlaneData(CCRenderer* layerRenderer, CCGraphicsContext* context) +bool CCVideoLayerImpl::copyPlaneData(CCResourceProvider* resourceProvider) { size_t softwarePlaneCount = m_frame->planes(); if (!softwarePlaneCount) return true; - WebKit::WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return false; - } - - LayerTextureSubImage uploader(true); for (size_t softwarePlaneIndex = 0; softwarePlaneIndex < softwarePlaneCount; ++softwarePlaneIndex) { CCVideoLayerImpl::FramePlane& plane = m_framePlanes[softwarePlaneIndex]; const uint8_t* softwarePlanePixels = static_cast<const uint8_t*>(m_frame->data(softwarePlaneIndex)); IntRect planeRect(IntPoint(), plane.size); - - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, plane.textureId); - uploader.setSubImageSize(plane.size); - uploader.upload(softwarePlanePixels, planeRect, planeRect, planeRect, plane.format, context); + resourceProvider->upload(plane.resourceId, softwarePlanePixels, planeRect, planeRect, planeRect); } return true; } -void CCVideoLayerImpl::freePlaneData(CCGraphicsContext* context) +void CCVideoLayerImpl::freePlaneData(CCResourceProvider* resourceProvider) { for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i) - m_framePlanes[i].freeData(context); + m_framePlanes[i].freeData(resourceProvider); } -void CCVideoLayerImpl::freeUnusedPlaneData(CCGraphicsContext* context) +void CCVideoLayerImpl::freeUnusedPlaneData(CCResourceProvider* resourceProvider) { unsigned firstUnusedPlane = m_frame ? m_frame->planes() : 0; for (unsigned i = firstUnusedPlane; i < WebKit::WebVideoFrame::maxPlanes; ++i) - m_framePlanes[i].freeData(context); + m_framePlanes[i].freeData(resourceProvider); } void CCVideoLayerImpl::didReceiveFrame() @@ -400,7 +392,7 @@ void CCVideoLayerImpl::didUpdateMatrix(const float matrix[16]) void CCVideoLayerImpl::didLoseContext() { - freePlaneData(layerTreeHostImpl()->context()); + freePlaneData(layerTreeHostImpl()->resourceProvider()); } void CCVideoLayerImpl::setNeedsRedraw() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index cd5db09bc..414ca68e3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -50,9 +50,9 @@ public: } virtual ~CCVideoLayerImpl(); - virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE; - virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; - virtual void didDraw() OVERRIDE; + virtual void willDraw(CCResourceProvider*) OVERRIDE; + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; @@ -68,15 +68,15 @@ public: void setNeedsRedraw(); struct FramePlane { - unsigned textureId; + CCResourceProvider::ResourceId resourceId; IntSize size; GC3Denum format; IntSize visibleSize; - FramePlane() : textureId(0) { } + FramePlane() : resourceId(0) { } - bool allocateData(CCGraphicsContext*); - void freeData(CCGraphicsContext*); + bool allocateData(CCResourceProvider*); + void freeData(CCResourceProvider*); }; private: @@ -85,11 +85,11 @@ private: static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane); virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; } - void willDrawInternal(CCRenderer*, CCGraphicsContext*); - bool allocatePlaneData(CCRenderer*, CCGraphicsContext*); - bool copyPlaneData(CCRenderer*, CCGraphicsContext*); - void freePlaneData(CCGraphicsContext*); - void freeUnusedPlaneData(CCGraphicsContext*); + void willDrawInternal(CCResourceProvider*); + bool allocatePlaneData(CCResourceProvider*); + bool copyPlaneData(CCResourceProvider*); + void freePlaneData(CCResourceProvider*); + void freeUnusedPlaneData(CCResourceProvider*); // Guards the destruction of m_provider and the frame that it provides Mutex m_providerMutex; @@ -99,6 +99,7 @@ private: WebKit::WebVideoFrame* m_frame; GC3Denum m_format; + CCResourceProvider::ResourceId m_externalTextureResource; // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; diff --git a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp index 2f5c96ae9..efe1a12e2 100644 --- a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp +++ b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp @@ -51,7 +51,7 @@ GraphicsContext3D::~GraphicsContext3D() { } -PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const +PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() { return m_private->platformGraphicsContext3D(); } diff --git a/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp index bd4212d0b..25b087e54 100644 --- a/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -73,12 +73,12 @@ bool FEColorMatrix::setValues(const Vector<float> &values) return true; } -inline void matrix(double& red, double& green, double& blue, double& alpha, const Vector<float>& values) +inline void matrix(float& red, float& green, float& blue, float& alpha, const Vector<float>& values) { - double r = values[0] * red + values[1] * green + values[2] * blue + values[3] * alpha + values[4] * 255; - double g = values[5] * red + values[6] * green + values[7] * blue + values[8] * alpha + values[9] * 255; - double b = values[10] * red + values[11] * green + values[12] * blue + values[13] * alpha + values[14] * 255; - double a = values[15] * red + values[16] * green + values[17] * blue + values[18] * alpha + values[19] * 255; + float r = values[0] * red + values[1] * green + values[2] * blue + values[3] * alpha + values[4] * 255; + float g = values[5] * red + values[6] * green + values[7] * blue + values[8] * alpha + values[9] * 255; + float b = values[10] * red + values[11] * green + values[12] * blue + values[13] * alpha + values[14] * 255; + float a = values[15] * red + values[16] * green + values[17] * blue + values[18] * alpha + values[19] * 255; red = r; green = g; @@ -86,28 +86,28 @@ inline void matrix(double& red, double& green, double& blue, double& alpha, cons alpha = a; } -inline void saturate(double& red, double& green, double& blue, const float& s) +inline void saturate(float& red, float& green, float& blue, const float& s) { - double r = (0.213 + 0.787 * s) * red + (0.715 - 0.715 * s) * green + (0.072 - 0.072 * s) * blue; - double g = (0.213 - 0.213 * s) * red + (0.715 + 0.285 * s) * green + (0.072 - 0.072 * s) * blue; - double b = (0.213 - 0.213 * s) * red + (0.715 - 0.715 * s) * green + (0.072 + 0.928 * s) * blue; + float r = (0.213 + 0.787 * s) * red + (0.715 - 0.715 * s) * green + (0.072 - 0.072 * s) * blue; + float g = (0.213 - 0.213 * s) * red + (0.715 + 0.285 * s) * green + (0.072 - 0.072 * s) * blue; + float b = (0.213 - 0.213 * s) * red + (0.715 - 0.715 * s) * green + (0.072 + 0.928 * s) * blue; red = r; green = g; blue = b; } -inline void huerotate(double& red, double& green, double& blue, const float& hue) +inline void huerotate(float& red, float& green, float& blue, const float& hue) { - double cosHue = cos(hue * piDouble / 180); - double sinHue = sin(hue * piDouble / 180); - double r = red * (0.213 + cosHue * 0.787 - sinHue * 0.213) + + float cosHue = cos(hue * piDouble / 180); + float sinHue = sin(hue * piDouble / 180); + float r = red * (0.213 + cosHue * 0.787 - sinHue * 0.213) + green * (0.715 - cosHue * 0.715 - sinHue * 0.715) + blue * (0.072 - cosHue * 0.072 + sinHue * 0.928); - double g = red * (0.213 - cosHue * 0.213 + sinHue * 0.143) + + float g = red * (0.213 - cosHue * 0.213 + sinHue * 0.143) + green * (0.715 + cosHue * 0.285 + sinHue * 0.140) + blue * (0.072 - cosHue * 0.072 - sinHue * 0.283); - double b = red * (0.213 - cosHue * 0.213 - sinHue * 0.787) + + float b = red * (0.213 - cosHue * 0.213 - sinHue * 0.787) + green * (0.715 - cosHue * 0.715 + sinHue * 0.715) + blue * (0.072 + cosHue * 0.928 + sinHue * 0.072); @@ -116,7 +116,7 @@ inline void huerotate(double& red, double& green, double& blue, const float& hue blue = b; } -inline void luminance(double& red, double& green, double& blue, double& alpha) +inline void luminance(float& red, float& green, float& blue, float& alpha) { alpha = 0.2125 * red + 0.7154 * green + 0.0721 * blue; red = 0; @@ -129,10 +129,10 @@ void effectType(Uint8ClampedArray* pixelArray, const Vector<float>& values) { unsigned pixelArrayLength = pixelArray->length(); for (unsigned pixelByteOffset = 0; pixelByteOffset < pixelArrayLength; pixelByteOffset += 4) { - double red = pixelArray->item(pixelByteOffset); - double green = pixelArray->item(pixelByteOffset + 1); - double blue = pixelArray->item(pixelByteOffset + 2); - double alpha = pixelArray->item(pixelByteOffset + 3); + float red = pixelArray->item(pixelByteOffset); + float green = pixelArray->item(pixelByteOffset + 1); + float blue = pixelArray->item(pixelByteOffset + 2); + float alpha = pixelArray->item(pixelByteOffset + 3); switch (filterType) { case FECOLORMATRIX_TYPE_MATRIX: diff --git a/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp b/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp index 34997f613..c1efa2ade 100644 --- a/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp +++ b/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp @@ -61,10 +61,6 @@ void FEDropShadow::determineAbsolutePaintRect() FloatRect absoluteOffsetPaintRect(absolutePaintRect); absoluteOffsetPaintRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy)); absolutePaintRect.unite(absoluteOffsetPaintRect); - if (clipsToBounds()) - absolutePaintRect.intersect(maxEffectRect()); - else - absolutePaintRect.unite(maxEffectRect()); unsigned kernelSizeX = 0; unsigned kernelSizeY = 0; @@ -73,6 +69,12 @@ void FEDropShadow::determineAbsolutePaintRect() // We take the half kernel size and multiply it with three, because we run box blur three times. absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f); absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f); + + if (clipsToBounds()) + absolutePaintRect.intersect(maxEffectRect()); + else + absolutePaintRect.unite(maxEffectRect()); + setAbsolutePaintRect(enclosingIntRect(absolutePaintRect)); } diff --git a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp index 1950ee9e3..43731f70d 100644 --- a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp +++ b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp @@ -260,19 +260,21 @@ void FEGaussianBlur::calculateKernelSize(Filter* filter, unsigned& kernelSizeX, void FEGaussianBlur::determineAbsolutePaintRect() { - FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect(); - if (clipsToBounds()) - absolutePaintRect.intersect(maxEffectRect()); - else - absolutePaintRect.unite(maxEffectRect()); - unsigned kernelSizeX = 0; unsigned kernelSizeY = 0; calculateKernelSize(filter(), kernelSizeX, kernelSizeY, m_stdX, m_stdY); + FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect(); + // We take the half kernel size and multiply it with three, because we run box blur three times. absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f); absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f); + + if (clipsToBounds()) + absolutePaintRect.intersect(maxEffectRect()); + else + absolutePaintRect.unite(maxEffectRect()); + setAbsolutePaintRect(enclosingIntRect(absolutePaintRect)); } diff --git a/Source/WebCore/platform/graphics/filters/FELighting.h b/Source/WebCore/platform/graphics/filters/FELighting.h index d0d2b3685..4487835e8 100644 --- a/Source/WebCore/platform/graphics/filters/FELighting.h +++ b/Source/WebCore/platform/graphics/filters/FELighting.h @@ -46,6 +46,9 @@ struct FELightingPaintingDataForNeon; class FELighting : public FilterEffect { public: virtual void platformApplySoftware(); +#if USE(SKIA) + virtual bool platformApplySkia(); +#endif virtual void determineAbsolutePaintRect() { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } diff --git a/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp new file mode 100644 index 000000000..1a6a2d70e --- /dev/null +++ b/Source/WebCore/platform/graphics/filters/skia/FELightingSkia.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#if USE(SKIA) +#include "FELighting.h" + +#include "DistantLightSource.h" +#include "NativeImageSkia.h" +#include "PointLightSource.h" +#include "SkLightingImageFilter.h" +#include "SpotLightSource.h" + +namespace WebCore { + +bool FELighting::platformApplySkia() +{ + // For now, only use the skia implementation for accelerated rendering. + if (filter()->renderingMode() != Accelerated) + return false; + + ImageBuffer* resultImage = createImageBufferResult(); + if (!resultImage) + return false; + + FilterEffect* in = inputEffect(0); + + IntRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect()); + + setIsAlphaImage(in->isAlphaImage()); + + RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); + NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame(); + + GraphicsContext* dstContext = resultImage->context(); + + SkPaint paint; + switch (m_lightSource->type()) { + case LS_DISTANT: { + DistantLightSource* distantLightSource = static_cast<DistantLightSource*>(m_lightSource.get()); + float azimuthRad = deg2rad(distantLightSource->azimuth()); + float elevationRad = deg2rad(distantLightSource->elevation()); + SkPoint3 direction(cosf(azimuthRad) * cosf(elevationRad), + sinf(azimuthRad) * cosf(elevationRad), + sinf(elevationRad)); + if (m_specularConstant > 0) + paint.setImageFilter(SkLightingImageFilter::CreateDistantLitSpecular(direction, m_lightingColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent))->unref(); + else + paint.setImageFilter(SkLightingImageFilter::CreateDistantLitDiffuse(direction, m_lightingColor.rgb(), m_surfaceScale, m_diffuseConstant))->unref(); + break; + } + case LS_POINT: { + PointLightSource* pointLightSource = static_cast<PointLightSource*>(m_lightSource.get()); + FloatPoint3D position = pointLightSource->position(); + SkPoint3 skPosition(position.x(), position.y(), position.z()); + if (m_specularConstant > 0) + paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(skPosition, m_lightingColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent))->unref(); + else + paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(skPosition, m_lightingColor.rgb(), m_surfaceScale, m_diffuseConstant))->unref(); + break; + } + case LS_SPOT: { + SpotLightSource* spotLightSource = static_cast<SpotLightSource*>(m_lightSource.get()); + SkPoint3 location(spotLightSource->position().x(), spotLightSource->position().y(), spotLightSource->position().z()); + SkPoint3 target(spotLightSource->direction().x(), spotLightSource->direction().y(), spotLightSource->direction().z()); + float specularExponent = spotLightSource->specularExponent(); + float limitingConeAngle = spotLightSource->limitingConeAngle(); + if (!limitingConeAngle || limitingConeAngle > 90 || limitingConeAngle < -90) + limitingConeAngle = 90; + if (m_specularConstant > 0) + paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(location, target, specularExponent, limitingConeAngle, m_lightingColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent))->unref(); + else + paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(location, target, specularExponent, limitingConeAngle, m_lightingColor.rgb(), m_surfaceScale, m_diffuseConstant))->unref(); + break; + } + default: + ASSERT_NOT_REACHED(); + return false; + } + dstContext->platformContext()->canvas()->drawBitmap(nativeImage->bitmap(), drawingRegion.location().x(), drawingRegion.location().y(), &paint); + return true; +} + +}; +#endif diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp index 456e400c0..06edd32fb 100644 --- a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp @@ -355,8 +355,8 @@ static gboolean webkitVideoSinkProposeAllocation(GstBaseSink* baseSink, GstQuery if (!gst_video_info_from_caps(&sink->priv->info, caps)) return FALSE; - gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE); - gst_query_add_allocation_meta(query, GST_VIDEO_CROP_META_API_TYPE); + gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, 0); + gst_query_add_allocation_meta(query, GST_VIDEO_CROP_META_API_TYPE, 0); return TRUE; } #endif diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index f09cb1303..83d6ee467 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -33,11 +33,6 @@ #include <wtf/StdLibExtras.h> #include <wtf/unicode/CharacterNames.h> -#if (PLATFORM(MAC) || PLATFORM(CHROMIUM)) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 -// Undefined when compiling agains the 10.5 SDK. -#define kCTVersionNumber10_6 0x00030000 -#endif - using namespace std; namespace WebCore { @@ -316,68 +311,9 @@ void ComplexTextController::collectComplexTextRuns() m_complexTextRuns.reverse(); } -#if USE(CORE_TEXT) && USE(ATSUI) -static inline bool shouldUseATSUIAPI() -{ - enum TypeRenderingAPIToUse { UnInitialized, UseATSUI, UseCoreText }; - static TypeRenderingAPIToUse apiToUse = UnInitialized; - - if (UNLIKELY(apiToUse == UnInitialized)) { - if (&CTGetCoreTextVersion != 0 && CTGetCoreTextVersion() >= kCTVersionNumber10_6) - apiToUse = UseCoreText; - else - apiToUse = UseATSUI; - } - - return apiToUse == UseATSUI; -} -#endif - CFIndex ComplexTextController::ComplexTextRun::indexAt(size_t i) const { -#if USE(CORE_TEXT) && USE(ATSUI) - return shouldUseATSUIAPI() ? m_atsuiIndices[i] : m_coreTextIndices[i]; -#elif USE(ATSUI) - return m_atsuiIndices[i]; -#elif USE(CORE_TEXT) return m_coreTextIndices[i]; -#endif -} - -void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) -{ - if (!fontData) { - // Create a run of missing glyphs from the primary font. - m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr())); - return; - } - -#if USE(CORE_TEXT) && USE(ATSUI) - if (shouldUseATSUIAPI()) - return collectComplexTextRunsForCharactersATSUI(cp, length, stringLocation, fontData); - return collectComplexTextRunsForCharactersCoreText(cp, length, stringLocation, fontData); -#elif USE(ATSUI) - return collectComplexTextRunsForCharactersATSUI(cp, length, stringLocation, fontData); -#elif USE(CORE_TEXT) - return collectComplexTextRunsForCharactersCoreText(cp, length, stringLocation, fontData); -#endif -} - -ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) - : m_fontData(fontData) - , m_characters(characters) - , m_stringLocation(stringLocation) - , m_stringLength(stringLength) - , m_indexEnd(stringLength) - , m_isMonotonic(true) -{ -#if USE(CORE_TEXT) && USE(ATSUI) - shouldUseATSUIAPI() ? createTextRunFromFontDataATSUI(ltr) : createTextRunFromFontDataCoreText(ltr); -#elif USE(ATSUI) - createTextRunFromFontDataATSUI(ltr); -#elif USE(CORE_TEXT) - createTextRunFromFontDataCoreText(ltr); -#endif } void ComplexTextController::ComplexTextRun::setIsNonMonotonic() diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.h b/Source/WebCore/platform/graphics/mac/ComplexTextController.h index 356135fcf..7c00dcbb4 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.h +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.h @@ -35,16 +35,8 @@ typedef unsigned short CGGlyph; -#if USE(CORE_TEXT) typedef const struct __CTRun * CTRunRef; typedef const struct __CTLine * CTLineRef; -#endif -#if USE(ATSUI) -typedef struct OpaqueATSUTextLayout* ATSUTextLayout; -typedef struct ATSGlyphVector* ATSULineRef; -typedef UInt32 ATSULayoutOperationSelector; -typedef UInt32 ATSULayoutOperationCallbackStatus; -#endif namespace WebCore { @@ -54,9 +46,6 @@ class TextRun; // ComplexTextController is responsible for rendering and measuring glyphs for // complex scripts on OS X. -// The underlying API can be selected at compile time based on USE(ATSUI) and -// USE(CORE_TEXT). If both are defined then the Core Text APIs are used for -// OS Versions >= 10.6, ATSUI is used otherwise. class ComplexTextController { public: ComplexTextController(const Font*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool forTextEmphasis = false); @@ -84,18 +73,11 @@ private: class ComplexTextRun : public RefCounted<ComplexTextRun> { public: -#if USE(CORE_TEXT) static PassRefPtr<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) { return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange)); } -#endif -#if USE(ATSUI) - static PassRefPtr<ComplexTextRun> create(ATSUTextLayout atsuTextLayout, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride) - { - return adoptRef(new ComplexTextRun(atsuTextLayout, fontData, characters, stringLocation, stringLength, ltr, directionalOverride)); - } -#endif + static PassRefPtr<ComplexTextRun> create(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) { return adoptRef(new ComplexTextRun(fontData, characters, stringLocation, stringLength, ltr)); @@ -115,51 +97,28 @@ private: void setIsNonMonotonic(); private: -#if USE(CORE_TEXT) ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange); - void createTextRunFromFontDataCoreText(bool ltr); -#endif -#if USE(ATSUI) - ComplexTextRun(ATSUTextLayout, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride); - void createTextRunFromFontDataATSUI(bool ltr); -#endif ComplexTextRun(const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr); -#if USE(ATSUI) - static OSStatus overrideLayoutOperation(ATSULayoutOperationSelector, ATSULineRef, URefCon, void*, ATSULayoutOperationCallbackStatus*); -#endif - unsigned m_glyphCount; const SimpleFontData* m_fontData; const UChar* m_characters; unsigned m_stringLocation; size_t m_stringLength; -#if USE(CORE_TEXT) Vector<CFIndex, 64> m_coreTextIndicesVector; const CFIndex* m_coreTextIndices; -#endif -#if USE(ATSUI) - Vector<CFIndex, 64> m_atsuiIndices; -#endif CFIndex m_indexEnd; Vector<CFIndex, 64> m_glyphEndOffsets; Vector<CGGlyph, 64> m_glyphsVector; const CGGlyph* m_glyphs; Vector<CGSize, 64> m_advancesVector; const CGSize* m_advances; -#if USE(ATSUI) - bool m_directionalOverride; -#endif bool m_isMonotonic; }; void collectComplexTextRuns(); - // collectComplexTextRunsForCharacters() is a stub function that calls through to the ATSUI or Core Text variants based - // on the API in use. void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*); - void collectComplexTextRunsForCharactersATSUI(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*); - void collectComplexTextRunsForCharactersCoreText(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*); void adjustGlyphsAndAdvances(); const Font& m_font; @@ -169,10 +128,8 @@ private: Vector<UChar, 256> m_smallCapsBuffer; -#if USE(CORE_TEXT) // Retain lines rather than their runs for better performance. Vector<RetainPtr<CTLineRef> > m_coreTextLines; -#endif Vector<RefPtr<ComplexTextRun>, 16> m_complexTextRuns; Vector<CGSize, 256> m_adjustedAdvances; Vector<CGGlyph, 256> m_adjustedGlyphs; diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp deleted file mode 100644 index be9f74104..000000000 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "ComplexTextController.h" - -#if USE(ATSUI) - -#include "Font.h" -#include "ShapeArabic.h" -#include "TextRun.h" -#include <ApplicationServices/ApplicationServices.h> -#include <wtf/unicode/CharacterNames.h> - -#ifdef __LP64__ -// ATSUTextInserted() is SPI in 64-bit. -extern "C" { -OSStatus ATSUTextInserted(ATSUTextLayout iTextLayout, UniCharArrayOffset iInsertionLocation, UniCharCount iInsertionLength); -} -#endif - -using namespace WTF::Unicode; - -namespace WebCore { - -OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayoutOperationSelector, ATSULineRef atsuLineRef, URefCon refCon, void*, ATSULayoutOperationCallbackStatus* callbackStatus) -{ - ComplexTextRun* complexTextRun = reinterpret_cast<ComplexTextRun*>(refCon); - OSStatus status; - ItemCount count; - ATSLayoutRecord* layoutRecords; - - status = ATSUDirectGetLayoutDataArrayPtrFromLineRef(atsuLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, true, reinterpret_cast<void**>(&layoutRecords), &count); - if (status != noErr) { - *callbackStatus = kATSULayoutOperationCallbackStatusContinue; - return status; - } - - count--; - ItemCount j = 0; - CFIndex indexOffset = 0; - - if (complexTextRun->m_directionalOverride) { - j++; - count -= 2; - indexOffset = -1; - } - - complexTextRun->m_glyphCount = count; - complexTextRun->m_glyphsVector.reserveCapacity(count); - complexTextRun->m_advancesVector.reserveCapacity(count); - complexTextRun->m_atsuiIndices.reserveCapacity(count); - - bool atBeginning = true; - CGFloat lastX = 0; - - for (ItemCount i = 0; i < count; ++i, ++j) { - if (layoutRecords[j].glyphID == kATSDeletedGlyphcode) { - complexTextRun->m_glyphCount--; - continue; - } - complexTextRun->m_glyphsVector.uncheckedAppend(layoutRecords[j].glyphID); - complexTextRun->m_atsuiIndices.uncheckedAppend(layoutRecords[j].originalOffset / 2 + indexOffset); - CGFloat x = FixedToFloat(layoutRecords[j].realPos); - if (!atBeginning) - complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(x - lastX, 0)); - lastX = x; - atBeginning = false; - } - - complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(FixedToFloat(layoutRecords[j].realPos) - lastX, 0)); - - complexTextRun->m_glyphs = complexTextRun->m_glyphsVector.data(); - complexTextRun->m_advances = complexTextRun->m_advancesVector.data(); - - status = ATSUDirectReleaseLayoutDataArrayPtr(atsuLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, reinterpret_cast<void**>(&layoutRecords)); - *callbackStatus = kATSULayoutOperationCallbackStatusContinue; - return noErr; -} - -static inline bool isArabicLamWithAlefLigature(UChar c) -{ - return c >= 0xfef5 && c <= 0xfefc; -} - -static void shapeArabic(const UChar* source, UChar* dest, unsigned totalLength) -{ - unsigned shapingStart = 0; - while (shapingStart < totalLength) { - unsigned shapingEnd; - // We do not want to pass a Lam with Alef ligature followed by a space to the shaper, - // since we want to be able to identify this sequence as the result of shaping a Lam - // followed by an Alef and padding with a space. - bool foundLigatureSpace = false; - for (shapingEnd = shapingStart; !foundLigatureSpace && shapingEnd < totalLength - 1; ++shapingEnd) - foundLigatureSpace = isArabicLamWithAlefLigature(source[shapingEnd]) && source[shapingEnd + 1] == ' '; - shapingEnd++; - - UErrorCode shapingError = U_ZERO_ERROR; - unsigned charsWritten = shapeArabic(source + shapingStart, shapingEnd - shapingStart, dest + shapingStart, shapingEnd - shapingStart, U_SHAPE_LETTERS_SHAPE | U_SHAPE_LENGTH_FIXED_SPACES_NEAR, &shapingError); - - if (U_SUCCESS(shapingError) && charsWritten == shapingEnd - shapingStart) { - for (unsigned j = shapingStart; j < shapingEnd - 1; ++j) { - if (isArabicLamWithAlefLigature(dest[j]) && dest[j + 1] == ' ') - dest[++j] = zeroWidthSpace; - } - if (foundLigatureSpace) { - dest[shapingEnd] = ' '; - shapingEnd++; - } else if (isArabicLamWithAlefLigature(dest[shapingEnd - 1])) { - // u_shapeArabic quirk: if the last two characters in the source string are a Lam and an Alef, - // the space is put at the beginning of the string, despite U_SHAPE_LENGTH_FIXED_SPACES_NEAR. - ASSERT(dest[shapingStart] == ' '); - dest[shapingStart] = zeroWidthSpace; - } - } else { - // Something went wrong. Abandon shaping and just copy the rest of the buffer. - LOG_ERROR("u_shapeArabic failed(%d)", shapingError); - shapingEnd = totalLength; - memcpy(dest + shapingStart, source + shapingStart, (shapingEnd - shapingStart) * sizeof(UChar)); - } - shapingStart = shapingEnd; - } -} - -ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLayout, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride) - : m_fontData(fontData) - , m_characters(characters) - , m_stringLocation(stringLocation) - , m_stringLength(stringLength) - , m_indexEnd(stringLength) - , m_directionalOverride(directionalOverride) - , m_isMonotonic(true) -{ - OSStatus status; - - status = ATSUSetTextLayoutRefCon(atsuTextLayout, reinterpret_cast<URefCon>(this)); - - ATSLineLayoutOptions lineLayoutOptions = kATSLineKeepSpacesOutOfMargin | kATSLineHasNoHangers; - - Boolean rtl = !ltr; - - Vector<UChar, 256> substituteCharacters; - bool shouldCheckForMirroring = !ltr && !fontData->m_ATSUMirrors; - bool shouldCheckForArabic = !fontData->shapesArabic(); - bool shouldShapeArabic = false; - - bool mirrored = false; - for (size_t i = 0; i < stringLength; ++i) { - if (shouldCheckForMirroring) { - UChar mirroredChar = u_charMirror(characters[i]); - if (mirroredChar != characters[i]) { - if (!mirrored) { - mirrored = true; - substituteCharacters.grow(stringLength); - memcpy(substituteCharacters.data(), characters, stringLength * sizeof(UChar)); - ATSUTextMoved(atsuTextLayout, substituteCharacters.data()); - } - substituteCharacters[i] = mirroredChar; - } - } - if (shouldCheckForArabic && isArabicChar(characters[i])) { - shouldCheckForArabic = false; - shouldShapeArabic = true; - } - } - - if (shouldShapeArabic) { - Vector<UChar, 256> shapedArabic(stringLength); - shapeArabic(substituteCharacters.isEmpty() ? characters : substituteCharacters.data(), shapedArabic.data(), stringLength); - substituteCharacters.swap(shapedArabic); - ATSUTextMoved(atsuTextLayout, substituteCharacters.data()); - } - - if (directionalOverride) { - UChar override = ltr ? leftToRightOverride : rightToLeftOverride; - if (substituteCharacters.isEmpty()) { - substituteCharacters.grow(stringLength + 2); - substituteCharacters[0] = override; - memcpy(substituteCharacters.data() + 1, characters, stringLength * sizeof(UChar)); - substituteCharacters[stringLength + 1] = popDirectionalFormatting; - ATSUTextMoved(atsuTextLayout, substituteCharacters.data()); - } else { - substituteCharacters.prepend(override); - substituteCharacters.append(popDirectionalFormatting); - } - ATSUTextInserted(atsuTextLayout, 0, 2); - } - - ATSULayoutOperationOverrideSpecifier overrideSpecifier; - overrideSpecifier.operationSelector = kATSULayoutOperationPostLayoutAdjustment; - overrideSpecifier.overrideUPP = overrideLayoutOperation; - - ATSUAttributeTag tags[] = { kATSULineLayoutOptionsTag, kATSULineDirectionTag, kATSULayoutOperationOverrideTag }; - ByteCount sizes[] = { sizeof(ATSLineLayoutOptions), sizeof(Boolean), sizeof(ATSULayoutOperationOverrideSpecifier) }; - ATSUAttributeValuePtr values[] = { &lineLayoutOptions, &rtl, &overrideSpecifier }; - - status = ATSUSetLayoutControls(atsuTextLayout, 3, tags, sizes, values); - - ItemCount boundsCount; - status = ATSUGetGlyphBounds(atsuTextLayout, 0, 0, 0, m_stringLength, kATSUseFractionalOrigins, 0, 0, &boundsCount); - - status = ATSUDisposeTextLayout(atsuTextLayout); -} - -void ComplexTextController::ComplexTextRun::createTextRunFromFontDataATSUI(bool ltr) -{ - m_atsuiIndices.reserveCapacity(m_stringLength); - unsigned r = 0; - while (r < m_stringLength) { - m_atsuiIndices.uncheckedAppend(r); - if (U_IS_SURROGATE(m_characters[r])) { - ASSERT(r + 1 < m_stringLength); - ASSERT(U_IS_SURROGATE_LEAD(m_characters[r])); - ASSERT(U_IS_TRAIL(m_characters[r + 1])); - r += 2; - } else - r++; - } - m_glyphCount = m_atsuiIndices.size(); - if (!ltr) { - for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end) - std::swap(m_atsuiIndices[r], m_atsuiIndices[end]); - } - - m_glyphsVector.fill(0, m_glyphCount); - m_glyphs = m_glyphsVector.data(); - m_advancesVector.fill(CGSizeMake(m_fontData->widthForGlyph(0), 0), m_glyphCount); - m_advances = m_advancesVector.data(); -} - -static bool fontHasMirroringInfo(ATSUFontID fontID) -{ - ByteCount propTableSize; - OSStatus status = ATSFontGetTable(fontID, 'prop', 0, 0, 0, &propTableSize); - if (status == noErr) // naively assume that if a 'prop' table exists then it contains mirroring info - return true; - else if (status != kATSInvalidFontTableAccess) // anything other than a missing table is logged as an error - LOG_ERROR("ATSFontGetTable failed (%d)", static_cast<int>(status)); - - return false; -} - -static void disableLigatures(const SimpleFontData* fontData, ATSUStyle atsuStyle, TypesettingFeatures typesettingFeatures) -{ - // Don't be too aggressive: if the font doesn't contain 'a', then assume that any ligatures it contains are - // in characters that always go through ATSUI, and therefore allow them. Geeza Pro is an example. - // See bugzilla 5166. - if ((typesettingFeatures & Ligatures) || (fontData->platformData().orientation() == Horizontal && fontData->platformData().allowsLigatures())) - return; - - ATSUFontFeatureType featureTypes[] = { kLigaturesType }; - ATSUFontFeatureSelector featureSelectors[] = { kCommonLigaturesOffSelector }; - OSStatus status = ATSUSetFontFeatures(atsuStyle, 1, featureTypes, featureSelectors); - if (status != noErr) - LOG_ERROR("ATSUSetFontFeatures failed (%d) -- ligatures remain enabled", static_cast<int>(status)); -} - -static ATSUStyle initializeATSUStyle(const SimpleFontData* fontData, TypesettingFeatures typesettingFeatures) -{ - unsigned key = typesettingFeatures + 1; - HashMap<unsigned, ATSUStyle>::AddResult addResult = fontData->m_ATSUStyleMap.add(key, 0); - ATSUStyle& atsuStyle = addResult.iterator->second; - if (!addResult.isNewEntry) - return atsuStyle; - - ATSUFontID fontID = fontData->platformData().ctFont() ? CTFontGetPlatformFont(fontData->platformData().ctFont(), 0) : 0; - if (!fontID) { - LOG_ERROR("unable to get ATSUFontID for %p", fontData->platformData().font()); - fontData->m_ATSUStyleMap.remove(addResult.isNewEntry); - return 0; - } - - OSStatus status = ATSUCreateStyle(&atsuStyle); - if (status != noErr) - LOG_ERROR("ATSUCreateStyle failed (%d)", static_cast<int>(status)); - - Fixed fontSize = FloatToFixed(fontData->platformData().m_size); - Fract kerningInhibitFactor = FloatToFract(1); - static CGAffineTransform verticalFlip = CGAffineTransformMakeScale(1, -1); - - ByteCount styleSizes[4] = { sizeof(fontSize), sizeof(fontID), sizeof(verticalFlip), sizeof(kerningInhibitFactor) }; - ATSUAttributeTag styleTags[4] = { kATSUSizeTag, kATSUFontTag, kATSUFontMatrixTag, kATSUKerningInhibitFactorTag }; - ATSUAttributeValuePtr styleValues[4] = { &fontSize, &fontID, &verticalFlip, &kerningInhibitFactor }; - - bool allowKerning = typesettingFeatures & Kerning; - status = ATSUSetAttributes(atsuStyle, allowKerning ? 3 : 4, styleTags, styleSizes, styleValues); - if (status != noErr) - LOG_ERROR("ATSUSetAttributes failed (%d)", static_cast<int>(status)); - - fontData->m_ATSUMirrors = fontHasMirroringInfo(fontID); - - disableLigatures(fontData, atsuStyle, typesettingFeatures); - return atsuStyle; -} - -void ComplexTextController::collectComplexTextRunsForCharactersATSUI(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) -{ - ASSERT_ARG(fontData, fontData); - - if (fontData == systemFallbackFontData()) - fontData = m_font.primaryFont(); - - if (m_fallbackFonts && fontData != m_font.primaryFont()) - m_fallbackFonts->add(fontData); - - ATSUStyle atsuStyle = initializeATSUStyle(fontData, m_font.typesettingFeatures()); - - OSStatus status; - ATSUTextLayout atsuTextLayout; - UniCharCount runLength = length; - - status = ATSUCreateTextLayoutWithTextPtr(cp, 0, length, length, 1, &runLength, &atsuStyle, &atsuTextLayout); - if (status != noErr) { - LOG_ERROR("ATSUCreateTextLayoutWithTextPtr failed with error %d", static_cast<int>(status)); - return; - } - m_complexTextRuns.append(ComplexTextRun::create(atsuTextLayout, fontData, cp, stringLocation, length, m_run.ltr(), m_run.directionalOverride())); -} - -} // namespace WebCore - -#endif // USE(ATSUI) diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm index 83173db61..a993b7772 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm +++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm @@ -24,8 +24,6 @@ #include "config.h" -#if USE(CORE_TEXT) - #include "ComplexTextController.h" #include "Font.h" @@ -135,7 +133,13 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path. -void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bool ltr) +ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) + : m_fontData(fontData) + , m_characters(characters) + , m_stringLocation(stringLocation) + , m_stringLength(stringLength) + , m_indexEnd(stringLength) + , m_isMonotonic(true) { m_coreTextIndicesVector.reserveInitialCapacity(m_stringLength); unsigned r = 0; @@ -180,9 +184,13 @@ static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* c return info->cp + stringIndex; } -void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) +void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) { - ASSERT_ARG(fontData, fontData); + if (!fontData) { + // Create a run of missing glyphs from the primary font. + m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr())); + return; + } bool isSystemFallback = false; @@ -295,5 +303,3 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC } } // namespace WebCore - -#endif // USE(CORE_TEXT) diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm deleted file mode 100644 index 4b2e7b211..000000000 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 Alexey Proskuryakov - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "config.h" -#import "SimpleFontData.h" - -#if USE(ATSUI) - -#import "Font.h" -#import "FontCache.h" -#import "FontDescription.h" -#import <ApplicationServices/ApplicationServices.h> -#import <AppKit/AppKit.h> -#import <wtf/Assertions.h> - -using namespace std; - -namespace WebCore { - -void SimpleFontData::checkShapesArabic() const -{ - ASSERT(!m_checkedShapesArabic); - - m_checkedShapesArabic = true; - - ATSUFontID fontID = m_platformData.ctFont() ? CTFontGetPlatformFont(m_platformData.ctFont(), 0) : 0; - if (!fontID) { - LOG_ERROR("unable to get ATSUFontID for %@", m_platformData.font()); - return; - } - - // This function is called only on fonts that contain Arabic glyphs. Our - // heuristic is that if such a font has a glyph metamorphosis table, then - // it includes shaping information for Arabic. - FourCharCode tables[] = { 'morx', 'mort' }; - for (size_t i = 0; i < WTF_ARRAY_LENGTH(tables); ++i) { - ByteCount tableSize; - OSStatus status = ATSFontGetTable(fontID, tables[i], 0, 0, 0, &tableSize); - if (status == noErr) { - m_shapesArabic = true; - return; - } - - if (status != kATSInvalidFontTableAccess) - LOG_ERROR("ATSFontGetTable failed (%d)", status); - } -} - -} // namespace WebCore - -#endif diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index 487591a74..587b9dd81 100644 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -142,12 +142,6 @@ const SimpleFontData* SimpleFontData::getCompositeFontReferenceFontData(NSFont * void SimpleFontData::platformInit() { -#if USE(ATSUI) - m_ATSUMirrors = false; - m_checkedShapesArabic = false; - m_shapesArabic = false; -#endif - m_syntheticBoldOffset = m_platformData.m_syntheticBold ? 1.0f : 0.f; bool failedSetup = false; @@ -319,12 +313,6 @@ void SimpleFontData::platformDestroy() if (m_derivedFontData->emphasisMark) fontCache()->releaseFontData(m_derivedFontData->emphasisMark.leakPtr()); } - -#if USE(ATSUI) - HashMap<unsigned, ATSUStyle>::iterator end = m_ATSUStyleMap.end(); - for (HashMap<unsigned, ATSUStyle>::iterator it = m_ATSUStyleMap.begin(); it != end; ++it) - ATSUDisposeStyle(it->second); -#endif } PassOwnPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const diff --git a/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp index 74c94f3d4..b7dfc2fbe 100644 --- a/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp +++ b/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp @@ -96,6 +96,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + m_data->drawRect(rect); } diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 1136fb8d1..895f76688 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -29,6 +29,7 @@ #include "HostWindow.h" #include "ImageBuffer.h" #include "ImageData.h" +#include "NativeImageQt.h" #include "NotImplemented.h" #include "OpenGLShims.h" #include "QWebPageClient.h" @@ -468,7 +469,7 @@ bool GraphicsContext3D::makeContextCurrent() void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, QPainter* context) { - QImage image(imagePixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied); + QImage image(imagePixels, imageWidth, imageHeight, NativeImageQt::defaultFormatForAlphaEnabledImages()); context->save(); context->translate(0, imageHeight); context->scale(1, -1); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 611efc6a2..6a3effacb 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -211,11 +211,7 @@ public: QRectF clipBoundingRect() const { -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) return p()->clipBoundingRect(); -#else - return p()->clipRegion().boundingRect(); -#endif } void takeOwnershipOfPlatformContext() { platformContextIsOwned = true; } @@ -327,6 +323,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); diff --git a/Source/WebCore/platform/graphics/qt/PathQt.cpp b/Source/WebCore/platform/graphics/qt/PathQt.cpp index 3b0ca1b62..2eaaff8f4 100644 --- a/Source/WebCore/platform/graphics/qt/PathQt.cpp +++ b/Source/WebCore/platform/graphics/qt/PathQt.cpp @@ -35,6 +35,7 @@ #include "FloatRect.h" #include "GraphicsContext.h" #include "ImageBuffer.h" +#include "NativeImageQt.h" #include "PlatformString.h" #include "StrokeStyleApplier.h" #include <QPainterPath> @@ -118,7 +119,7 @@ bool Path::contains(const FloatPoint& point, WindRule rule) const static GraphicsContext* scratchContext() { - static QImage image(1, 1, QImage::Format_ARGB32_Premultiplied); + static QImage image(1, 1, NativeImageQt::defaultFormatForAlphaEnabledImages()); static QPainter painter(&image); static GraphicsContext* context = new GraphicsContext(&painter); return context; diff --git a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h index f5203ec8a..f0d1192a3 100644 --- a/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h +++ b/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h @@ -49,7 +49,7 @@ public: // Creates a new Image from the given SkBitmap. If "copyPixels" is true, a // deep copy is done. Otherwise, a shallow copy is done (pixel data is // ref'ed). - static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&, bool copyPixels); + static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&, bool copyPixels, float resolutionScale = 1); virtual bool isBitmapImage() const; @@ -76,7 +76,7 @@ private: NativeImageSkia m_nativeImage; // Creates a new Image from the given SkBitmap, using a shallow copy. - explicit BitmapImageSingleFrameSkia(const SkBitmap&); + BitmapImageSingleFrameSkia(const SkBitmap&, float resolutionScale); }; FloatRect normalizeRect(const FloatRect&); diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index a15757172..26aba108a 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -658,6 +658,10 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + if (rect.isEmpty()) + return; + platformContext()->drawRect(rect); } diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index b5490c656..860ff1b78 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -108,11 +108,11 @@ static SkCanvas* createNonPlatformCanvas(const IntSize& size) return canvas; } -ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode renderingMode, DeferralMode deferralMode, bool& success) +ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace, RenderingMode renderingMode, DeferralMode deferralMode, bool& success) : m_data(size) , m_size(size) , m_logicalSize(size) - , m_resolutionScale(1) + , m_resolutionScale(resolutionScale) { OwnPtr<SkCanvas> canvas; @@ -133,6 +133,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, Color m_data.m_platformContext.setCanvas(m_data.m_canvas.get()); m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext)); m_context->platformContext()->setDrawingToImageBuffer(true); + m_context->scale(FloatSize(m_resolutionScale, m_resolutionScale)); // Make the background transparent. It would be nice if this wasn't // required, but the canvas is currently filled with the magic transparency @@ -160,7 +161,7 @@ GraphicsContext* ImageBuffer::context() const PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior) const { - return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore); + return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore, m_resolutionScale); } PlatformLayer* ImageBuffer::platformLayer() const diff --git a/Source/WebCore/platform/graphics/skia/ImageSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageSkia.cpp index 6a4bcb0a3..929879dcf 100644 --- a/Source/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -70,18 +70,8 @@ enum ResamplingMode { RESAMPLE_AWESOME, }; -static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext, const NativeImageSkia& bitmap, int srcWidth, int srcHeight, float destWidth, float destHeight) +static ResamplingMode computeResamplingMode(const SkMatrix& matrix, const NativeImageSkia& bitmap, int srcWidth, int srcHeight, float destWidth, float destHeight) { - if (platformContext->hasImageResamplingHint()) { - IntSize srcSize; - FloatSize dstSize; - platformContext->getImageResamplingHint(&srcSize, &dstSize); - srcWidth = srcSize.width(); - srcHeight = srcSize.height(); - destWidth = dstSize.width(); - destHeight = dstSize.height(); - } - int destIWidth = static_cast<int>(destWidth); int destIHeight = static_cast<int>(destHeight); @@ -147,7 +137,7 @@ static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext // Everything else gets resampled. // High quality interpolation only enabled for scaling and translation. - if (!(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) + if (!(matrix.getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) return RESAMPLE_AWESOME; return RESAMPLE_LINEAR; @@ -259,7 +249,7 @@ static void paintSkBitmap(PlatformContextSkia* platformContext, const NativeImag if (!(canvas->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask))) canvas->getTotalMatrix().mapRect(&destRectTarget, destRect); - resampling = computeResamplingMode(platformContext, bitmap, srcRect.width(), srcRect.height(), + resampling = computeResamplingMode(canvas->getTotalMatrix(), bitmap, srcRect.width(), srcRect.height(), SkScalarToFloat(destRectTarget.width()), SkScalarToFloat(destRectTarget.height())); } @@ -353,12 +343,15 @@ void Image::drawPattern(GraphicsContext* context, return; SkIRect srcRect = enclosingIntRect(normSrcRect); + SkMatrix ctm = context->platformContext()->canvas()->getTotalMatrix(); + SkMatrix totalMatrix; + totalMatrix.setConcat(ctm, patternTransform); // Figure out what size the bitmap will be in the destination. The // destination rect is the bounds of the pattern, we need to use the // matrix to see how big it will be. float destBitmapWidth, destBitmapHeight; - TransformDimensions(patternTransform, srcRect.width(), srcRect.height(), + TransformDimensions(totalMatrix, srcRect.width(), srcRect.height(), &destBitmapWidth, &destBitmapHeight); // Compute the resampling mode. @@ -366,7 +359,7 @@ void Image::drawPattern(GraphicsContext* context, if (context->platformContext()->isAccelerated() || context->platformContext()->printing()) resampling = RESAMPLE_LINEAR; else - resampling = computeResamplingMode(context->platformContext(), *bitmap, srcRect.width(), srcRect.height(), destBitmapWidth, destBitmapHeight); + resampling = computeResamplingMode(totalMatrix, *bitmap, srcRect.width(), srcRect.height(), destBitmapWidth, destBitmapHeight); resampling = limitResamplingMode(context->platformContext(), resampling); // Load the transform WebKit requested. @@ -380,10 +373,14 @@ void Image::drawPattern(GraphicsContext* context, SkBitmap resampled = bitmap->resizedBitmap(srcRect, width, height); shader = SkShader::CreateBitmapShader(resampled, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); - // Since we just resized the bitmap, we need to undo the scale set in - // the image transform. - matrix.setScaleX(SkIntToScalar(1)); - matrix.setScaleY(SkIntToScalar(1)); + // Since we just resized the bitmap, we need to remove the scale + // applied to the pixels in the bitmap shader. This means we need + // CTM * patternTransform to have identity scale. Since we + // can't modify CTM (or the rectangle will be drawn in the wrong + // place), we must set patternTransform's scale to the inverse of + // CTM scale. + matrix.setScaleX(ctm.getScaleX() ? 1 / ctm.getScaleX() : 1); + matrix.setScaleY(ctm.getScaleY() ? 1 / ctm.getScaleY() : 1); } else { // No need to do nice resampling. SkBitmap srcSubset; @@ -496,20 +493,20 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt, observer->didDraw(this); } -BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap) - : m_nativeImage(bitmap) +BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia(const SkBitmap& bitmap, float resolutionScale) + : m_nativeImage(bitmap, resolutionScale) { } -PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap, bool copyPixels) +PassRefPtr<BitmapImageSingleFrameSkia> BitmapImageSingleFrameSkia::create(const SkBitmap& bitmap, bool copyPixels, float resolutionScale) { if (copyPixels) { SkBitmap temp; if (!bitmap.deepCopyTo(&temp, bitmap.config())) bitmap.copyTo(&temp, bitmap.config()); - return adoptRef(new BitmapImageSingleFrameSkia(temp)); + return adoptRef(new BitmapImageSingleFrameSkia(temp, resolutionScale)); } - return adoptRef(new BitmapImageSingleFrameSkia(bitmap)); + return adoptRef(new BitmapImageSingleFrameSkia(bitmap, resolutionScale)); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp b/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp index 425f56578..7cc23c4f4 100644 --- a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp @@ -43,12 +43,14 @@ namespace WebCore { NativeImageSkia::NativeImageSkia() - : m_resizeRequests(0) + : m_resolutionScale(1), + m_resizeRequests(0) { } -NativeImageSkia::NativeImageSkia(const SkBitmap& other) +NativeImageSkia::NativeImageSkia(const SkBitmap& other, float resolutionScale) : m_image(other), + m_resolutionScale(resolutionScale), m_resizeRequests(0) { } diff --git a/Source/WebCore/platform/graphics/skia/NativeImageSkia.h b/Source/WebCore/platform/graphics/skia/NativeImageSkia.h index ccfd0aa0c..2a52e68ee 100644 --- a/Source/WebCore/platform/graphics/skia/NativeImageSkia.h +++ b/Source/WebCore/platform/graphics/skia/NativeImageSkia.h @@ -48,7 +48,7 @@ public: // This constructor does a shallow copy of the passed-in SkBitmap (ie., it // references the same pixel data and bumps the refcount). Use only when // you want sharing semantics. - explicit NativeImageSkia(const SkBitmap&); + NativeImageSkia(const SkBitmap&, float resolutionScale); // Returns the number of bytes of image data. This includes the cached // resized version if there is one. @@ -67,6 +67,8 @@ public: const SkBitmap& bitmap() const { return m_image; } SkBitmap& bitmap() { return m_image; } + float resolutionScale() const { return m_resolutionScale; } + // We can keep a resized version of the bitmap cached on this object. // This function will return true if there is a cached version of the // given image subset with the given dimensions and subsets. @@ -123,6 +125,7 @@ private: // The original image. SkBitmap m_image; + float m_resolutionScale; // The cached bitmap. This will be empty() if there is no cached image. mutable SkBitmap m_resizedImage; diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 74a4f38cf..4784c3789 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -217,8 +217,6 @@ bool PlatformContextSkia::isDrawingToImageBuffer() const void PlatformContextSkia::save() { - ASSERT(!hasImageResamplingHint()); - m_stateStack.append(m_state->cloneInheritedProperties()); m_state = &m_stateStack.last(); @@ -606,29 +604,6 @@ bool PlatformContextSkia::isNativeFontRenderingAllowed() #endif } -void PlatformContextSkia::getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const -{ - *srcSize = m_imageResamplingHintSrcSize; - *dstSize = m_imageResamplingHintDstSize; -} - -void PlatformContextSkia::setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize) -{ - m_imageResamplingHintSrcSize = srcSize; - m_imageResamplingHintDstSize = dstSize; -} - -void PlatformContextSkia::clearImageResamplingHint() -{ - m_imageResamplingHintSrcSize = IntSize(); - m_imageResamplingHintDstSize = FloatSize(); -} - -bool PlatformContextSkia::hasImageResamplingHint() const -{ - return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty(); -} - void PlatformContextSkia::applyClipFromImage(const SkRect& rect, const SkBitmap& imageBuffer) { // NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h index b9fcb7b42..9da1fbaaf 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -178,11 +178,6 @@ public: // if USE(SKIA_TEXT) is enabled, this always returns false bool isNativeFontRenderingAllowed(); - void getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const; - void setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize); - void clearImageResamplingHint(); - bool hasImageResamplingHint() const; - bool isAccelerated() const { return m_accelerated; } void setAccelerated(bool accelerated) { m_accelerated = accelerated; } @@ -235,10 +230,6 @@ private: OpaqueRegionSkia m_opaqueRegion; bool m_trackOpaqueRegion; - // Stores image sizes for a hint to compute image resampling modes. - // Values are used in ImageSkia.cpp - IntSize m_imageResamplingHintSrcSize; - FloatSize m_imageResamplingHintDstSize; bool m_printing; bool m_accelerated; bool m_deferred; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp index cca2e27ec..688e26f4e 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp @@ -38,6 +38,7 @@ #endif #if PLATFORM(QT) +#include "NativeImageQt.h" #if HAVE(QT5) #include <QOpenGLContext> #else @@ -377,7 +378,7 @@ void TextureMapperGL::drawRepaintCounter(int value, int pointSize, const FloatPo IntRect sourceRect(IntPoint::zero(), size); IntRect targetRect(roundedIntPoint(targetPoint), size); - QImage image(size, QImage::Format_ARGB32_Premultiplied); + QImage image(size, NativeImageQt::defaultFormatForAlphaEnabledImages()); QPainter painter(&image); painter.fillRect(sourceRect, Qt::blue); // Since we won't swap R+B for speed, this will paint red. painter.setFont(font); diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp index d5019e6a6..9b0c9a56f 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp @@ -21,6 +21,10 @@ #include "TextureMapperImageBuffer.h" #include "FilterEffectRenderer.h" +#if PLATFORM(QT) +#include "NativeImageQt.h" +#endif + #if USE(TEXTURE_MAPPER) namespace WebCore { @@ -28,7 +32,7 @@ namespace WebCore { void BitmapTextureImageBuffer::updateContents(const void* data, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine) { #if PLATFORM(QT) - QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), bytesPerLine, QImage::Format_ARGB32_Premultiplied); + QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), bytesPerLine, NativeImageQt::defaultFormatForAlphaEnabledImages()); QPainter* painter = m_image->context()->platformContext(); painter->save(); diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp index cdd495201..cf88009be 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp @@ -108,7 +108,9 @@ void TextureMapperLayer::updateBackingStore(TextureMapper* textureMapper, Graphi return; } - IntRect dirtyRect = enclosingIntRect(m_state.needsDisplay ? layerRect() : m_state.needsDisplayRect); + IntRect dirtyRect = enclosingIntRect(layerRect()); + if (!m_state.needsDisplay) + dirtyRect.intersect(enclosingIntRect(m_state.needsDisplayRect)); if (dirtyRect.isEmpty()) return; diff --git a/Source/WebCore/platform/graphics/win/FontCacheWin.cpp b/Source/WebCore/platform/graphics/win/FontCacheWin.cpp index 4d1b2cfd3..f54897a9b 100644 --- a/Source/WebCore/platform/graphics/win/FontCacheWin.cpp +++ b/Source/WebCore/platform/graphics/win/FontCacheWin.cpp @@ -331,7 +331,7 @@ SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& font }; SimpleFontData* simpleFont; for (size_t i = 0; i < WTF_ARRAY_LENGTH(fallbackFonts); ++i) { - if (simpleFont = getCachedFontData(fontDescription, fallbackFonts[i]), false, shouldRetain) { + if (simpleFont = getCachedFontData(fontDescription, fallbackFonts[i], false, shouldRetain)) { fallbackFontName = fallbackFonts[i]; return simpleFont; } diff --git a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp index 983c1bf92..53af06d64 100644 --- a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp +++ b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp @@ -35,8 +35,6 @@ #include "FontDescription.h" #include "HWndDC.h" #include <mlang.h> -#include <unicode/uchar.h> -#include <unicode/unorm.h> #include <winsock2.h> #include <wtf/MathExtras.h> diff --git a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 3cbe13658..78e608993 100644 --- a/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -222,6 +222,8 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + ASSERT(!rect.isEmpty()); + save(); m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle()))); m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp index 2eb4f2bad..a77077a05 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -48,7 +48,7 @@ #include <gtk/gtk.h> #include <wtf/text/CString.h> -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif @@ -641,7 +641,7 @@ bool RenderThemeGtk::paintMediaCurrentTime(RenderObject* renderObject, const Pai } #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) void RenderThemeGtk::adjustProgressBarStyle(StyleResolver*, RenderStyle* style, Element*) const { style->setBoxShadow(nullptr); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.h b/Source/WebCore/platform/gtk/RenderThemeGtk.h index 133f588e9..add959d9f 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.h +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.h @@ -168,7 +168,7 @@ protected: virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; @@ -191,7 +191,7 @@ private: bool paintMediaButton(RenderObject*, GraphicsContext*, const IntRect&, const char* iconName); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) static IntRect calculateProgressRect(RenderObject*, const IntRect&); #endif diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp index 4cc3a29fa..7012d3d26 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp @@ -551,7 +551,7 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderStyle* style, Element*) const style->setHeight(Length(length, Fixed)); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { GtkWidget* widget = gtkProgressBar(); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp index fed4e7e62..774939151 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp @@ -730,7 +730,7 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderStyle* style, Element*) const style->setHeight(Length(sliderLength, Fixed)); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { if (!renderObject->isProgress()) diff --git a/Source/WebCore/platform/network/MIMESniffing.cpp b/Source/WebCore/platform/network/MIMESniffing.cpp index 5efd17f13..c019702fc 100644 --- a/Source/WebCore/platform/network/MIMESniffing.cpp +++ b/Source/WebCore/platform/network/MIMESniffing.cpp @@ -233,11 +233,28 @@ static inline size_t dataSizeNeededForImageSniffing() return result; } +static inline bool maskedCompareSlowCase(const MagicNumbers& info, const char* data) +{ + const char* pattern = reinterpret_cast<const char*>(info.pattern); + const char* mask = reinterpret_cast<const char*>(info.mask); + + size_t count = info.size; + + for (size_t i = 0; i < count; ++i) { + if ((*data++ & *mask++) != *pattern++) + return false; + } + return true; +} + static inline bool maskedCompare(const MagicNumbers& info, const char* data, size_t dataSize) { if (dataSize < info.size) return false; + if (!isPointerTypeAlignmentOkay(static_cast<const uint32_t*>(static_cast<const void*>(data)))) + return maskedCompareSlowCase(info, data); + const uint32_t* pattern32 = reinterpret_cast_ptr<const uint32_t*>(info.pattern); const uint32_t* mask32 = reinterpret_cast_ptr<const uint32_t*>(info.mask); const uint32_t* data32 = reinterpret_cast_ptr<const uint32_t*>(data); diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index 56b8760ba..e01bdc155 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -19,8 +19,6 @@ #include "config.h" #include "NetworkJob.h" -#include "AboutData.h" -#include "AboutTemplate.html.cpp" #include "Chrome.h" #include "ChromeClient.h" #include "CookieManager.h" @@ -39,8 +37,6 @@ #include <BlackBerryPlatformClient.h> #include <BlackBerryPlatformLog.h> -#include <BlackBerryPlatformWebKitCredits.h> -#include <BuildInformation.h> #include <LocalizeResource.h> #include <network/MultipartStream.h> #include <network/NetworkStreamFactory.h> @@ -66,11 +62,9 @@ inline static bool isUnauthorized(int statusCode) NetworkJob::NetworkJob() : m_playerId(0) - , m_loadAboutTimer(this, &NetworkJob::fireLoadAboutTimer) , m_deleteJobTimer(this, &NetworkJob::fireDeleteJobTimer) , m_streamFactory(0) , m_isFile(false) - , m_isAbout(false) , m_isFTP(false) , m_isFTPDir(true) #ifndef NDEBUG @@ -107,7 +101,6 @@ bool NetworkJob::initialize(int playerId, m_response.setURL(url); m_isFile = url.protocolIs("file") || url.protocolIs("local"); - m_isAbout = url.protocolIs("about"); m_isFTP = url.protocolIs("ftp"); m_handle = handle; @@ -132,10 +125,6 @@ bool NetworkJob::initialize(int playerId, m_isOverrideContentType = true; } - // No need to create the streams for about. - if (m_isAbout) - return true; - if (!request.getSuggestedSaveName().empty()) { m_contentDisposition = "filename="; m_contentDisposition += request.getSuggestedSaveName().c_str(); @@ -149,24 +138,10 @@ bool NetworkJob::initialize(int playerId, return true; } -void NetworkJob::loadAboutURL() -{ - m_loadAboutTimer.startOneShot(0); -} - int NetworkJob::cancelJob() { m_cancelled = true; - // Cancel jobs loading local data by killing the timer, and jobs - // getting data from the network by calling the inherited URLStream::cancel. - - if (m_loadAboutTimer.isActive()) { - m_loadAboutTimer.stop(); - notifyClose(BlackBerry::Platform::FilterStream::StatusCancelled); - return 0; - } - return streamCancel(); } @@ -192,7 +167,7 @@ void NetworkJob::notifyStatusReceived(int status, const char* message) void NetworkJob::handleNotifyStatusReceived(int status, const String& message) { // Check for messages out of order or after cancel. - if ((m_statusReceived && m_extendedStatusCode != 401) || m_responseSent || m_cancelled) + if (m_responseSent || m_cancelled) return; if (isInfo(status)) @@ -610,7 +585,7 @@ void NetworkJob::sendResponseIfNeeded() return; String urlFilename; - if (!m_response.url().protocolIsData() && !m_response.url().protocolIs("about")) + if (!m_response.url().protocolIsData()) urlFilename = m_response.url().lastPathComponent(); // Get the MIME type that was set by the content sniffer @@ -638,32 +613,23 @@ void NetworkJob::sendResponseIfNeeded() if (!contentLength.isNull()) m_response.setExpectedContentLength(contentLength.toInt64()); - // Set suggested filename for downloads from the Content-Disposition header; if this fails, - // fill it in from the url and sniffed mime type;Skip this for about URLs, - // because they have no Content-Disposition header and the format is wrong to be a filename. - if (!m_isAbout) { - String suggestedFilename = filenameFromHTTPContentDisposition(m_contentDisposition); - if (suggestedFilename.isEmpty()) { - // Check and see if an extension already exists. - String mimeExtension = MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType); - if (urlFilename.isEmpty()) { - if (mimeExtension.isEmpty()) // No extension found for the mimeType. - suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)); - else - suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)) + "." + mimeExtension; - } else { - if (urlFilename.reverseFind('.') == notFound && !mimeExtension.isEmpty()) - suggestedFilename = urlFilename + '.' + mimeExtension; - else - suggestedFilename = urlFilename; - } + String suggestedFilename = filenameFromHTTPContentDisposition(m_contentDisposition); + if (suggestedFilename.isEmpty()) { + // Check and see if an extension already exists. + String mimeExtension = MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType); + if (urlFilename.isEmpty()) { + if (mimeExtension.isEmpty()) // No extension found for the mimeType. + suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)); + else + suggestedFilename = String(BlackBerry::Platform::LocalizeResource::getString(BlackBerry::Platform::FILENAME_UNTITLED)) + "." + mimeExtension; + } else { + if (urlFilename.reverseFind('.') == notFound && !mimeExtension.isEmpty()) + suggestedFilename = urlFilename + '.' + mimeExtension; + else + suggestedFilename = urlFilename; } - m_response.setSuggestedFilename(suggestedFilename); } - - // Don't cache resources for "about:" - if (m_isAbout) - m_response.setHTTPHeaderField("Cache-Control", "no-cache"); + m_response.setSuggestedFilename(suggestedFilename); if (isClientAvailable()) { RecursionGuard guard(m_callingClient); @@ -828,100 +794,4 @@ void NetworkJob::fireDeleteJobTimer(Timer<NetworkJob>*) NetworkManager::instance()->deleteJob(this); } -void NetworkJob::handleAbout() -{ - // First 6 chars are "about:". - String aboutWhat(m_response.url().string().substring(6)); - - String result; - - bool handled = false; - if (equalIgnoringCase(aboutWhat, "blank")) { - handled = true; - } else if (equalIgnoringCase(aboutWhat, "credits")) { - result.append(writeHeader("Credits")); - result.append(String("<style> .about {padding:14px;} </style>")); - result.append(String(BlackBerry::Platform::WEBKITCREDITS)); - result.append(String("</body></html>")); - handled = true; - } else if (aboutWhat.startsWith("cache?query=", false)) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - std::string key(aboutWhat.substring(12, aboutWhat.length() - 12).utf8().data()); // 12 is length of "cache?query=". - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); - result.append(String(key.data())); - result.append(String("<hr>")); - result.append(String(client->generateHtmlFragmentForCacheHeaders(key).data())); - result.append(String("</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "cache")) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>")); - result.append(String(client->generateHtmlFragmentForCacheKeys().data())); - result.append(String("</body></html>")); - handled = true; -#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - } else if (equalIgnoringCase(aboutWhat, "cache/disable")) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - client->setDiskCacheEnabled(false); - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is disabled.</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "cache/enable")) { - BlackBerry::Platform::Client* client = BlackBerry::Platform::Client::get(); - ASSERT(client); - client->setDiskCacheEnabled(true); - result.append(String("<html><head><title>BlackBerry Browser Disk Cache</title></head><body>Http disk cache is enabled.</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "cookie")) { - result.append(String("<html><head><title>BlackBerry Browser cookie information</title></head><body>")); - result.append(cookieManager().generateHtmlFragmentForCookies()); - result.append(String("</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "version")) { - result.append(writeHeader("Version")); - result.append(String("<div class='box'><div class='box-title'>Build Time</div><br>")); - result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</div><br><div style='font-size:10px;text-align:center;'>Also see the <A href='about:build'>build information</A>.</body></html>")); - handled = true; - } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "config")) { - result = configPage(); - handled = true; - } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "build")) { - result.append(writeHeader("Build")); - result.append(String("<div class='box'><div class='box-title'>Basic</div><table>")); - result.append(String("<tr><td>Built On: </td><td>")); - result.append(String(BlackBerry::Platform::BUILDCOMPUTER)); - result.append(String("</td></tr>")); - result.append(String("<tr><td>Build User: </td><td>")); - result.append(String(BlackBerry::Platform::BUILDUSER)); - result.append(String("</td></tr>")); - result.append(String("<tr><td>Build Time: </td><td>")); - result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</table></div><br>")); - result.append(String(BlackBerry::Platform::BUILDINFO_WEBKIT)); - result.append(String(BlackBerry::Platform::BUILDINFO_PLATFORM)); - result.append(String(BlackBerry::Platform::BUILDINFO_LIBWEBVIEW)); - result.append(String("</body></html>")); - handled = true; - } else if (equalIgnoringCase(aboutWhat, "memory")) { - result = memoryPage(); - handled = true; -#endif - } - if (handled) { - CString resultString = result.utf8(); - notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusSuccess, 0); - notifyStringHeaderReceived("Content-Length", String::number(resultString.length())); - notifyStringHeaderReceived("Content-Type", "text/html"); - notifyDataReceivedPlain(resultString.data(), resultString.length()); - notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess); - } else { - // If we can not handle it, we take it as an error of invalid URL. - notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl, 0); - notifyClose(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl); - } -} - } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h index 8fceffc1a..b48c1ecc0 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.h +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h @@ -60,7 +60,6 @@ public: bool isRunning() const { return m_isRunning; } #endif bool isCancelled() const { return m_cancelled; } - void loadAboutURL(); int cancelJob(); bool isDeferringLoading() const { return m_deferLoadingCount > 0; } void updateDeferLoadingCount(int delta); @@ -115,15 +114,8 @@ private: void sendResponseIfNeeded(); void sendMultipartResponseIfNeeded(); - void fireLoadAboutTimer(Timer<NetworkJob>*) - { - handleAbout(); - } - void fireDeleteJobTimer(Timer<NetworkJob>*); - void handleAbout(); - bool handleFTPHeader(const String& header); // The server needs authentication credentials. Search in the CredentialStorage @@ -144,7 +136,6 @@ private: String m_pageGroupName; RefPtr<ResourceHandle> m_handle; ResourceResponse m_response; - Timer<NetworkJob> m_loadAboutTimer; OwnPtr<ResourceResponse> m_multipartResponse; Timer<NetworkJob> m_deleteJobTimer; String m_contentType; @@ -152,7 +143,6 @@ private: String m_contentDisposition; BlackBerry::Platform::NetworkStreamFactory* m_streamFactory; bool m_isFile; - bool m_isAbout; bool m_isFTP; bool m_isFTPDir; #ifndef NDEBUG diff --git a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp index 89d619c8b..b92a0a45c 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp @@ -136,12 +136,6 @@ bool NetworkManager::startJob(int playerId, const String& pageGroupName, PassRef m_jobs.append(networkJob); - if (url.protocolIs("about")) { - // If the protocol matches "about", loadAboutURL should recognize and handle it. - networkJob->loadAboutURL(); - return true; - } - int result = networkJob->streamOpen(); if (result) return false; diff --git a/Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp b/Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp new file mode 100644 index 000000000..48406f367 --- /dev/null +++ b/Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ProxyResolverSoup.h" + +#include <libsoup/soup.h> +#include <string.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +static const char defaultNoProxyValue[] = "localhost,127.0.0.1"; + +typedef struct { + SoupURI* proxyURI; + CString noProxy; + Vector<String> proxyExceptions; +} SoupProxyResolverWkPrivate; + +#define SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWkPrivate)) + +static void soup_proxy_resolver_wk_interface_init(SoupProxyURIResolverInterface* proxyResolverInterface); + +G_DEFINE_TYPE_EXTENDED(SoupProxyResolverWk, soup_proxy_resolver_wk, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE(SOUP_TYPE_SESSION_FEATURE, 0) + G_IMPLEMENT_INTERFACE(SOUP_TYPE_PROXY_URI_RESOLVER, soup_proxy_resolver_wk_interface_init)) + +enum { + PROP_0, + PROP_PROXY_URI, + PROP_NO_PROXY, + LAST_PROP +}; + +static void soup_proxy_resolver_wk_init(SoupProxyResolverWk* resolverWk) +{ +} + +static void soupProxyResolverWkFinalize(GObject* object) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(object); + + g_clear_pointer(&priv->proxyURI, soup_uri_free); + + G_OBJECT_CLASS(soup_proxy_resolver_wk_parent_class)->finalize(object); +} + +static void soupProxyResolverWkSetProperty(GObject* object, uint propID, const GValue* value, GParamSpec* pspec) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(object); + + switch (propID) { + case PROP_PROXY_URI: { + SoupURI* uri = static_cast<SoupURI*>(g_value_get_boxed(value)); + if (priv->proxyURI) + soup_uri_free(priv->proxyURI); + + priv->proxyURI = uri ? soup_uri_copy(uri) : 0; + break; + } + case PROP_NO_PROXY: + priv->noProxy = g_value_get_string(value); + priv->proxyExceptions.clear(); + String::fromUTF8(priv->noProxy.data()).replace(' ', "").split(',', priv->proxyExceptions); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec); + break; + } +} + +static void soupProxyResolverWkGetProperty(GObject* object, uint propID, GValue* value, GParamSpec* pspec) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(object); + + switch (propID) { + case PROP_PROXY_URI: + g_value_set_boxed(value, priv->proxyURI); + break; + case PROP_NO_PROXY: + g_value_set_string(value, priv->noProxy.data()); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec); + break; + } +} + +static bool shouldBypassProxy(SoupProxyResolverWkPrivate* priv, SoupURI* uri) +{ + const size_t exceptionCount = priv->proxyExceptions.size(); + for (size_t i = 0; i < exceptionCount; ++i) { + if (String::fromUTF8(uri->host).endsWith(priv->proxyExceptions[i], false)) + return true; + } + + return false; +} + +typedef struct { + SoupProxyURIResolver* proxyResolver; + SoupURI* uri; + SoupProxyURIResolverCallback callback; + void* userData; +} SoupWkAsyncData; + +static gboolean idle_return_proxy_uri(void* data) +{ + SoupWkAsyncData* ssad = static_cast<SoupWkAsyncData*>(data); + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(ssad->proxyResolver); + + SoupURI* proxyURI = 0; + if (!shouldBypassProxy(priv, ssad->uri)) + proxyURI = priv->proxyURI; + + ssad->callback(ssad->proxyResolver, SOUP_STATUS_OK, proxyURI, ssad->userData); + g_object_unref(ssad->proxyResolver); + soup_uri_free(ssad->uri); + g_slice_free(SoupWkAsyncData, ssad); + + return false; +} + +static void soupProxyResolverWkGetProxyURIAsync(SoupProxyURIResolver* proxyResolver, SoupURI* uri, GMainContext* asyncContext, GCancellable* cancellable, SoupProxyURIResolverCallback callback, void* userData) +{ + SoupWkAsyncData* ssad; + + ssad = g_slice_new0(SoupWkAsyncData); + ssad->proxyResolver = SOUP_PROXY_URI_RESOLVER(g_object_ref(proxyResolver)); + ssad->uri = soup_uri_copy(uri); + ssad->callback = callback; + ssad->userData = userData; + soup_add_completion(asyncContext, idle_return_proxy_uri, ssad); +} + +static uint soupProxyResolverWkGetProxyURISync(SoupProxyURIResolver* proxyResolver, SoupURI* uri, GCancellable* cancellable, SoupURI** proxyURI) +{ + SoupProxyResolverWkPrivate* priv = SOUP_PROXY_RESOLVER_WK_GET_PRIVATE(proxyResolver); + + if (!shouldBypassProxy(priv, uri)) + *proxyURI = soup_uri_copy(priv->proxyURI); + + return SOUP_STATUS_OK; +} + +static void soup_proxy_resolver_wk_class_init(SoupProxyResolverWkClass* wkClass) +{ + GObjectClass* object_class = G_OBJECT_CLASS(wkClass); + + g_type_class_add_private(wkClass, sizeof(SoupProxyResolverWkPrivate)); + + object_class->set_property = soupProxyResolverWkSetProperty; + object_class->get_property = soupProxyResolverWkGetProperty; + object_class->finalize = soupProxyResolverWkFinalize; + + g_object_class_install_property(object_class, PROP_PROXY_URI, + g_param_spec_boxed(SOUP_PROXY_RESOLVER_WK_PROXY_URI, + "Proxy URI", + "The HTTP Proxy to use", + SOUP_TYPE_URI, + static_cast<GParamFlags>(G_PARAM_READWRITE))); + + g_object_class_install_property(object_class, PROP_NO_PROXY, + g_param_spec_string(SOUP_PROXY_RESOLVER_WK_NO_PROXY, + "Proxy exceptions", + "Comma-separated proxy exceptions", + defaultNoProxyValue, + static_cast<GParamFlags>(G_PARAM_READWRITE))); +} + +static void soup_proxy_resolver_wk_interface_init(SoupProxyURIResolverInterface* proxy_uri_resolver_interface) +{ + proxy_uri_resolver_interface->get_proxy_uri_async = soupProxyResolverWkGetProxyURIAsync; + proxy_uri_resolver_interface->get_proxy_uri_sync = soupProxyResolverWkGetProxyURISync; +} + +SoupProxyURIResolver* soupProxyResolverWkNew(const char* httpProxy, const char* noProxy) +{ + SoupURI* proxyURI = soup_uri_new(httpProxy); + SoupProxyURIResolver* resolver = SOUP_PROXY_URI_RESOLVER(g_object_new(SOUP_TYPE_PROXY_RESOLVER_WK, + SOUP_PROXY_RESOLVER_WK_PROXY_URI, proxyURI, + SOUP_PROXY_RESOLVER_WK_NO_PROXY, noProxy ? noProxy : defaultNoProxyValue, + 0)); + soup_uri_free(proxyURI); + + return resolver; +} diff --git a/Source/WebCore/platform/network/soup/ProxyResolverSoup.h b/Source/WebCore/platform/network/soup/ProxyResolverSoup.h new file mode 100644 index 000000000..60bd1ba98 --- /dev/null +++ b/Source/WebCore/platform/network/soup/ProxyResolverSoup.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ProxyResolverSoup_h +#define ProxyResolverSoup_h + +#include <libsoup/soup-proxy-uri-resolver.h> +#include <libsoup/soup-uri.h> + +G_BEGIN_DECLS + +#define SOUP_TYPE_PROXY_RESOLVER_WK (soup_proxy_resolver_wk_get_type ()) +#define SOUP_PROXY_RESOLVER_WK(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWk)) +#define SOUP_PROXY_RESOLVER_WK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWkClass)) +#define SOUP_IS_PROXY_RESOLVER_WK(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SOUP_TYPE_PROXY_RESOLVER_WK)) +#define SOUP_IS_PROXY_RESOLVER_WK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_PROXY_RESOLVER_WK)) +#define SOUP_PROXY_RESOLVER_WK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_PROXY_RESOLVER_WK, SoupProxyResolverWkClass)) + +static const char SOUP_PROXY_RESOLVER_WK_PROXY_URI[] = "proxy-uri"; +static const char SOUP_PROXY_RESOLVER_WK_NO_PROXY[] = "no-proxy"; + +typedef struct { + GObject parent; +} SoupProxyResolverWk; + +typedef struct { + GObjectClass parent_class; +} SoupProxyResolverWkClass; + +GType soup_proxy_resolver_wk_get_type(void); + +SoupProxyURIResolver* soupProxyResolverWkNew(const char* httpProxy, const char* noProxy); + +G_END_DECLS + +#endif // ProxyResolverSoup_h diff --git a/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp b/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp index a8c2baa70..7aa6cccb8 100644 --- a/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp +++ b/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp @@ -116,12 +116,8 @@ void SocketStreamHandle::connected(GSocketConnection* socketConnection, GError* g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0, reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id); - // The client can close the handle, potentially removing the last reference. - RefPtr<SocketStreamHandle> protect(this); m_state = Open; m_client->didOpenSocketStream(this); - if (!m_socketConnection) // Client closed the connection. - return; } void SocketStreamHandle::readBytes(signed long bytesRead, GError* error) diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp index 0f00ffca3..3badb6fcc 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp @@ -50,7 +50,7 @@ #include "PaintInfo.h" #include "QWebPageClient.h" #include "RenderBox.h" -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif #include "RenderTheme.h" @@ -372,7 +372,7 @@ void RenderThemeQt::adjustMenuListButtonStyle(StyleResolver*, RenderStyle* style setPopupPadding(style); } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) double RenderThemeQt::animationRepeatIntervalForProgressBar(RenderProgress* renderProgress) const { if (renderProgress->position() >= 0) @@ -400,6 +400,20 @@ void RenderThemeQt::adjustSliderThumbStyle(StyleResolver* styleResolver, RenderS style->setBoxShadow(nullptr); } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeQt::sliderTickSize() const +{ + // FIXME: We need to set this to the size of one tick mark. + return IntSize(0, 0); +} + +int RenderThemeQt::sliderTickOffsetFromTrackCenter() const +{ + // FIXME: We need to set this to the position of the tick marks. + return 0; +} +#endif + bool RenderThemeQt::paintSearchField(RenderObject* o, const PaintInfo& pi, const IntRect& r) { diff --git a/Source/WebCore/platform/qt/RenderThemeQt.h b/Source/WebCore/platform/qt/RenderThemeQt.h index 122edc75e..a7379140a 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.h +++ b/Source/WebCore/platform/qt/RenderThemeQt.h @@ -34,7 +34,7 @@ QT_END_NAMESPACE namespace WebCore { -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) class RenderProgress; #endif class RenderStyle; @@ -82,6 +82,11 @@ public: virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif + virtual double caretBlinkInterval() const; virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color&) const; @@ -108,7 +113,7 @@ protected: virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp index 3d1f94245..ac0847832 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp @@ -36,7 +36,7 @@ #include "PaintInfo.h" #include "QWebPageClient.h" #include "RenderBox.h" -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderProgress.h" #endif #include "StyleResolver.h" @@ -69,7 +69,7 @@ static const float menuListPadding = 9; static const float textFieldPadding = 10; static const float radiusFactor = 0.36; static const float progressBarChunkPercentage = 0.2; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) static const int progressAnimationGranularity = 2; #endif static const float sliderGrooveBorderRatio = 0.2; @@ -822,7 +822,7 @@ bool RenderThemeQtMobile::paintMenuListButton(RenderObject* o, const PaintInfo& return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) double RenderThemeQtMobile::animationDurationForProgressBar(RenderProgress* renderProgress) const { if (renderProgress->isDeterminate()) diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.h b/Source/WebCore/platform/qt/RenderThemeQtMobile.h index 2d1e53dad..739e706ae 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.h +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.h @@ -71,7 +71,7 @@ protected: virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the duration of the animation for the progress bar. virtual double animationDurationForProgressBar(RenderProgress*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); diff --git a/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp b/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp index 3d49abe17..3f2f572ad 100644 --- a/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp +++ b/Source/WebCore/platform/qt/ThirdPartyCookiesQt.cpp @@ -31,7 +31,6 @@ namespace WebCore { -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) inline void removeTopLevelDomain(QString* domain, const QString& topLevelDomain) { domain->remove(domain->length() - topLevelDomain.length(), topLevelDomain.length()); @@ -57,11 +56,9 @@ static bool urlsShareSameDomain(const QUrl& url, const QUrl& firstPartyUrl) return false; } -#endif bool thirdPartyCookiePolicyPermits(NetworkingContext* context, const QUrl& url, const QUrl& firstPartyUrl) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) if (!context) return true; @@ -79,9 +76,6 @@ bool thirdPartyCookiePolicyPermits(NetworkingContext* context, const QUrl& url, return true; return context->thirdPartyCookiePolicyPermission(url); -#else - return true; -#endif } } diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp index 1363cfe60..4837cfb92 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "PlatformSupport.h" #include "SQLiteDatabase.h" +#include <public/Platform.h> #include <sqlite3.h> #include <wtf/text/CString.h> @@ -92,12 +92,12 @@ bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String&) bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName) { - return (PlatformSupport::databaseDeleteFile(fileName) == SQLITE_OK); + return (WebKit::Platform::current()->databaseDeleteFile(fileName, false) == SQLITE_OK); } long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName) { - return PlatformSupport::databaseGetFileSize(fileName); + return WebKit::Platform::current()->databaseGetFileSize(fileName); } } // namespace WebCore diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp index bdd7f2613..b7b11535f 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "PlatformSupport.h" +#include <public/Platform.h> #include <sqlite3.h> #include <fcntl.h> @@ -69,10 +69,10 @@ int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, return result; if (fd < 0) { - fd = PlatformSupport::databaseOpenFile(fileName, desiredFlags); + fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags); if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) { int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY; - fd = PlatformSupport::databaseOpenFile(fileName, newFlags); + fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), newFlags); } } if (fd < 0) { @@ -103,7 +103,7 @@ int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, // should be synched after the file is deleted. int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) { - return PlatformSupport::databaseDeleteFile(fileName, syncDir); + return WebKit::Platform::current()->databaseDeleteFile(String(fileName), syncDir); } // Check the existance and status of the given file. @@ -114,7 +114,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) // res - the result. int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { - int attr = static_cast<int>(PlatformSupport::databaseGetFileAttributes(fileName)); + int attr = static_cast<int>(WebKit::Platform::current()->databaseGetFileAttributes(String(fileName))); if (attr < 0) { *res = 0; return SQLITE_OK; diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp index 3c0166ac8..f95061cbe 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "PlatformSupport.h" +#include <public/Platform.h> #include <sqlite3.h> #include <windows.h> @@ -55,7 +55,7 @@ namespace { int chromiumOpen(sqlite3_vfs*, const char* fileName, sqlite3_file* id, int desiredFlags, int* usedFlags) { - HANDLE h = PlatformSupport::databaseOpenFile(fileName, desiredFlags); + HANDLE h = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags); if (h == INVALID_HANDLE_VALUE) { if (desiredFlags & SQLITE_OPEN_READWRITE) { int newFlags = (desiredFlags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE; @@ -82,7 +82,7 @@ int chromiumOpen(sqlite3_vfs*, const char* fileName, // should be synched after the file is deleted. int chromiumDelete(sqlite3_vfs*, const char* fileName, int) { - return PlatformSupport::databaseDeleteFile(fileName); + return WebKit::Platform::current()->databaseDeleteFile(String(fileName), false); } // Check the existance and status of the given file. @@ -93,7 +93,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int) // res - the result. int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { - DWORD attr = PlatformSupport::databaseGetFileAttributes(fileName); + DWORD attr = WebKit::Platform::current()->databaseGetFileAttributes(String(fileName)); switch (flag) { case SQLITE_ACCESS_READ: case SQLITE_ACCESS_EXISTS: diff --git a/Source/WebCore/platform/text/TextCodecASCIIFastPath.h b/Source/WebCore/platform/text/TextCodecASCIIFastPath.h index 4ed99836a..7d57677fc 100644 --- a/Source/WebCore/platform/text/TextCodecASCIIFastPath.h +++ b/Source/WebCore/platform/text/TextCodecASCIIFastPath.h @@ -33,6 +33,11 @@ namespace WebCore { template<size_t size> struct UCharByteFiller; template<> struct UCharByteFiller<4> { + static void copy(LChar* destination, const uint8_t* source) + { + memcpy(destination, source, 4); + } + static void copy(UChar* destination, const uint8_t* source) { destination[0] = source[0]; @@ -42,6 +47,11 @@ template<> struct UCharByteFiller<4> { } }; template<> struct UCharByteFiller<8> { + static void copy(LChar* destination, const uint8_t* source) + { + memcpy(destination, source, 8); + } + static void copy(UChar* destination, const uint8_t* source) { destination[0] = source[0]; @@ -55,6 +65,11 @@ template<> struct UCharByteFiller<8> { } }; +inline void copyASCIIMachineWord(LChar* destination, const uint8_t* source) +{ + UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); +} + inline void copyASCIIMachineWord(UChar* destination, const uint8_t* source) { UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); diff --git a/Source/WebCore/platform/text/TextCodecLatin1.cpp b/Source/WebCore/platform/text/TextCodecLatin1.cpp index 9ac9aeba1..d3a202773 100644 --- a/Source/WebCore/platform/text/TextCodecLatin1.cpp +++ b/Source/WebCore/platform/text/TextCodecLatin1.cpp @@ -120,13 +120,15 @@ void TextCodecLatin1::registerCodecs(TextCodecRegistrar registrar) String TextCodecLatin1::decode(const char* bytes, size_t length, bool, bool, bool&) { - UChar* characters; + LChar* characters; + if (!length) + return emptyString(); String result = String::createUninitialized(length, characters); const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); const uint8_t* end = reinterpret_cast<const uint8_t*>(bytes + length); const uint8_t* alignedEnd = alignToMachineWord(end); - UChar* destination = characters; + LChar* destination = characters; while (source < end) { if (isASCII(*source)) { @@ -149,6 +151,9 @@ String TextCodecLatin1::decode(const char* bytes, size_t length, bool, bool, boo *destination = *source; } else { useLookupTable: + if (table[*source] > 0xff) + goto upConvertTo16Bit; + *destination = table[*source]; } @@ -157,6 +162,54 @@ useLookupTable: } return result; + +upConvertTo16Bit: + UChar* characters16; + String result16 = String::createUninitialized(length, characters16); + + UChar* destination16 = characters16; + + // Zero extend and copy already processed 8 bit data + LChar* ptr8 = characters; + LChar* endPtr8 = destination; + + while (ptr8 < endPtr8) + *destination16++ = *ptr8++; + + // Handle the character that triggered the 16 bit path + *destination16 = table[*source]; + ++source; + ++destination16; + + while (source < end) { + if (isASCII(*source)) { + // Fast path for ASCII. Most Latin-1 text will be ASCII. + if (isAlignedToMachineWord(source)) { + while (source < alignedEnd) { + MachineWord chunk = *reinterpret_cast_ptr<const MachineWord*>(source); + + if (!isAllASCII<LChar>(chunk)) + goto useLookupTable16; + + copyASCIIMachineWord(destination16, source); + source += sizeof(MachineWord); + destination16 += sizeof(MachineWord); + } + + if (source == end) + break; + } + *destination16 = *source; + } else { +useLookupTable16: + *destination16 = table[*source]; + } + + ++source; + ++destination16; + } + + return result16; } static CString encodeComplexWindowsLatin1(const UChar* characters, size_t length, UnencodableHandling handling) diff --git a/Source/WebCore/platform/text/TextCodecUTF8.cpp b/Source/WebCore/platform/text/TextCodecUTF8.cpp index 206f25f08..f7376acac 100644 --- a/Source/WebCore/platform/text/TextCodecUTF8.cpp +++ b/Source/WebCore/platform/text/TextCodecUTF8.cpp @@ -167,7 +167,51 @@ void TextCodecUTF8::handleError(UChar*& destination, bool stopOnError, bool& saw consumePartialSequenceByte(); } -void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError) +template <> +bool TextCodecUTF8::handlePartialSequence<LChar>(LChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool, bool&) +{ + ASSERT(m_partialSequenceSize); + do { + if (isASCII(m_partialSequence[0])) { + *destination++ = m_partialSequence[0]; + consumePartialSequenceByte(); + continue; + } + int count = nonASCIISequenceLength(m_partialSequence[0]); + if (!count) + return true; + + if (count > m_partialSequenceSize) { + if (count - m_partialSequenceSize > end - source) { + if (!flush) { + // The new data is not enough to complete the sequence, so + // add it to the existing partial sequence. + memcpy(m_partialSequence + m_partialSequenceSize, source, end - source); + m_partialSequenceSize += end - source; + return false; + } + // An incomplete partial sequence at the end is an error, but it will create + // a 16 bit string due to the replacementCharacter. Let the 16 bit path handle + // the error. + return true; + } + memcpy(m_partialSequence + m_partialSequenceSize, source, count - m_partialSequenceSize); + source += count - m_partialSequenceSize; + m_partialSequenceSize = count; + } + int character = decodeNonASCIISequence(m_partialSequence, count); + if ((character == nonCharacter) || (character > 0xff)) + return true; + + m_partialSequenceSize -= count; + *destination++ = character; + } while (m_partialSequenceSize); + + return false; +} + +template <> +bool TextCodecUTF8::handlePartialSequence<UChar>(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError) { ASSERT(m_partialSequenceSize); do { @@ -180,7 +224,7 @@ void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& s if (!count) { handleError(destination, stopOnError, sawError); if (stopOnError) - return; + return false; continue; } if (count > m_partialSequenceSize) { @@ -190,12 +234,12 @@ void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& s // add it to the existing partial sequence. memcpy(m_partialSequence + m_partialSequenceSize, source, end - source); m_partialSequenceSize += end - source; - return; + return false; } // An incomplete partial sequence at the end is an error. handleError(destination, stopOnError, sawError); if (stopOnError) - return; + return false; continue; } memcpy(m_partialSequence + m_partialSequenceSize, source, count - m_partialSequenceSize); @@ -206,34 +250,40 @@ void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& s if (character == nonCharacter) { handleError(destination, stopOnError, sawError); if (stopOnError) - return; + return false; continue; } + m_partialSequenceSize -= count; destination = appendCharacter(destination, character); } while (m_partialSequenceSize); -} + return false; +} + String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool stopOnError, bool& sawError) { // Each input byte might turn into a character. // That includes all bytes in the partial-sequence buffer because // each byte in an invalid sequence will turn into a replacement character. - StringBuffer<UChar> buffer(m_partialSequenceSize + length); + StringBuffer<LChar> buffer(m_partialSequenceSize + length); const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); const uint8_t* end = source + length; const uint8_t* alignedEnd = alignToMachineWord(end); - UChar* destination = buffer.characters(); + LChar* destination = buffer.characters(); do { if (m_partialSequenceSize) { // Explicitly copy destination and source pointers to avoid taking pointers to the // local variables, which may harm code generation by disabling some optimizations // in some compilers. - UChar* destinationForHandlePartialSequence = destination; + LChar* destinationForHandlePartialSequence = destination; const uint8_t* sourceForHandlePartialSequence = source; - handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError); + if (handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError)) { + source = sourceForHandlePartialSequence; + goto upConvertTo16Bit; + } destination = destinationForHandlePartialSequence; source = sourceForHandlePartialSequence; if (m_partialSequenceSize) @@ -279,19 +329,96 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool sawError = true; if (stopOnError) break; - // Each error generates a replacement character and consumes one byte. - *destination++ = replacementCharacter; - ++source; - continue; + + goto upConvertTo16Bit; } + if (character > 0xff) + goto upConvertTo16Bit; + source += count; - destination = appendCharacter(destination, character); + *destination++ = character; } } while (flush && m_partialSequenceSize); buffer.shrink(destination - buffer.characters()); return String::adopt(buffer); + +upConvertTo16Bit: + StringBuffer<UChar> buffer16(m_partialSequenceSize + length); + + UChar* destination16 = buffer16.characters(); + + // Copy the already converted characters + for (LChar* converted8 = buffer.characters(); converted8 < destination;) + *destination16++ = *converted8++; + + do { + if (m_partialSequenceSize) { + // Explicitly copy destination and source pointers to avoid taking pointers to the + // local variables, which may harm code generation by disabling some optimizations + // in some compilers. + UChar* destinationForHandlePartialSequence = destination16; + const uint8_t* sourceForHandlePartialSequence = source; + handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError); + destination16 = destinationForHandlePartialSequence; + source = sourceForHandlePartialSequence; + if (m_partialSequenceSize) + break; + } + + while (source < end) { + if (isASCII(*source)) { + // Fast path for ASCII. Most UTF-8 text will be ASCII. + if (isAlignedToMachineWord(source)) { + while (source < alignedEnd) { + MachineWord chunk = *reinterpret_cast_ptr<const MachineWord*>(source); + if (!isAllASCII<LChar>(chunk)) + break; + copyASCIIMachineWord(destination16, source); + source += sizeof(MachineWord); + destination16 += sizeof(MachineWord); + } + if (source == end) + break; + if (!isASCII(*source)) + continue; + } + *destination16++ = *source++; + continue; + } + int count = nonASCIISequenceLength(*source); + int character; + if (!count) + character = nonCharacter; + else { + if (count > end - source) { + ASSERT(end - source < static_cast<ptrdiff_t>(sizeof(m_partialSequence))); + ASSERT(!m_partialSequenceSize); + m_partialSequenceSize = end - source; + memcpy(m_partialSequence, source, m_partialSequenceSize); + source = end; + break; + } + character = decodeNonASCIISequence(source, count); + } + if (character == nonCharacter) { + sawError = true; + if (stopOnError) + break; + // Each error generates a replacement character and consumes one byte. + *destination16++ = replacementCharacter; + ++source; + continue; + } + source += count; + destination16 = appendCharacter(destination16, character); + } + } while (flush && m_partialSequenceSize); + + buffer16.shrink(destination16 - buffer16.characters()); + + return String::adopt(buffer16); } CString TextCodecUTF8::encode(const UChar* characters, size_t length, UnencodableHandling) diff --git a/Source/WebCore/platform/text/TextCodecUTF8.h b/Source/WebCore/platform/text/TextCodecUTF8.h index 39fd75361..270cf298f 100644 --- a/Source/WebCore/platform/text/TextCodecUTF8.h +++ b/Source/WebCore/platform/text/TextCodecUTF8.h @@ -42,7 +42,8 @@ private: virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError); virtual CString encode(const UChar*, size_t length, UnencodableHandling); - void handlePartialSequence(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError); + template <typename CharType> + bool handlePartialSequence(CharType*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError); void handleError(UChar*& destination, bool stopOnError, bool& sawError); void consumePartialSequenceByte(); diff --git a/Source/WebCore/platform/text/TextEncoding.cpp b/Source/WebCore/platform/text/TextEncoding.cpp index 26ab82a5c..e3d372a1e 100644 --- a/Source/WebCore/platform/text/TextEncoding.cpp +++ b/Source/WebCore/platform/text/TextEncoding.cpp @@ -125,7 +125,7 @@ CString TextEncoding::encode(const UChar* characters, size_t length, Unencodable UTF16Normalized.set(g_utf8_to_utf16(UTF8Normalized.get(), -1, 0, &UTF16Length, 0)); return newTextCodec(*this)->encode(UTF16Normalized.get(), UTF16Length, handling); -#elif OS(WINCE) +#elif USE(WINCE_UNICODE) // normalization will be done by Windows CE API OwnPtr<TextCodec> textCodec = newTextCodec(*this); return textCodec.get() ? textCodec->encode(characters, length, handling) : CString(); diff --git a/Source/WebCore/platform/text/TextEncodingRegistry.cpp b/Source/WebCore/platform/text/TextEncodingRegistry.cpp index 05150052f..8281538bf 100644 --- a/Source/WebCore/platform/text/TextEncodingRegistry.cpp +++ b/Source/WebCore/platform/text/TextEncodingRegistry.cpp @@ -45,13 +45,13 @@ #if PLATFORM(MAC) #include "TextCodecMac.h" #endif -#if PLATFORM(QT) +#if USE(QT4_UNICODE) #include "qt/TextCodecQt.h" #endif #if USE(GLIB_UNICODE) #include "gtk/TextCodecGtk.h" #endif -#if OS(WINCE) && !PLATFORM(QT) +#if USE(WINCE_UNICODE) #include "TextCodecWinCE.h" #endif @@ -311,7 +311,7 @@ static void extendTextCodecMaps() TextCodecGtk::registerExtendedCodecs(addToTextCodecMap); #endif -#if OS(WINCE) && !PLATFORM(QT) +#if USE(WINCE_UNICODE) TextCodecWinCE::registerExtendedEncodingNames(addToTextEncodingNameMap); TextCodecWinCE::registerExtendedCodecs(addToTextCodecMap); #endif diff --git a/Source/WebCore/platform/text/mac/ShapeArabic.c b/Source/WebCore/platform/text/mac/ShapeArabic.c deleted file mode 100644 index dd61ce596..000000000 --- a/Source/WebCore/platform/text/mac/ShapeArabic.c +++ /dev/null @@ -1,556 +0,0 @@ -/* -****************************************************************************** -* -* Copyright (C) 2000-2004, International Business Machines -* Corporation and others. All Rights Reserved. -* Copyright (C) 2007 Apple Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this -* software and associated documentation files (the "Software"), to deal in the Software -* without restriction, including without limitation the rights to use, copy, modify, -* merge, publish, distribute, and/or sell copies of the Software, and to permit persons -* to whom the Software is furnished to do so, provided that the above copyright notice(s) -* and this permission notice appear in all copies of the Software and that both the above -* copyright notice(s) and this permission notice appear in supporting documentation. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -* PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER -* OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -* CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -* -* Except as contained in this notice, the name of a copyright holder shall not be used in -* advertising or otherwise to promote the sale, use or other dealings in this Software -* without prior written authorization of the copyright holder. -* -****************************************************************************** -* -* Arabic letter shaping implemented by Ayman Roshdy -*/ - -#include "config.h" - -#if USE(ATSUI) - -#include "ShapeArabic.h" - -#include <stdbool.h> -#include <string.h> -#include <unicode/utypes.h> -#include <unicode/uchar.h> -#include <unicode/ustring.h> -#include <unicode/ushape.h> -#include <wtf/Assertions.h> - -/* - * ### TODO in general for letter shaping: - * - the letter shaping code is UTF-16-unaware; needs update - * + especially invertBuffer()?! - * - needs to handle the "Arabic Tail" that is used in some legacy codepages - * as a glyph fragment of wide-glyph letters - * + IBM Unicode conversion tables map it to U+200B (ZWSP) - * + IBM Egypt has proposed to encode the tail in Unicode among Arabic Presentation Forms - */ - -/* definitions for Arabic letter shaping ------------------------------------ */ - -#define IRRELEVANT 4 -#define LAMTYPE 16 -#define ALEFTYPE 32 -#define LINKR 1 -#define LINKL 2 - -static const UChar IrrelevantPos[] = { - 0x0, 0x2, 0x4, 0x6, - 0x8, 0xA, 0xC, 0xE, -}; - -static const UChar araLink[178]= -{ - 1 + 32 + 256 * 0x11,/*0x0622*/ - 1 + 32 + 256 * 0x13,/*0x0623*/ - 1 + 256 * 0x15,/*0x0624*/ - 1 + 32 + 256 * 0x17,/*0x0625*/ - 1 + 2 + 256 * 0x19,/*0x0626*/ - 1 + 32 + 256 * 0x1D,/*0x0627*/ - 1 + 2 + 256 * 0x1F,/*0x0628*/ - 1 + 256 * 0x23,/*0x0629*/ - 1 + 2 + 256 * 0x25,/*0x062A*/ - 1 + 2 + 256 * 0x29,/*0x062B*/ - 1 + 2 + 256 * 0x2D,/*0x062C*/ - 1 + 2 + 256 * 0x31,/*0x062D*/ - 1 + 2 + 256 * 0x35,/*0x062E*/ - 1 + 256 * 0x39,/*0x062F*/ - 1 + 256 * 0x3B,/*0x0630*/ - 1 + 256 * 0x3D,/*0x0631*/ - 1 + 256 * 0x3F,/*0x0632*/ - 1 + 2 + 256 * 0x41,/*0x0633*/ - 1 + 2 + 256 * 0x45,/*0x0634*/ - 1 + 2 + 256 * 0x49,/*0x0635*/ - 1 + 2 + 256 * 0x4D,/*0x0636*/ - 1 + 2 + 256 * 0x51,/*0x0637*/ - 1 + 2 + 256 * 0x55,/*0x0638*/ - 1 + 2 + 256 * 0x59,/*0x0639*/ - 1 + 2 + 256 * 0x5D,/*0x063A*/ - 0, 0, 0, 0, 0, /*0x063B-0x063F*/ - 1 + 2, /*0x0640*/ - 1 + 2 + 256 * 0x61,/*0x0641*/ - 1 + 2 + 256 * 0x65,/*0x0642*/ - 1 + 2 + 256 * 0x69,/*0x0643*/ - 1 + 2 + 16 + 256 * 0x6D,/*0x0644*/ - 1 + 2 + 256 * 0x71,/*0x0645*/ - 1 + 2 + 256 * 0x75,/*0x0646*/ - 1 + 2 + 256 * 0x79,/*0x0647*/ - 1 + 256 * 0x7D,/*0x0648*/ - 1 + 256 * 0x7F,/*0x0649*/ - 1 + 2 + 256 * 0x81,/*0x064A*/ - 4, 4, 4, 4, /*0x064B-0x064E*/ - 4, 4, 4, 4, /*0x064F-0x0652*/ - 4, 4, 4, 0, 0, /*0x0653-0x0657*/ - 0, 0, 0, 0, /*0x0658-0x065B*/ - 1 + 256 * 0x85,/*0x065C*/ - 1 + 256 * 0x87,/*0x065D*/ - 1 + 256 * 0x89,/*0x065E*/ - 1 + 256 * 0x8B,/*0x065F*/ - 0, 0, 0, 0, 0, /*0x0660-0x0664*/ - 0, 0, 0, 0, 0, /*0x0665-0x0669*/ - 0, 0, 0, 0, 0, 0, /*0x066A-0x066F*/ - 4, /*0x0670*/ - 0, /*0x0671*/ - 1 + 32, /*0x0672*/ - 1 + 32, /*0x0673*/ - 0, /*0x0674*/ - 1 + 32, /*0x0675*/ - 1, 1, /*0x0676-0x0677*/ - 1+2, /*0x0678*/ - 1+2 + 256 * 0x16,/*0x0679*/ - 1+2 + 256 * 0x0E,/*0x067A*/ - 1+2 + 256 * 0x02,/*0x067B*/ - 1+2, 1+2, /*0x067C-0x067D*/ - 1+2 + 256 * 0x06,/*0x067E*/ - 1+2 + 256 * 0x12,/*0x067F*/ - 1+2 + 256 * 0x0A,/*0x0680*/ - 1+2, 1+2, /*0x0681-0x0682*/ - 1+2 + 256 * 0x26,/*0x0683*/ - 1+2 + 256 * 0x22,/*0x0684*/ - 1+2, /*0x0685*/ - 1+2 + 256 * 0x2A,/*0x0686*/ - 1+2 + 256 * 0x2E,/*0x0687*/ - 1 + 256 * 0x38,/*0x0688*/ - 1, 1, 1, /*0x0689-0x068B*/ - 1 + 256 * 0x34,/*0x068C*/ - 1 + 256 * 0x32,/*0x068D*/ - 1 + 256 * 0x36,/*0x068E*/ - 1, 1, /*0x068F-0x0690*/ - 1 + 256 * 0x3C,/*0x0691*/ - 1, 1, 1, 1, 1, 1, /*0x0692-0x0697*/ - 1 + 256 * 0x3A,/*0x0698*/ - 1, /*0x0699*/ - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, /*0x069A-0x069F*/ - 1+2, 1+2, 1+2, 1+2, /*0x06A0-0x06A3*/ - 1+2 + 256 * 0x2E,/*0x06A4*/ - 1+2, /*0x06A5*/ - 1+2 + 256 * 0x1E,/*0x06A6*/ - 1+2, 1+2, /*0x06A7-0x06A8*/ - 1+2 + 256 * 0x3E,/*0x06A9*/ - 1+2, 1+2, 1+2, /*0x06AA-0x06AC*/ - 1+2 + 256 * 0x83,/*0x06AD*/ - 1+2, /*0x06AE*/ - 1+2 + 256 * 0x42,/*0x06AF*/ - 1+2, /*0x06B0*/ - 1+2 + 256 * 0x4A,/*0x06B1*/ - 1+2, /*0x06B2*/ - 1+2 + 256 * 0x46,/*0x06B3*/ - 1+2, 1+2, 1+2, 1+2, 1+2, 1+2, /*0x06B4-0x06B9*/ - 1+2, /*0x06BA*/ // FIXME: Seems to have a final form - 1+2 + 256 * 0x50,/*0x06BB*/ - 1+2, 1+2, /*0x06BC-0x06BD*/ - 1+2 + 256 * 0x5A,/*0x06BE*/ - 1+2, /*0x06BF*/ - 1, /*0x06C0*/ - 1+2 + 256 * 0x56,/*0x06C1*/ - 1+2, /*0x06C2*/ - 1, 1, /*0x06C3-0x06C4*/ - 1 + 256 * 0x90,/*0x06C5*/ - 1 + 256 * 0x89,/*0x06C6*/ - 1 + 256 * 0x87,/*0x06C7*/ - 1 + 256 * 0x8B,/*0x06C8*/ - 1 + 256 * 0x92,/*0x06C9*/ - 1, /*0x06CA*/ - 1 + 256 * 0x8E,/*0x06CB*/ - 1+2 + 256 * 0xAC,/*0x06CC*/ - 1, /*0x06CD*/ - 1+2, /*0x06CE*/ - 1, /*0x06CF*/ - 1+2 + 256 * 0x94,/*0x06D0*/ - 1+2, /*0x06D1*/ - 1 + 256 * 0x5E,/*0x06D2*/ - 1 + 256 * 0x60 /*0x06D3*/ -}; - -static const UChar presLink[141]= -{ - 1 + 2, /*0xFE70*/ - 1 + 2, /*0xFE71*/ - 1 + 2, 0, 1+ 2, 0, 1+ 2, /*0xFE72-0xFE76*/ - 1 + 2, /*0xFE77*/ - 1+ 2, 1 + 2, 1+2, 1 + 2, /*0xFE78-0xFE81*/ - 1+ 2, 1 + 2, 1+2, 1 + 2, /*0xFE82-0xFE85*/ - 0, 0 + 32, 1 + 32, 0 + 32, /*0xFE86-0xFE89*/ - 1 + 32, 0, 1, 0 + 32, /*0xFE8A-0xFE8D*/ - 1 + 32, 0, 2, 1 + 2, /*0xFE8E-0xFE91*/ - 1, 0 + 32, 1 + 32, 0, /*0xFE92-0xFE95*/ - 2, 1 + 2, 1, 0, /*0xFE96-0xFE99*/ - 1, 0, 2, 1 + 2, /*0xFE9A-0xFE9D*/ - 1, 0, 2, 1 + 2, /*0xFE9E-0xFEA1*/ - 1, 0, 2, 1 + 2, /*0xFEA2-0xFEA5*/ - 1, 0, 2, 1 + 2, /*0xFEA6-0xFEA9*/ - 1, 0, 2, 1 + 2, /*0xFEAA-0xFEAD*/ - 1, 0, 1, 0, /*0xFEAE-0xFEB1*/ - 1, 0, 1, 0, /*0xFEB2-0xFEB5*/ - 1, 0, 2, 1+2, /*0xFEB6-0xFEB9*/ - 1, 0, 2, 1+2, /*0xFEBA-0xFEBD*/ - 1, 0, 2, 1+2, /*0xFEBE-0xFEC1*/ - 1, 0, 2, 1+2, /*0xFEC2-0xFEC5*/ - 1, 0, 2, 1+2, /*0xFEC6-0xFEC9*/ - 1, 0, 2, 1+2, /*0xFECA-0xFECD*/ - 1, 0, 2, 1+2, /*0xFECE-0xFED1*/ - 1, 0, 2, 1+2, /*0xFED2-0xFED5*/ - 1, 0, 2, 1+2, /*0xFED6-0xFED9*/ - 1, 0, 2, 1+2, /*0xFEDA-0xFEDD*/ - 1, 0, 2, 1+2, /*0xFEDE-0xFEE1*/ - 1, 0 + 16, 2 + 16, 1 + 2 +16, /*0xFEE2-0xFEE5*/ - 1 + 16, 0, 2, 1+2, /*0xFEE6-0xFEE9*/ - 1, 0, 2, 1+2, /*0xFEEA-0xFEED*/ - 1, 0, 2, 1+2, /*0xFEEE-0xFEF1*/ - 1, 0, 1, 0, /*0xFEF2-0xFEF5*/ - 1, 0, 2, 1+2, /*0xFEF6-0xFEF9*/ - 1, 0, 1, 0, /*0xFEFA-0xFEFD*/ - 1, 0, 1, 0, - 1 -}; - -static const UChar convertFEto06[] = -{ -/***********0******1******2******3******4******5******6******7******8******9******A******B******C******D******E******F***/ -/*FE7*/ 0x64B, 0x64B, 0x64C, 0x64C, 0x64D, 0x64D, 0x64E, 0x64E, 0x64F, 0x64F, 0x650, 0x650, 0x651, 0x651, 0x652, 0x652, -/*FE8*/ 0x621, 0x622, 0x622, 0x623, 0x623, 0x624, 0x624, 0x625, 0x625, 0x626, 0x626, 0x626, 0x626, 0x627, 0x627, 0x628, -/*FE9*/ 0x628, 0x628, 0x628, 0x629, 0x629, 0x62A, 0x62A, 0x62A, 0x62A, 0x62B, 0x62B, 0x62B, 0x62B, 0x62C, 0x62C, 0x62C, -/*FEA*/ 0x62C, 0x62D, 0x62D, 0x62D, 0x62D, 0x62E, 0x62E, 0x62E, 0x62E, 0x62F, 0x62F, 0x630, 0x630, 0x631, 0x631, 0x632, -/*FEB*/ 0x632, 0x633, 0x633, 0x633, 0x633, 0x634, 0x634, 0x634, 0x634, 0x635, 0x635, 0x635, 0x635, 0x636, 0x636, 0x636, -/*FEC*/ 0x636, 0x637, 0x637, 0x637, 0x637, 0x638, 0x638, 0x638, 0x638, 0x639, 0x639, 0x639, 0x639, 0x63A, 0x63A, 0x63A, -/*FED*/ 0x63A, 0x641, 0x641, 0x641, 0x641, 0x642, 0x642, 0x642, 0x642, 0x643, 0x643, 0x643, 0x643, 0x644, 0x644, 0x644, -/*FEE*/ 0x644, 0x645, 0x645, 0x645, 0x645, 0x646, 0x646, 0x646, 0x646, 0x647, 0x647, 0x647, 0x647, 0x648, 0x648, 0x649, -/*FEF*/ 0x649, 0x64A, 0x64A, 0x64A, 0x64A, 0x65C, 0x65C, 0x65D, 0x65D, 0x65E, 0x65E, 0x65F, 0x65F -}; - -static const UChar shapeTable[4][4][4]= -{ - { {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,1} }, - { {0,0,2,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} }, - { {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,3} }, - { {0,0,1,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} } -}; - -/* - *Name : changeLamAlef - *Function : Converts the Alef characters into an equivalent - * LamAlef location in the 0x06xx Range, this is an - * intermediate stage in the operation of the program - * later it'll be converted into the 0xFExx LamAlefs - * in the shaping function. - */ -static UChar -changeLamAlef(UChar ch) { - - switch(ch) { - case 0x0622 : - return(0x065C); - break; - case 0x0623 : - return(0x065D); - break; - case 0x0625 : - return(0x065E); - break; - case 0x0627 : - return(0x065F); - break; - default : - return(0); - break; - } -} - -/* - *Name : specialChar - *Function : Special Arabic characters need special handling in the shapeUnicode - * function, this function returns 1 or 2 for these special characters - */ -static int32_t -specialChar(UChar ch) { - - if( (ch>0x0621 && ch<0x0626)||(ch==0x0627)||(ch>0x062e && ch<0x0633)|| - (ch>0x0647 && ch<0x064a)||(ch==0x0629) ) { - return (1); - } - else - if( ch>=0x064B && ch<= 0x0652 ) - return (2); - else - if( (ch>=0x0653 && ch<= 0x0655) || ch == 0x0670 || - (ch>=0xFE70 && ch<= 0xFE7F) ) - return (3); - else - return (0); -} - -/* - *Name : getLink - *Function : Resolves the link between the characters as - * Arabic characters have four forms : - * Isolated, Initial, Middle and Final Form - */ -static UChar -getLink(UChar ch) { - - if(ch >= 0x0622 && ch <= 0x06D3) { - return(araLink[ch-0x0622]); - } else if(ch == 0x200D) { - return(3); - } else if(ch >= 0x206D && ch <= 0x206F) { - return(4); - } else if(ch >= 0xFE70 && ch <= 0xFEFC) { - return(presLink[ch-0xFE70]); - } else { - return(0); - } -} - -/* - *Name : isTashkeelChar - *Function : Returns 1 for Tashkeel characters else return 0 - */ -static int32_t -isTashkeelChar(UChar ch) { - - if( ch>=0x064B && ch<= 0x0652 ) - return (1); - else - return (0); -} - -/* - *Name : shapeUnicode - *Function : Converts an Arabic Unicode buffer in 06xx Range into a shaped - * arabic Unicode buffer in FExx Range - */ -static int32_t -shapeUnicode(UChar *dest, int32_t sourceLength, - int32_t destSize, - int tashkeelFlag) { - - int32_t i, iend; - int32_t prevPos, lastPos,Nx, Nw; - unsigned int Shape; - int32_t flag; - int32_t lamalef_found = 0; - UChar prevLink = 0, lastLink = 0, currLink, nextLink = 0; - UChar wLamalef; - - /* - * Converts the input buffer from FExx Range into 06xx Range - * to make sure that all characters are in the 06xx range - * even the lamalef is converted to the special region in - * the 06xx range - */ - for (i = 0; i < sourceLength; i++) { - UChar inputChar = dest[i]; - if ( (inputChar >= 0xFE70) && (inputChar <= 0xFEFC)) { - dest[i] = convertFEto06 [ (inputChar - 0xFE70) ] ; - } - } - - /* sets the index to the end of the buffer, together with the step point to -1 */ - i = 0; - iend = sourceLength; - - /* - * This function resolves the link between the characters . - * Arabic characters have four forms : - * Isolated Form, Initial Form, Middle Form and Final Form - */ - currLink = getLink(dest[i]); - - prevPos = i; - lastPos = i; - Nx = sourceLength + 2, Nw = 0; - - while (i != iend) { - /* If high byte of currLink > 0 then more than one shape */ - if ((currLink & 0xFF00) > 0 || isTashkeelChar(dest[i])) { - Nw = i + 1; - while (Nx >= sourceLength) { /* we need to know about next char */ - if(Nw == iend) { - nextLink = 0; - Nx = -1; - } else { - nextLink = getLink(dest[Nw]); - if((nextLink & IRRELEVANT) == 0) { - Nx = Nw; - } else { - Nw = Nw + 1; - } - } - } - - if ( ((currLink & ALEFTYPE) > 0) && ((lastLink & LAMTYPE) > 0) ) { - lamalef_found = 1; - wLamalef = changeLamAlef(dest[i]); /*get from 0x065C-0x065f */ - if ( wLamalef != 0) { - dest[i] = ' '; /* The default case is to drop the Alef and replace */ - dest[lastPos] =wLamalef; /* it by a space. */ - i=lastPos; - } - lastLink = prevLink; - currLink = getLink(wLamalef); - } - /* - * get the proper shape according to link ability of neighbors - * and of character; depends on the order of the shapes - * (isolated, initial, middle, final) in the compatibility area - */ - flag = specialChar(dest[i]); - - Shape = shapeTable[nextLink & (LINKR + LINKL)] - [lastLink & (LINKR + LINKL)] - [currLink & (LINKR + LINKL)]; - - if (flag == 1) { - Shape = (Shape == 1 || Shape == 3) ? 1 : 0; - } - else - if(flag == 2) { - if( (lastLink & LINKL) && (nextLink & LINKR) && (tashkeelFlag == 1) && - dest[i] != 0x064C && dest[i] != 0x064D ) { - Shape = 1; - if( (nextLink&ALEFTYPE) == ALEFTYPE && (lastLink&LAMTYPE) == LAMTYPE ) - Shape = 0; - } - else { - Shape = 0; - } - } - - if(flag == 2) { - dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + Shape; - } - else - dest[i] = (UChar)((dest[i] < 0x0670 ? 0xFE70 : 0xFB50) + (currLink >> 8) + Shape); - } - - /* move one notch forward */ - if ((currLink & IRRELEVANT) == 0) { - prevLink = lastLink; - lastLink = currLink; - prevPos = lastPos; - lastPos = i; - } - - i++; - if (i == Nx) { - currLink = nextLink; - Nx = sourceLength + 2; - } - else if(i != iend) { - currLink = getLink(dest[i]); - } - } - - destSize = sourceLength; - - return destSize; -} - -int32_t shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destCapacity, uint32_t options, UErrorCode *pErrorCode) { - int32_t destLength; - - /* usual error checking */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return 0; - } - - /* make sure that no reserved options values are used; allow dest==NULL only for preflighting */ - if( source==NULL || sourceLength<-1 || - (dest==NULL && destCapacity!=0) || destCapacity<0 || - options>=U_SHAPE_DIGIT_TYPE_RESERVED || - (options&U_SHAPE_DIGITS_MASK)>=U_SHAPE_DIGITS_RESERVED - ) { - *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - /* determine the source length */ - if(sourceLength==-1) { - sourceLength=u_strlen(source); - } - if(sourceLength==0) { - return 0; - } - - /* check that source and destination do not overlap */ - if( dest!=NULL && - ((source<=dest && dest<source+sourceLength) || - (dest<=source && source<dest+destCapacity)) - ) { - *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - if((options&U_SHAPE_LETTERS_MASK)!=U_SHAPE_LETTERS_NOOP) { - int32_t outputSize = sourceLength; - - /* calculate destination size */ - /* TODO: do we ever need to do this pure preflighting? */ - ASSERT((options&U_SHAPE_LENGTH_MASK) != U_SHAPE_LENGTH_GROW_SHRINK); - - if(outputSize>destCapacity) { - *pErrorCode=U_BUFFER_OVERFLOW_ERROR; - return outputSize; - } - - /* Start of Arabic letter shaping part */ - memcpy(dest, source, sourceLength*U_SIZEOF_UCHAR); - - ASSERT((options&U_SHAPE_TEXT_DIRECTION_MASK) == U_SHAPE_TEXT_DIRECTION_LOGICAL); - - switch(options&U_SHAPE_LETTERS_MASK) { - case U_SHAPE_LETTERS_SHAPE : - /* Call the shaping function with tashkeel flag == 1 */ - destLength = shapeUnicode(dest,sourceLength,destCapacity,1); - break; - case U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED : - /* Call the shaping function with tashkeel flag == 0 */ - destLength = shapeUnicode(dest,sourceLength,destCapacity,0); - break; - case U_SHAPE_LETTERS_UNSHAPE : - ASSERT_NOT_REACHED(); - break; - default : - /* will never occur because of validity checks above */ - destLength = 0; - break; - } - - /* End of Arabic letter shaping part */ - } else - ASSERT_NOT_REACHED(); - - ASSERT((options & U_SHAPE_DIGITS_MASK) == U_SHAPE_DIGITS_NOOP); - - return sourceLength; -} - -#endif // USE(ATSUI) diff --git a/Source/WebCore/platform/text/mac/ShapeArabic.h b/Source/WebCore/platform/text/mac/ShapeArabic.h deleted file mode 100644 index 8aa577d52..000000000 --- a/Source/WebCore/platform/text/mac/ShapeArabic.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ShapeArabic_h -#define ShapeArabic_h - -#if USE(ATSUI) - -#include <unicode/ushape.h> - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destCapacity, uint32_t options, UErrorCode *pErrorCode); - -#ifdef __cplusplus -} -#endif - -#endif // USE(ATSUI) -#endif // ShapeArabic_h diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 94cd749c1..f8eaedfda 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2383,7 +2383,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo, estimateWithoutPagination); // Cache our old rect so that we can dirty the proper repaint rects if the child moves. - LayoutRect oldRect(child->x(), child->y() , child->width(), child->height()); + LayoutRect oldRect = child->frameRect(); LayoutUnit oldLogicalTop = logicalTopForChild(child); #if !ASSERT_DISABLED @@ -2478,7 +2478,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay if (childRenderBlock && childRenderBlock->containsFloats()) maxFloatLogicalBottom = max(maxFloatLogicalBottom, addOverhangingFloats(toRenderBlock(child), !childNeededLayout)); - LayoutSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y()); + LayoutSize childOffset = child->location() - oldRect.location(); if (childOffset.width() || childOffset.height()) { view()->addLayoutDelta(childOffset); @@ -2967,8 +2967,11 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div). LayoutPoint scrolledOffset = paintOffset; - if (hasOverflowClip()) + if (hasOverflowClip()) { scrolledOffset.move(-scrolledContentOffset()); + if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + scrolledOffset.move(verticalScrollbarWidth(), 0); + } // 2. paint contents if (paintPhase != PaintPhaseSelfOutline) { @@ -3835,7 +3838,7 @@ bool RenderBlock::positionNewFloats() RenderBox* childBox = floatingObject->renderer(); LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ? marginStartForChild(childBox) : marginEndForChild(childBox); - LayoutRect oldRect(childBox->x(), childBox->y() , childBox->width(), childBox->height()); + LayoutRect oldRect = childBox->frameRect(); if (childBox->style()->clear() & CLEFT) logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatLeft), logicalTop); @@ -5616,6 +5619,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths() InlineMinMaxIterator childIterator(this); bool addedTextIndent = false; // Only gets added in once. + LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw, view()); RenderObject* prevFloat = 0; while (RenderObject* child = childIterator.next()) { autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : @@ -5719,14 +5723,18 @@ void RenderBlock::computeInlinePreferredLogicalWidths() // Add in text-indent. This is added in only once. LayoutUnit ti = 0; if (!addedTextIndent) { - addedTextIndent = true; - ti = minimumValueForLength(styleToUse->textIndent(), cw, view()); + ti = textIndent; childMin += ti; childMax += ti; + + if (childMin < 0) + textIndent = childMin; + else + addedTextIndent = true; } // Add our width to the max. - inlineMax += childMax; + inlineMax += max<float>(0, childMax); if (!autoWrap || !canBreakReplacedElement) { if (child->isFloating()) @@ -5790,10 +5798,14 @@ void RenderBlock::computeInlinePreferredLogicalWidths() // Add in text-indent. This is added in only once. LayoutUnit ti = 0; if (!addedTextIndent) { - addedTextIndent = true; - ti = minimumValueForLength(styleToUse->textIndent(), cw, view()); + ti = textIndent; childMin+=ti; beginMin += ti; childMax+=ti; beginMax += ti; + + if (childMin < 0) + textIndent = childMin; + else + addedTextIndent = true; } // If we have no breakable characters at all, @@ -5831,8 +5843,9 @@ void RenderBlock::computeInlinePreferredLogicalWidths() updatePreferredWidth(m_maxPreferredLogicalWidth, inlineMax); updatePreferredWidth(m_maxPreferredLogicalWidth, childMax); inlineMax = endMax; + addedTextIndent = true; } else - inlineMax += childMax; + inlineMax += max<float>(0, childMax); } // Ignore spaces after a list marker. @@ -5844,6 +5857,7 @@ void RenderBlock::computeInlinePreferredLogicalWidths() inlineMin = inlineMax = 0; stripFrontSpaces = true; trailingSpaceChild = 0; + addedTextIndent = true; } oldAutoWrap = autoWrap; diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 71416a103..6951c2624 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -806,7 +806,6 @@ private: virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0); - void adjustPointToColumnContents(LayoutPoint&) const; void adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const; // Helper function for borderFitAdjust void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBottom, RootInlineBox* highest = 0); @@ -964,6 +963,8 @@ protected: void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset); // Computes a deltaOffset value that put a line at the top of the next page if it doesn't fit on the current page. LayoutUnit adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox* child, bool atBeforeSideOfBlock); + void adjustPointToColumnContents(LayoutPoint&) const; + // This function is called to test a line box that has moved in the block direction to see if it has ended up in a new // region/page/column that has a different available line width than the old one. Used to know when you have to dirty a // line, i.e., that it can't be re-used. diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 131ebcaf6..d2de4b8a9 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -1604,19 +1604,16 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La o->computeRectForRepaint(repaintContainer, rect, fixed); } -void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& rect) +void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect) { - LayoutUnit newX = x(); - LayoutUnit newY = y(); - LayoutUnit newWidth = width(); - LayoutUnit newHeight = height(); - if (rect.x() != newX || rect.y() != newY) { + if (oldRect.location() != m_frameRect.location()) { + LayoutRect newRect = m_frameRect; // The child moved. Invalidate the object's old and new positions. We have to do this // since the object may not have gotten a layout. - m_frameRect = rect; + m_frameRect = oldRect; repaint(); repaintOverhangingFloats(true); - m_frameRect = LayoutRect(newX, newY, newWidth, newHeight); + m_frameRect = newRect; repaint(); repaintOverhangingFloats(true); } @@ -2126,12 +2123,11 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) result = cb->overrideLogicalContentHeight(); includeBorderPadding = true; } - } - // Otherwise we only use our percentage height if our containing block had a specified - // height. - else if (cbstyle->logicalHeight().isFixed()) - result = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value()); - else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { + } else if (cbstyle->logicalHeight().isFixed()) { + // Otherwise we only use our percentage height if our containing block had a specified height. + LayoutUnit contentBoxHeightWithScrollbar = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value()); + result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); + } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { // We need to recur and compute the percentage height for our containing block. result = cb->computePercentageLogicalHeight(cbstyle->logicalHeight()); if (result != -1) @@ -2268,7 +2264,10 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType sizeType, Lengt cb = cb->containingBlock(); } } - return computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight)); + availableHeight = computeContentBoxLogicalHeight(valueForLength(logicalHeight, availableHeight)); + if (cb->style()->logicalHeight().isFixed()) + availableHeight = max<LayoutUnit>(0, availableHeight - toRenderBox(cb)->scrollbarLogicalHeight()); + return availableHeight; } case ViewportPercentageWidth: case ViewportPercentageHeight: @@ -2366,8 +2365,10 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo if (isWritingModeRoot()) { LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop(); RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); - cbRegion = cb->clampToStartAndEndRegions(cbRegion); - boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + if (cbRegion) { + cbRegion = cb->clampToStartAndEndRegions(cbRegion); + boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + } } } else if (region && enclosingRenderFlowThread()->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode()) { RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region); @@ -2629,11 +2630,13 @@ void RenderBox::computePositionedLogicalWidth(RenderRegion* region, LayoutUnit o const RenderBlock* cb = toRenderBlock(containerBlock); LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop(); RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); - cbRegion = cb->clampToStartAndEndRegions(cbRegion); - RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); - if (boxInfo) { - logicalLeftPos += boxInfo->logicalLeft(); - setLogicalLeft(logicalLeftPos); + if (cbRegion) { + cbRegion = cb->clampToStartAndEndRegions(cbRegion); + RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + if (boxInfo) { + logicalLeftPos += boxInfo->logicalLeft(); + setLogicalLeft(logicalLeftPos); + } } } } @@ -2951,11 +2954,13 @@ void RenderBox::computePositionedLogicalHeight() const RenderBlock* cb = toRenderBlock(containerBlock); LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage() - logicalLeft(); RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); - cbRegion = cb->clampToStartAndEndRegions(cbRegion); - RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); - if (boxInfo) { - logicalTopPos += boxInfo->logicalLeft(); - setLogicalTop(logicalTopPos); + if (cbRegion) { + cbRegion = cb->clampToStartAndEndRegions(cbRegion); + RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset); + if (boxInfo) { + logicalTopPos += boxInfo->logicalLeft(); + setLogicalTop(logicalTopPos); + } } } } @@ -3412,7 +3417,7 @@ LayoutRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit // FIXME: Paint the carets inside empty blocks differently than the carets before/after elements. // FIXME: What about border and padding? - LayoutRect rect(x(), y(), caretWidth, height()); + LayoutRect rect(location(), LayoutSize(caretWidth, height())); bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection(); if ((!caretOffset) ^ ltr) @@ -3939,6 +3944,8 @@ LayoutSize RenderBox::topLeftLocationOffset() const return locationOffset(); LayoutRect rect(frameRect()); + if (containerBlock->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + rect.move(containerBlock->verticalScrollbarWidth(), 0); containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are an absolutely positioned object enclosed by a relative-positioned inline. return LayoutSize(rect.x(), rect.y()); } @@ -3961,9 +3968,11 @@ static void markBoxForRelayoutAfterSplit(RenderBox* box) { // FIXME: The table code should handle that automatically. If not, // we should fix it and remove the table part checks. - if (box->isTable()) - toRenderTable(box)->setNeedsSectionRecalc(); - else if (box->isTableSection()) + if (box->isTable()) { + // Because we may have added some sections with already computed column structures, we need to + // sync the table structure with them now. This avoids crashes when adding new cells to the table. + toRenderTable(box)->forceSectionsRecalc(); + } else if (box->isTableSection()) toRenderTableSection(box)->setNeedsCellRecalc(); box->setNeedsLayoutAndPrefWidthsRecalc(); diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 488c58405..43a8ebc50 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -197,7 +197,7 @@ public: // More IE extensions. clientWidth and clientHeight represent the interior of an object // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth. - LayoutUnit clientLeft() const { return borderLeft(); } + LayoutUnit clientLeft() const { return borderLeft() + (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0); } LayoutUnit clientTop() const { return borderTop(); } LayoutUnit clientWidth() const; LayoutUnit clientHeight() const; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 8f9b9a622..5eef3ccac 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -1171,13 +1171,11 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil // its margins. Since those were added in already, we have to factor them out when computing // the background positioning area. if (isRoot()) { - positioningAreaSize = IntSize(snapSizeToPixel(toRenderBox(this)->width() - left - right, toRenderBox(this)->x()), - snapSizeToPixel(toRenderBox(this)->height() - top - bottom, toRenderBox(this)->y())); + positioningAreaSize = pixelSnappedIntSize(toRenderBox(this)->size() - LayoutSize(left + right, top + bottom), toRenderBox(this)->location()); left += marginLeft(); top += marginTop(); } else - positioningAreaSize = IntSize(snapSizeToPixel(paintRect.width() - left - right, paintRect.x()), - snapSizeToPixel(paintRect.height() - top - bottom, paintRect.y())); + positioningAreaSize = pixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location()); } else { geometry.setDestRect(pixelSnappedIntRect(viewRect())); positioningAreaSize = geometry.destRect().size(); @@ -1410,7 +1408,7 @@ public: } bool hasVisibleColorAndStyle() const { return style > BHIDDEN && !isTransparent; } - bool shouldRender() const { return isPresent && hasVisibleColorAndStyle(); } + bool shouldRender() const { return isPresent && width && hasVisibleColorAndStyle(); } bool presentButInvisible() const { return usedWidth() && !hasVisibleColorAndStyle(); } bool obscuresBackgroundEdge(float scale) const { @@ -1648,6 +1646,7 @@ void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor) { const BorderEdge& edgeToRender = edges[side]; + ASSERT(edgeToRender.width); const BorderEdge& adjacentEdge1 = edges[adjacentSide1]; const BorderEdge& adjacentEdge2 = edges[adjacentSide2]; diff --git a/Source/WebCore/rendering/RenderDetailsMarker.cpp b/Source/WebCore/rendering/RenderDetailsMarker.cpp index c36cdd588..01b234876 100644 --- a/Source/WebCore/rendering/RenderDetailsMarker.cpp +++ b/Source/WebCore/rendering/RenderDetailsMarker.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "RenderDetailsMarker.h" -#if ENABLE(DETAILS) || ENABLE(CALENDAR_PICKER) - +#if ENABLE(DETAILS_ELEMENT) || ENABLE(CALENDAR_PICKER) #include "Element.h" #include "GraphicsContext.h" #include "HTMLNames.h" diff --git a/Source/WebCore/rendering/RenderDetailsMarker.h b/Source/WebCore/rendering/RenderDetailsMarker.h index 76e2b28e4..ac93be868 100644 --- a/Source/WebCore/rendering/RenderDetailsMarker.h +++ b/Source/WebCore/rendering/RenderDetailsMarker.h @@ -21,8 +21,7 @@ #ifndef RenderDetailsMarker_h #define RenderDetailsMarker_h -#if ENABLE(DETAILS) || ENABLE(CALENDAR_PICKER) - +#if ENABLE(DETAILS_ELEMENT) || ENABLE(CALENDAR_PICKER) #include "RenderBlock.h" namespace WebCore { diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp index 3feb57c54..48ea05470 100644 --- a/Source/WebCore/rendering/RenderImage.cpp +++ b/Source/WebCore/rendering/RenderImage.cpp @@ -507,7 +507,7 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu if (HTMLMapElement* map = imageMap()) { LayoutRect contentBox = contentBoxRect(); float scaleFactor = 1 / style()->effectiveZoom(); - LayoutPoint mapLocation = pointInContainer.point() - toLayoutSize(accumulatedOffset) - LayoutSize(this->x(), this->y()) - toLayoutSize(contentBox.location()); + LayoutPoint mapLocation = pointInContainer.point() - toLayoutSize(accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location()); mapLocation.scale(scaleFactor, scaleFactor); if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult)) diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 104c56f5d..7985268c5 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -302,7 +302,8 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb if (!beforeChild && isAfterContent(lastChild())) beforeChild = lastChild(); - if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) { + // We don't split table parts as they will be wrapped in an anonymous inline table. + if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isTablePart()) { // We are placing a block inside an inline. We have to perform a split of this // inline into continuations. This involves creating an anonymous block box to hold // |newChild|. We then make that block box a continuation of this inline. We take all of @@ -1135,9 +1136,11 @@ void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b if (!o) return; - if (applyContainerFlip && o->isBox() && o->style()->isFlippedBlocksWritingMode()) { - IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); - transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint); + if (applyContainerFlip && o->isBox()) { + if (o->style()->isFlippedBlocksWritingMode()) { + IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()); + transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint); + } applyContainerFlip = DoNotApplyContainerFlip; } @@ -1228,7 +1231,7 @@ void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint& // Get our containing block. RenderBox* block = containingBlock(); - localPoint.move(block->x() - firstBlock->x(), block->y() - firstBlock->y()); + localPoint.moveBy(block->location() - firstBlock->locationOffset()); } result.setInnerNode(n); @@ -1366,7 +1369,7 @@ void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& if (curr->hasLayer()) pos = curr->localToAbsolute(); else if (curr->isBox()) - pos.move(toRenderBox(curr)->x(), toRenderBox(curr)->y()); + pos.move(toRenderBox(curr)->locationOffset()); curr->addFocusRingRects(rects, flooredIntPoint(pos)); } } diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index b9dc5d7c7..a863a4c90 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -845,6 +845,7 @@ private: enum IndirectCompositingReason { NoIndirectCompositingReason, + IndirectCompositingForStacking, IndirectCompositingForOverlap, IndirectCompositingForBackgroundLayer, IndirectCompositingForGraphicalEffect, // opacity, mask, filter, transform etc. diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 47450191a..b2940d050 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -730,7 +730,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor // Clear the flag layer->setHasCompositingDescendant(false); - bool mustOverlapCompositedLayers = compositingState.m_subtreeIsCompositing; + RenderLayer::IndirectCompositingReason compositingReason = compositingState.m_subtreeIsCompositing ? RenderLayer::IndirectCompositingForStacking : RenderLayer::NoIndirectCompositingReason; bool haveComputedBounds = false; IntRect absBounds; @@ -742,10 +742,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor if (absBounds.isEmpty()) absBounds.setSize(IntSize(1, 1)); haveComputedBounds = true; - mustOverlapCompositedLayers = overlapMap->overlapsLayers(absBounds); + compositingReason = overlapMap->overlapsLayers(absBounds) ? RenderLayer::IndirectCompositingForOverlap : RenderLayer::NoIndirectCompositingReason; } - layer->setIndirectCompositingReason(mustOverlapCompositedLayers ? RenderLayer::IndirectCompositingForOverlap : RenderLayer::NoIndirectCompositingReason); + layer->setIndirectCompositingReason(compositingReason); // The children of this layer don't need to composite, unless there is // a compositing layer among them, so start by inheriting the compositing @@ -762,11 +762,6 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor if (overlapMap) overlapMap->pushCompositingContainer(); - - if (layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) { - // If we have a 3D transform, or are animating transform, then turn overlap testing off. - childState.m_testingOverlap = false; - } } #if ENABLE(VIDEO) @@ -852,15 +847,15 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ASSERT(willBeComposited == needsToBeComposited(layer)); if (layer->reflectionLayer()) { // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another renderer? - layer->reflectionLayer()->setIndirectCompositingReason(willBeComposited ? RenderLayer::IndirectCompositingForOverlap : RenderLayer::NoIndirectCompositingReason); + layer->reflectionLayer()->setIndirectCompositingReason(willBeComposited ? RenderLayer::IndirectCompositingForStacking : RenderLayer::NoIndirectCompositingReason); } // Subsequent layers in the parent stacking context also need to composite. if (childState.m_subtreeIsCompositing) compositingState.m_subtreeIsCompositing = true; - // We have to keep overlap testing disabled for later layers. - if (!childState.m_testingOverlap) + // Turn overlap testing off for later layers if it's already off, or if we have a 3D transform or an animating transform. + if (!childState.m_testingOverlap || layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer())) compositingState.m_testingOverlap = false; // Set the flag to say that this SC has compositing children. @@ -1488,6 +1483,7 @@ bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co if (layer->mustCompositeForIndirectReasons()) { RenderLayer::IndirectCompositingReason reason = layer->indirectCompositingReason(); return reason == RenderLayer::IndirectCompositingForOverlap + || reason == RenderLayer::IndirectCompositingForStacking || reason == RenderLayer::IndirectCompositingForBackgroundLayer || reason == RenderLayer::IndirectCompositingForGraphicalEffect || reason == RenderLayer::IndirectCompositingForPreserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect. @@ -1534,9 +1530,11 @@ const char* RenderLayerCompositor::reasonForCompositing(const RenderLayer* layer if (requiresCompositingForPosition(renderer, layer)) return "position: fixed"; - // This includes layers made composited by requiresCompositingWhenDescendantsAreCompositing(). + if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForStacking) + return "stacking"; + if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForOverlap) - return "overlap/stacking"; + return "overlap"; if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForBackgroundLayer) return "negative z-index children"; diff --git a/Source/WebCore/rendering/RenderMeter.cpp b/Source/WebCore/rendering/RenderMeter.cpp index 5540a1942..93b01720f 100644 --- a/Source/WebCore/rendering/RenderMeter.cpp +++ b/Source/WebCore/rendering/RenderMeter.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(METER_TAG) - #include "RenderMeter.h" +#if ENABLE(METER_ELEMENT) #include "HTMLMeterElement.h" #include "HTMLNames.h" #include "RenderTheme.h" diff --git a/Source/WebCore/rendering/RenderMeter.h b/Source/WebCore/rendering/RenderMeter.h index c4deb12b2..7306caea4 100644 --- a/Source/WebCore/rendering/RenderMeter.h +++ b/Source/WebCore/rendering/RenderMeter.h @@ -21,7 +21,7 @@ #ifndef RenderMeter_h #define RenderMeter_h -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "RenderBlock.h" #include "RenderWidget.h" diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 6cdb4b2f9..893e45159 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -836,6 +836,11 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, { int width = (side == BSTop || side == BSBottom ? y2 - y1 : x2 - x1); + // FIXME: We really would like this check to be an ASSERT as we don't want to draw 0px borders. However + // nothing guarantees that the following recursive calls to drawLineForBoxSide will have non-null width. + if (!width) + return; + if (style == DOUBLE && width < 3) style = SOLID; @@ -1988,7 +1993,7 @@ FloatPoint RenderObject::absoluteToLocal(const FloatPoint& containerPoint, bool return transformState.lastPlanarPoint(); } -void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const +void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot applyContainerFlip, bool* wasFixed) const { if (repaintContainer == this) return; @@ -1999,8 +2004,11 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called. LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); - if (o->isBox() && o->style()->isFlippedBlocksWritingMode()) - transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); + if (applyContainerFlip && o->isBox()) { + if (o->style()->isFlippedBlocksWritingMode()) + transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); + applyContainerFlip = DoNotApplyContainerFlip; + } LayoutSize columnOffset; o->adjustForColumns(columnOffset, roundedLayoutPoint(transformState.mappedPoint())); @@ -2010,7 +2018,7 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b if (o->hasOverflowClip()) transformState.move(-toRenderBox(o)->scrolledContentOffset()); - o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed); + o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, applyContainerFlip, wasFixed); } const RenderObject* RenderObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 60c56909c..7b894feab 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -303,7 +303,7 @@ public: virtual bool isCounter() const { return false; } virtual bool isQuote() const { return false; } -#if ENABLE(DETAILS) +#if ENABLE(DETAILS_ELEMENT) virtual bool isDetailsMarker() const { return false; } #endif virtual bool isEmbeddedObject() const { return false; } @@ -318,10 +318,10 @@ public: virtual bool isListMarker() const { return false; } virtual bool isMedia() const { return false; } virtual bool isMenuList() const { return false; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual bool isMeter() const { return false; } #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual bool isProgress() const { return false; } #endif virtual bool isRenderBlock() const { return false; } diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp index aa1ab8fdc..da98088e2 100644 --- a/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -214,8 +214,10 @@ void RenderObjectChildList::appendChildNode(RenderObject* owner, RenderObject* n containerFlowThread->addFlowChild(newChild); } - RenderCounter::rendererSubtreeAttached(newChild); - RenderQuote::rendererSubtreeAttached(newChild); + if (!owner->documentBeingDestroyed()) { + RenderCounter::rendererSubtreeAttached(newChild); + RenderQuote::rendererSubtreeAttached(newChild); + } newChild->setNeedsLayoutAndPrefWidthsRecalc(); // Goes up the containing block hierarchy. if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. @@ -281,8 +283,10 @@ void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* c containerFlowThread->addFlowChild(child, beforeChild); } - RenderCounter::rendererSubtreeAttached(child); - RenderQuote::rendererSubtreeAttached(child); + if (!owner->documentBeingDestroyed()) { + RenderCounter::rendererSubtreeAttached(child); + RenderQuote::rendererSubtreeAttached(child); + } child->setNeedsLayoutAndPrefWidthsRecalc(); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. diff --git a/Source/WebCore/rendering/RenderProgress.cpp b/Source/WebCore/rendering/RenderProgress.cpp index 498141a97..d004506a3 100644 --- a/Source/WebCore/rendering/RenderProgress.cpp +++ b/Source/WebCore/rendering/RenderProgress.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(PROGRESS_TAG) - #include "RenderProgress.h" +#if ENABLE(PROGRESS_ELEMENT) #include "HTMLNames.h" #include "HTMLProgressElement.h" #include "PaintInfo.h" diff --git a/Source/WebCore/rendering/RenderProgress.h b/Source/WebCore/rendering/RenderProgress.h index fa92bb20b..96921bdb4 100644 --- a/Source/WebCore/rendering/RenderProgress.h +++ b/Source/WebCore/rendering/RenderProgress.h @@ -21,7 +21,7 @@ #ifndef RenderProgress_h #define RenderProgress_h -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) #include "RenderBlock.h" namespace WebCore { diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index 9938dffb0..11b2b0f77 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -144,13 +144,22 @@ bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& res void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderReplaced::styleDidChange(diff, oldStyle); + + // If the region is not attached to any thread, there is no need to check + // whether the region has region styling since no content will be displayed + // into the region. + if (!m_flowThread) { + setHasCustomRegionStyle(false); + return; + } + bool customRegionStyle = false; if (node()) { Element* regionElement = static_cast<Element*>(node()); customRegionStyle = view()->document()->styleResolver()->checkRegionStyle(regionElement); } setHasCustomRegionStyle(customRegionStyle); - flowThread()->checkRegionsWithStyling(); + m_flowThread->checkRegionsWithStyling(); } void RenderRegion::layout() diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp index 2e0d7473b..18cdfc17e 100644 --- a/Source/WebCore/rendering/RenderReplaced.cpp +++ b/Source/WebCore/rendering/RenderReplaced.cpp @@ -269,8 +269,9 @@ static inline bool rendererHasAspectRatio(const RenderObject* renderer) return renderer->isImage() || renderer->isCanvas() || renderer->isVideo(); } -void RenderReplaced::computeIntrinsicRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const +void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const { + FloatSize intrinsicSize; if (contentRenderer) { contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); if (intrinsicRatio) @@ -280,16 +281,39 @@ void RenderReplaced::computeIntrinsicRatioInformationForRenderBox(RenderBox* con if (!isPercentageIntrinsicSize) intrinsicSize.scale(style()->effectiveZoom()); - if (intrinsicRatio && !isHorizontalWritingMode()) - intrinsicRatio = 1 / intrinsicRatio; - if (rendererHasAspectRatio(this) && isPercentageIntrinsicSize) intrinsicRatio = 1; - return; + + // Update our intrinsic size to match what the content renderer has computed, so that when we + // constrain the size below, the correct intrinsic size will be obtained for comparison against + // min and max widths. + if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty()) + m_intrinsicSize = flooredIntSize(intrinsicSize); // FIXME: This introduces precision errors. We should convert m_intrinsicSize to be a float. + + if (!isHorizontalWritingMode()) { + if (intrinsicRatio) + intrinsicRatio = 1 / intrinsicRatio; + intrinsicSize = intrinsicSize.transposedSize(); + } + } else { + computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); + if (intrinsicRatio) + ASSERT(!isPercentageIntrinsicSize); + } + + // Now constrain the intrinsic size along each axis according to minimum and maximum width/heights along the + // opposite axis. So for example a maximum width that shrinks our width will result in the height we compute here + // having to shrink in order to preserve the aspect ratio. Because we compute these values independently along + // each axis, the final returned size may in fact not preserve the aspect ratio. + // FIXME: In the long term, it might be better to just return this code more to the way it used to be before this + // function was added, since all it has done is make the code more unclear. + constrainedSize = intrinsicSize; + if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty() && style()->logicalWidth().isAuto() && style()->logicalHeight().isAuto()) { + // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests, like fast/images/zoomed-img-size.html, which + // can only be fixed once subpixel precision is available for things like intrinsicWidth/Height - which include zoom! + constrainedSize.setWidth(RenderBox::computeReplacedLogicalHeight() * intrinsicSize.width() / intrinsicSize.height()); + constrainedSize.setHeight(RenderBox::computeReplacedLogicalWidth() * intrinsicSize.height() / intrinsicSize.width()); } - computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); - if (intrinsicRatio) - ASSERT(!isPercentageIntrinsicSize); } void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const @@ -304,12 +328,6 @@ void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, return; intrinsicRatio = intrinsicSize.width() / intrinsicSize.height(); - if (style()->logicalWidth().isAuto() && style()->logicalHeight().isAuto()) { - // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests, like fast/images/zoomed-img-size.html, which - // can only be fixed once subpixel precision is available for things like intrinsicWidth/Height - which include zoom! - intrinsicSize.setWidth(RenderBox::computeReplacedLogicalHeight() * intrinsicLogicalWidth() / intrinsicLogicalHeight()); - intrinsicSize.setHeight(RenderBox::computeReplacedLogicalWidth() * intrinsicLogicalHeight() / intrinsicLogicalWidth()); - } } LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const @@ -322,19 +340,19 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) con // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width bool isPercentageIntrinsicSize = false; double intrinsicRatio = 0; - FloatSize intrinsicSize; - computeIntrinsicRatioInformationForRenderBox(contentRenderer, intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); + FloatSize constrainedSize; + computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio, isPercentageIntrinsicSize); // FIXME: Remove unnecessary round/roundToInt calls from this method when layout is off ints: webkit.org/b/63656 if (style()->logicalWidth().isAuto()) { bool heightIsAuto = style()->logicalHeight().isAuto(); - bool hasIntrinsicWidth = !isPercentageIntrinsicSize && intrinsicSize.width() > 0; + bool hasIntrinsicWidth = !isPercentageIntrinsicSize && constrainedSize.width() > 0; // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'. if (heightIsAuto && hasIntrinsicWidth) - return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(intrinsicSize.width()), includeMaxWidth); + return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(constrainedSize.width()), includeMaxWidth); - bool hasIntrinsicHeight = !isPercentageIntrinsicSize && intrinsicSize.height() > 0; + bool hasIntrinsicHeight = !isPercentageIntrinsicSize && constrainedSize.height() > 0; if (intrinsicRatio || isPercentageIntrinsicSize) { // If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio; // or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value @@ -361,14 +379,14 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) con LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), logicalWidth); logicalWidth = max(ZERO_LAYOUT_UNIT, logicalWidth - (marginStart + marginEnd + (width() - clientWidth()))); if (isPercentageIntrinsicSize) - logicalWidth = roundToInt(logicalWidth * intrinsicSize.width() / 100); + logicalWidth = roundToInt(logicalWidth * constrainedSize.width() / 100); return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, includeMaxWidth); } } // Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'. if (hasIntrinsicWidth) - return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(intrinsicSize.width()), includeMaxWidth); + return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(constrainedSize.width()), includeMaxWidth); // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too // wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead. @@ -391,16 +409,16 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height bool isPercentageIntrinsicSize = false; double intrinsicRatio = 0; - FloatSize intrinsicSize; - computeIntrinsicRatioInformationForRenderBox(contentRenderer, intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); + FloatSize constrainedSize; + computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio, isPercentageIntrinsicSize); // FIXME: Remove unnecessary round/roundToInt calls from this method when layout is off ints: webkit.org/b/63656 bool widthIsAuto = style()->logicalWidth().isAuto(); - bool hasIntrinsicHeight = !isPercentageIntrinsicSize && intrinsicSize.height() > 0; + bool hasIntrinsicHeight = !isPercentageIntrinsicSize && constrainedSize.height() > 0; // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'. if (widthIsAuto && hasIntrinsicHeight) - return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(intrinsicSize.height())); + return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(constrainedSize.height())); // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: // (used width) / (intrinsic ratio) @@ -409,7 +427,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'. if (hasIntrinsicHeight) - return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(intrinsicSize.height())); + return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(constrainedSize.height())); // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width. diff --git a/Source/WebCore/rendering/RenderReplaced.h b/Source/WebCore/rendering/RenderReplaced.h index 9ebc634b0..9d7814394 100644 --- a/Source/WebCore/rendering/RenderReplaced.h +++ b/Source/WebCore/rendering/RenderReplaced.h @@ -77,9 +77,9 @@ private: virtual bool canBeSelectionLeaf() const { return true; } virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); - void computeIntrinsicRatioInformationForRenderBox(RenderBox*, FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const; + void computeAspectRatioInformationForRenderBox(RenderBox*, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const; - IntSize m_intrinsicSize; + mutable IntSize m_intrinsicSize; }; } diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 3eac69200..9c115a037 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -768,6 +768,8 @@ RenderTableCol* RenderTable::colElement(unsigned col, bool* startEdge, bool* end void RenderTable::recalcSections() const { + ASSERT(m_needsSectionRecalc); + m_head = 0; m_foot = 0; m_firstBody = 0; @@ -1294,7 +1296,9 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu RenderTable* RenderTable::createAnonymousWithParentRenderer(const RenderObject* parent) { - RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), TABLE); + // CSS 2.1, section 17.2.1: "If a proper table child's parent is an 'inline' box, then the generated anonymous table must be an 'inline-table' box". + EDisplay tableDisplay = parent->isInline() ? INLINE_TABLE : TABLE; + RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), tableDisplay); RenderTable* newTable = new (parent->renderArena()) RenderTable(parent->document() /* is anonymous */); newTable->setStyle(newStyle.release()); return newTable; diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h index b6d25069f..87418f068 100644 --- a/Source/WebCore/rendering/RenderTable.h +++ b/Source/WebCore/rendering/RenderTable.h @@ -135,6 +135,12 @@ public: unsigned span; }; + void forceSectionsRecalc() + { + setNeedsSectionRecalc(); + recalcSections(); + } + Vector<ColumnStruct>& columns() { return m_columns; } Vector<int>& columnPositions() { return m_columnPos; } RenderTableSection* header() const { return m_head; } diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp index 159b54b3b..3f304e284 100644 --- a/Source/WebCore/rendering/RenderTableCell.cpp +++ b/Source/WebCore/rendering/RenderTableCell.cpp @@ -245,7 +245,7 @@ LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoi LayoutSize offset = RenderBlock::offsetFromContainer(o, point, offsetDependsOnPoint); if (parent()) - offset.expand(-parentBox()->x(), -parentBox()->y()); + offset -= parentBox()->locationOffset(); return offset; } diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 70161c779..955ef9ade 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -657,7 +657,7 @@ void RenderTableSection::layoutRows() cell->setIntrinsicPaddingBefore(intrinsicPaddingBefore); cell->setIntrinsicPaddingAfter(intrinsicPaddingAfter); - LayoutRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height()); + LayoutRect oldCellRect = cell->frameRect(); setLogicalPositionForCell(cell, c); @@ -1469,7 +1469,7 @@ RenderTableSection* RenderTableSection::createAnonymousWithParentRenderer(const void RenderTableSection::setLogicalPositionForCell(RenderTableCell* cell, unsigned effectiveColumn) const { - LayoutPoint oldCellLocation(cell->x(), cell->y()); + LayoutPoint oldCellLocation = cell->location(); LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]); int horizontalBorderSpacing = table()->hBorderSpacing(); diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index e68b893eb..f89673237 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -44,7 +44,7 @@ #include "StringTruncator.h" #include "TextControlInnerElements.h" -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "HTMLMeterElement.h" #include "RenderMeter.h" #endif @@ -53,6 +53,14 @@ #include "RenderInputSpeech.h" #endif +#if ENABLE(DATALIST_ELEMENT) +#include "ElementShadow.h" +#include "HTMLCollection.h" +#include "HTMLDataListElement.h" +#include "HTMLOptionElement.h" +#include "HTMLParserIdioms.h" +#endif + // The methods in this file are shared by all themes on every platform. namespace WebCore { @@ -229,11 +237,11 @@ void RenderTheme::adjustStyle(StyleResolver* styleResolver, RenderStyle* style, return adjustSearchFieldResultsDecorationStyle(styleResolver, style, e); case SearchFieldResultsButtonPart: return adjustSearchFieldResultsButtonStyle(styleResolver, style, e); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: return adjustProgressBarStyle(styleResolver, style, e); #endif -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: @@ -298,7 +306,7 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe #endif case MenulistPart: return paintMenuList(o, paintInfo, r); -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: @@ -306,7 +314,7 @@ bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRe case RatingLevelIndicatorPart: return paintMeter(o, paintInfo, r); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: return paintProgressBar(o, paintInfo, r); #endif @@ -403,14 +411,14 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, c case DefaultButtonPart: case ButtonPart: case MenulistPart: -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: case DiscreteCapacityLevelIndicatorPart: case RatingLevelIndicatorPart: #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: #endif case SliderHorizontalPart: @@ -450,14 +458,14 @@ bool RenderTheme::paintDecorations(RenderObject* o, const PaintInfo& paintInfo, case DefaultButtonPart: case ButtonPart: case MenulistPart: -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) case MeterPart: case RelevancyLevelIndicatorPart: case ContinuousCapacityLevelIndicatorPart: case DiscreteCapacityLevelIndicatorPart: case RatingLevelIndicatorPart: #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) case ProgressBarPart: #endif case SliderHorizontalPart: @@ -929,7 +937,7 @@ bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintI } #endif -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) void RenderTheme::adjustMeterStyle(StyleResolver*, RenderStyle* style, Element*) const { style->setBoxShadow(nullptr); @@ -952,7 +960,81 @@ bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(DATALIST_ELEMENT) +void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect) +{ + Node* node = o->node(); + if (!node) + return; + + HTMLInputElement* input = node->toInputElement(); + if (!input) + return; + + HTMLDataListElement* dataList = static_cast<HTMLDataListElement*>(input->list()); + if (!dataList) + return; + + double min = input->minimum(); + double max = input->maximum(); + ControlPart part = o->style()->appearance(); + // We don't support ticks on alternate sliders like MediaVolumeSliders. + if (part != SliderHorizontalPart && part != SliderVerticalPart) + return; + bool isHorizontal = part == SliderHorizontalPart; + + IntSize thumbSize; + RenderObject* thumbRenderer = input->sliderThumbElement()->renderer(); + if (thumbRenderer) { + RenderStyle* thumbStyle = thumbRenderer->style(); + int thumbWidth = thumbStyle->width().intValue(); + int thumbHeight = thumbStyle->height().intValue(); + thumbSize.setWidth(isHorizontal ? thumbWidth : thumbHeight); + thumbSize.setHeight(isHorizontal ? thumbHeight : thumbWidth); + } + + IntSize tickSize = sliderTickSize(); + float zoomFactor = o->style()->effectiveZoom(); + FloatRect tickRect; + int tickRegionMargin = (thumbSize.width() - tickSize.width()) / 2.0; + int tickRegionSideMargin = 0; + int tickRegionWidth = 0; + if (isHorizontal) { + tickRect.setWidth(floor(tickSize.width() * zoomFactor)); + tickRect.setHeight(floor(tickSize.height() * zoomFactor)); + tickRect.setY(floor(rect.y() + rect.height() / 2.0 + sliderTickOffsetFromTrackCenter() * zoomFactor)); + tickRegionSideMargin = rect.x() + tickRegionMargin; + tickRegionWidth = rect.width() - tickRegionMargin * 2 - tickSize.width() * zoomFactor; + } else { + tickRect.setWidth(floor(tickSize.height() * zoomFactor)); + tickRect.setHeight(floor(tickSize.width() * zoomFactor)); + tickRect.setX(floor(rect.x() + rect.width() / 2.0 + sliderTickOffsetFromTrackCenter() * zoomFactor)); + tickRegionSideMargin = rect.y() + tickRegionMargin; + tickRegionWidth = rect.height() - tickRegionMargin * 2 - tickSize.width() * zoomFactor; + } + RefPtr<HTMLCollection> options = dataList->options(); + GraphicsContextStateSaver stateSaver(*paintInfo.context); + paintInfo.context->setFillColor(o->style()->visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB); + for (unsigned i = 0; Node* node = options->item(i); i++) { + ASSERT(node->hasTagName(optionTag)); + HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(node); + String value = optionElement->value(); + if (!input->isValidValue(value)) + continue; + double parsedValue = parseToDoubleForNumberType(input->sanitizeValue(value)); + double tickPosition = (parsedValue - min) / (max - min); + if (!o->style()->isLeftToRightDirection()) + tickPosition = 1.0 - tickPosition; + if (isHorizontal) + tickRect.setX(floor(tickRegionSideMargin + tickRegionWidth * tickPosition)); + else + tickRect.setY(floor(tickRegionSideMargin + tickRegionWidth * tickPosition)); + paintInfo.context->fillRect(tickRect); + } +} +#endif + +#if ENABLE(PROGRESS_ELEMENT) double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const { return 0; diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h index 5e56b6df5..629834bc8 100644 --- a/Source/WebCore/rendering/RenderTheme.h +++ b/Source/WebCore/rendering/RenderTheme.h @@ -40,10 +40,10 @@ class FileList; class HTMLInputElement; class PopupMenu; class RenderMenuList; -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) class RenderMeter; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) class RenderProgress; #endif class CSSStyleSheet; @@ -185,7 +185,7 @@ public: // Method for painting the caps lock indicator virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; }; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; // Returns the duration of the animation for the progress bar. @@ -209,11 +209,20 @@ public: virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; #endif -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; virtual bool supportsMeter(ControlPart) const; #endif - + +#if ENABLE(DATALIST_ELEMENT) + // Returns size of one slider tick mark for a horizontal track. + // For vertical tracks we rotate it and use it. i.e. Width is always length along the track. + virtual IntSize sliderTickSize() const = 0; + // Returns the distance of slider tick origin from the slider track center. + virtual int sliderTickOffsetFromTrackCenter() const = 0; + void paintSliderTicks(RenderObject*, const PaintInfo&, const IntRect&); +#endif + virtual bool shouldShowPlaceholderWhenFocused() const { return false; } virtual bool shouldHaveSpinButton(HTMLInputElement*) const; @@ -270,12 +279,12 @@ protected: virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual void adjustMeterStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&) { return true; } #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp b/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp index 5739c50b4..368c2b566 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumCommon.cpp @@ -32,9 +32,10 @@ namespace WebCore { bool RenderThemeChromiumCommon::supportsDataListUI(const AtomicString& type) { - // FIXME: We still need to support email, datetime, date, month, week, time, datetime-local, range, color. + // FIXME: We still need to support datetime, date, month, week, time, datetime-local, color. return type == InputTypeNames::text() || type == InputTypeNames::search() || type == InputTypeNames::url() - || type == InputTypeNames::telephone() || type == InputTypeNames::email() || type == InputTypeNames::number(); + || type == InputTypeNames::telephone() || type == InputTypeNames::email() || type == InputTypeNames::number() + || type == InputTypeNames::range(); } } diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp index 6b7f158ee..f25d4903a 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -146,6 +146,18 @@ Color RenderThemeChromiumLinux::platformInactiveSelectionForegroundColor() const return m_inactiveSelectionForegroundColor; } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeChromiumLinux::sliderTickSize() const +{ + return IntSize(1, 6); +} + +int RenderThemeChromiumLinux::sliderTickOffsetFromTrackCenter() const +{ + return -16; +} +#endif + void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderStyle* style, Element* element) const { IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartSliderThumb); @@ -292,6 +304,11 @@ bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart; PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams); + +#if ENABLE(DATALIST_ELEMENT) + paintSliderTicks(o, i, rect); +#endif + return false; } @@ -323,7 +340,7 @@ bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const Paint return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect) { diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.h b/Source/WebCore/rendering/RenderThemeChromiumLinux.h index d75408251..3e23f5b83 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.h +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.h @@ -54,6 +54,10 @@ namespace WebCore { virtual Color platformActiveSelectionForegroundColor() const; virtual Color platformInactiveSelectionForegroundColor() const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; static void setCaretBlinkInterval(double interval); @@ -76,7 +80,7 @@ namespace WebCore { virtual bool popsMenuBySpaceOrReturn() const OVERRIDE { return true; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp index c88066616..3f0e907e2 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -588,7 +588,7 @@ bool RenderThemeChromiumSkia::shouldShowPlaceholderWhenFocused() const return true; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // // Following values are come from default of GTK+ diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.h b/Source/WebCore/rendering/RenderThemeChromiumSkia.h index 745873052..ca1c2ed2e 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.h @@ -116,7 +116,7 @@ class RenderThemeChromiumSkia : public RenderTheme { virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; #endif @@ -154,7 +154,7 @@ class RenderThemeChromiumSkia : public RenderTheme { static void setSizeIfAuto(RenderStyle*, const IntSize&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect progressValueRectFor(RenderProgress*, const IntRect&) const; diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp index e2c41d9dd..c00e46e06 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -391,6 +391,18 @@ Color RenderThemeChromiumWin::systemColor(int cssValueId) const return Color(GetRValue(color), GetGValue(color), GetBValue(color)); } +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeChromiumWin::sliderTickSize() const +{ + return IntSize(1, 3); +} + +int RenderThemeChromiumWin::sliderTickOffsetFromTrackCenter() const +{ + return 11; +} +#endif + void RenderThemeChromiumWin::adjustSliderThumbSize(RenderStyle* style, Element* element) const { // These sizes match what WinXP draws for various menus. @@ -443,12 +455,26 @@ bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const PaintInfo& themeData.m_state, themeData.m_classicState, painter.drawRect()); + +#if ENABLE(DATALIST_ELEMENT) + paintSliderTicks(o, i, r); +#endif + return false; } bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r) { - return paintSliderTrack(o, i, r); + const ThemeData& themeData = getThemeData(o); + + ThemePainter painter(i.context, r); + PlatformSupport::paintTrackbar(painter.context(), + themeData.m_part, + themeData.m_state, + themeData.m_classicState, + painter.drawRect()); + + return false; } static int menuListButtonWidth() @@ -742,7 +768,7 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa return false; } -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // MSDN says that update intervals for the bar is 30ms. // http://msdn.microsoft.com/en-us/library/bb760842(v=VS.85).aspx diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.h b/Source/WebCore/rendering/RenderThemeChromiumWin.h index ad9eace89..14134c560 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.h +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.h @@ -61,6 +61,10 @@ namespace WebCore { virtual void systemFont(int propId, FontDescription&) const; virtual Color systemColor(int cssValueId) const; +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; // Various paint functions. @@ -89,7 +93,7 @@ namespace WebCore { virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&); -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; diff --git a/Source/WebCore/rendering/RenderThemeMac.h b/Source/WebCore/rendering/RenderThemeMac.h index 2f5f80e8c..7ad49bd34 100644 --- a/Source/WebCore/rendering/RenderThemeMac.h +++ b/Source/WebCore/rendering/RenderThemeMac.h @@ -68,7 +68,12 @@ public: virtual int minimumMenuListSize(RenderStyle*) const; virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; - + +#if ENABLE(DATALIST_ELEMENT) + virtual IntSize sliderTickSize() const OVERRIDE; + virtual int sliderTickOffsetFromTrackCenter() const OVERRIDE; +#endif + virtual int popupInternalPaddingLeft(RenderStyle*) const; virtual int popupInternalPaddingRight(RenderStyle*) const; virtual int popupInternalPaddingTop(RenderStyle*) const; @@ -78,13 +83,13 @@ public: virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const OVERRIDE; virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); virtual bool supportsMeter(ControlPart) const; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) // Returns the repeat interval of the animation for the progress bar. virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; // Returns the duration of the animation for the progress bar. @@ -114,7 +119,7 @@ protected: virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const; -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) virtual void adjustProgressBarStyle(StyleResolver*, RenderStyle*, Element*) const; virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif @@ -221,12 +226,12 @@ private: NSSliderCell* sliderThumbVertical() const; NSTextFieldCell* textField() const; -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const; NSLevelIndicatorCell* levelIndicatorFor(const RenderMeter*) const; #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) int minimumProgressBarHeight(RenderStyle*) const; const IntSize* progressBarSizes() const; const int* progressBarMargins(NSControlSize) const; diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index 6ed4abdef..9de2b1252 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -58,7 +58,7 @@ #import "RenderProgress.h" -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) #include "RenderMeter.h" #include "HTMLMeterElement.h" #endif @@ -857,7 +857,7 @@ bool RenderThemeMac::paintMenuList(RenderObject* o, const PaintInfo& paintInfo, return false; } -#if ENABLE(METER_TAG) +#if ENABLE(METER_ELEMENT) IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const { @@ -961,7 +961,7 @@ NSLevelIndicatorCell* RenderThemeMac::levelIndicatorFor(const RenderMeter* rende #endif -#if ENABLE(PROGRESS_TAG) +#if ENABLE(PROGRESS_ELEMENT) const IntSize* RenderThemeMac::progressBarSizes() const { static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) }; @@ -1372,6 +1372,10 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf CGContextRef context = localContext.cgContext(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); +#if ENABLE(DATALIST_ELEMENT) + paintSliderTicks(o, paintInfo, r); +#endif + GraphicsContextStateSaver stateSaver(*paintInfo.context); CGContextClipToRect(context, bounds); @@ -1742,6 +1746,18 @@ static int mediaControllerTheme() } #endif +#if ENABLE(DATALIST_ELEMENT) +IntSize RenderThemeMac::sliderTickSize() const +{ + return IntSize(1, 3); +} + +int RenderThemeMac::sliderTickOffsetFromTrackCenter() const +{ + return -9; +} +#endif + const int sliderThumbWidth = 15; const int sliderThumbHeight = 15; const int mediaSliderThumbWidth = 13; diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp index 59ceebd68..8af6a2765 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.cpp +++ b/Source/WebCore/rendering/RenderTreeAsText.cpp @@ -398,7 +398,7 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, ts << " [r=" << c.rowIndex() << " c=" << c.col() << " rs=" << c.rowSpan() << " cs=" << c.colSpan() << "]"; } -#if ENABLE(DETAILS) +#if ENABLE(DETAILS_ELEMENT) if (o.isDetailsMarker()) { ts << ": "; switch (toRenderDetailsMarker(&o)->orientation()) { diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index a3486f61c..ebae66e68 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -852,7 +852,11 @@ void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p result.setInnerNode(node); if (!result.innerNonSharedNode()) result.setInnerNonSharedNode(node); - result.setLocalPoint(point); + + LayoutPoint adjustedPoint = point; + adjustPointToColumnContents(adjustedPoint); + + result.setLocalPoint(adjustedPoint); } } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp index e6f755c98..0f91610e6 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp @@ -316,7 +316,6 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo context->concatCTM(filterData->shearFreeAbsoluteTransform.inverse()); context->scale(FloatSize(1 / filterData->filter->filterResolution().width(), 1 / filterData->filter->filterResolution().height())); - context->clip(lastEffect->maxEffectRect()); context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->absolutePaintRect()); context->scale(filterData->filter->filterResolution()); diff --git a/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp b/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp index 3ed63ddd6..15b48f590 100644 --- a/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp @@ -36,8 +36,6 @@ namespace WebCore { RenderSVGTextPath::RenderSVGTextPath(Node* n) : RenderSVGInline(n) - , m_exactAlignment(true) - , m_stretchMethod(false) { } diff --git a/Source/WebCore/rendering/svg/RenderSVGTextPath.h b/Source/WebCore/rendering/svg/RenderSVGTextPath.h index be156ba48..2758a0692 100644 --- a/Source/WebCore/rendering/svg/RenderSVGTextPath.h +++ b/Source/WebCore/rendering/svg/RenderSVGTextPath.h @@ -40,9 +40,6 @@ public: private: virtual const char* renderName() const { return "RenderSVGTextPath"; } - bool m_exactAlignment : 1; - bool m_stretchMethod : 1; - Path m_layoutPath; }; diff --git a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp index 966dd46b1..e3fd833a2 100755 --- a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp @@ -387,7 +387,7 @@ static void writeRenderSVGTextBox(TextStream& ts, const RenderSVGText& text) if (!box) return; - ts << " " << enclosingIntRect(FloatRect(text.x(), text.y(), box->logicalWidth(), box->logicalHeight())); + ts << " " << enclosingIntRect(FloatRect(text.location(), FloatSize(box->logicalWidth(), box->logicalHeight()))); // FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now. ts << " contains 1 chunk(s)"; diff --git a/Source/WebCore/storage/StorageAreaImpl.h b/Source/WebCore/storage/StorageAreaImpl.h index be0451c85..4c90e5bc0 100644 --- a/Source/WebCore/storage/StorageAreaImpl.h +++ b/Source/WebCore/storage/StorageAreaImpl.h @@ -70,7 +70,7 @@ namespace WebCore { private: StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota); - StorageAreaImpl(StorageAreaImpl*); + explicit StorageAreaImpl(StorageAreaImpl*); void blockUntilImportComplete() const; void closeDatabaseTimerFired(Timer<StorageAreaImpl>*); diff --git a/Source/WebCore/storage/StorageMap.h b/Source/WebCore/storage/StorageMap.h index 1fc17b077..147df6402 100644 --- a/Source/WebCore/storage/StorageMap.h +++ b/Source/WebCore/storage/StorageMap.h @@ -54,7 +54,7 @@ namespace WebCore { static const unsigned noQuota = UINT_MAX; private: - StorageMap(unsigned quota); + explicit StorageMap(unsigned quota); PassRefPtr<StorageMap> copy(); void invalidateIterator(); void setIteratorToIndex(unsigned); diff --git a/Source/WebCore/storage/StorageSyncManager.h b/Source/WebCore/storage/StorageSyncManager.h index e27833787..fa5c16dcc 100644 --- a/Source/WebCore/storage/StorageSyncManager.h +++ b/Source/WebCore/storage/StorageSyncManager.h @@ -50,7 +50,7 @@ namespace WebCore { void close(); private: - StorageSyncManager(const String& path); + explicit StorageSyncManager(const String& path); OwnPtr<StorageThread> m_thread; diff --git a/Source/WebCore/storage/StorageTask.h b/Source/WebCore/storage/StorageTask.h index 7d0523fd1..b14e9fe5f 100644 --- a/Source/WebCore/storage/StorageTask.h +++ b/Source/WebCore/storage/StorageTask.h @@ -58,7 +58,7 @@ namespace WebCore { StorageTask(Type, StorageThread*); StorageTask(Type, const String& originIdentifier); StorageTask(Type, const String& originIdentifier, const String& databaseFilename); - StorageTask(Type); + explicit StorageTask(Type); Type m_type; StorageAreaSync* m_area; diff --git a/Source/WebCore/storage/StorageTracker.h b/Source/WebCore/storage/StorageTracker.h index 9ee23f5ff..ea3a38fde 100644 --- a/Source/WebCore/storage/StorageTracker.h +++ b/Source/WebCore/storage/StorageTracker.h @@ -78,7 +78,7 @@ public: void setStorageDatabaseIdleInterval(double interval) { m_StorageDatabaseIdleInterval = interval; } private: - StorageTracker(const String& storagePath); + explicit StorageTracker(const String& storagePath); static void scheduleTask(void*); void internalInitialize(); diff --git a/Source/WebCore/svg/SVGParserUtilities.cpp b/Source/WebCore/svg/SVGParserUtilities.cpp index be0c2199b..71e2a39e2 100644 --- a/Source/WebCore/svg/SVGParserUtilities.cpp +++ b/Source/WebCore/svg/SVGParserUtilities.cpp @@ -142,6 +142,13 @@ template <typename FloatType> static bool genericParseNumber(const UChar*& ptr, return true; } +bool parseSVGNumber(UChar*& begin, size_t length, double& number) +{ + const UChar* ptr = begin; + const UChar* end = ptr + length; + return genericParseNumber(ptr, end, number, false); +} + bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip) { return genericParseNumber(ptr, end, number, skip); diff --git a/Source/WebCore/svg/SVGParserUtilities.h b/Source/WebCore/svg/SVGParserUtilities.h index ad35a07ba..e1ba0c8c9 100644 --- a/Source/WebCore/svg/SVGParserUtilities.h +++ b/Source/WebCore/svg/SVGParserUtilities.h @@ -33,6 +33,7 @@ namespace WebCore { class FloatRect; class SVGPointList; +bool parseSVGNumber(UChar*& ptr, size_t length, double& number); bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true); bool parseNumberFromString(const String&, float& number, bool skip = true); bool parseNumberOptionalNumber(const String& s, float& h, float& v); diff --git a/Source/WebCore/workers/AbstractWorker.cpp b/Source/WebCore/workers/AbstractWorker.cpp index 07cf73fa9..0ad995b22 100644 --- a/Source/WebCore/workers/AbstractWorker.cpp +++ b/Source/WebCore/workers/AbstractWorker.cpp @@ -55,14 +55,8 @@ AbstractWorker::~AbstractWorker() { } -void AbstractWorker::onDestroyWorker() -{ - InspectorInstrumentation::didDestroyWorker(scriptExecutionContext(), asID()); -} - void AbstractWorker::contextDestroyed() { - onDestroyWorker(); ActiveDOMObject::contextDestroyed(); } diff --git a/Source/WebCore/workers/AbstractWorker.h b/Source/WebCore/workers/AbstractWorker.h index f4cc50bd2..49754f290 100644 --- a/Source/WebCore/workers/AbstractWorker.h +++ b/Source/WebCore/workers/AbstractWorker.h @@ -71,7 +71,6 @@ namespace WebCore { virtual void derefEventTarget() { deref(); } virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); - void onDestroyWorker(); EventTargetData m_eventTargetData; }; diff --git a/Source/WebCore/workers/SharedWorker.cpp b/Source/WebCore/workers/SharedWorker.cpp index 9e94ee50f..571827d66 100644 --- a/Source/WebCore/workers/SharedWorker.cpp +++ b/Source/WebCore/workers/SharedWorker.cpp @@ -66,8 +66,6 @@ PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, c SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptURL, name, ec); - InspectorInstrumentation::didCreateWorker(context, worker->asID(), scriptURL.string(), true); - return worker.release(); } diff --git a/Source/WebCore/workers/SharedWorker.h b/Source/WebCore/workers/SharedWorker.h index 00362ba25..845aed9c3 100644 --- a/Source/WebCore/workers/SharedWorker.h +++ b/Source/WebCore/workers/SharedWorker.h @@ -48,7 +48,7 @@ namespace WebCore { virtual const AtomicString& interfaceName() const; private: - SharedWorker(ScriptExecutionContext*); + explicit SharedWorker(ScriptExecutionContext*); virtual SharedWorker* toSharedWorker() { return this; } diff --git a/Source/WebCore/workers/Worker.cpp b/Source/WebCore/workers/Worker.cpp index 34298f188..456185768 100644 --- a/Source/WebCore/workers/Worker.cpp +++ b/Source/WebCore/workers/Worker.cpp @@ -75,8 +75,6 @@ PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& #endif worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOriginRequests, worker.get()); - InspectorInstrumentation::didCreateWorker(context, worker->asID(), scriptURL.string(), false); - return worker.release(); } diff --git a/Source/WebCore/workers/Worker.h b/Source/WebCore/workers/Worker.h index cea1a640e..c7a1f8d99 100644 --- a/Source/WebCore/workers/Worker.h +++ b/Source/WebCore/workers/Worker.h @@ -70,7 +70,7 @@ namespace WebCore { DEFINE_ATTRIBUTE_EVENT_LISTENER(message); private: - Worker(ScriptExecutionContext*); + explicit Worker(ScriptExecutionContext*); // WorkerScriptLoaderClient callbacks virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&); diff --git a/Source/WebCore/workers/WorkerLocation.h b/Source/WebCore/workers/WorkerLocation.h index 692c0e3c5..4bd359189 100644 --- a/Source/WebCore/workers/WorkerLocation.h +++ b/Source/WebCore/workers/WorkerLocation.h @@ -60,7 +60,7 @@ namespace WebCore { String toString() const { return href(); } private: - WorkerLocation(const KURL& url) : m_url(url) { } + explicit WorkerLocation(const KURL& url) : m_url(url) { } KURL m_url; }; diff --git a/Source/WebCore/workers/WorkerMessagingProxy.h b/Source/WebCore/workers/WorkerMessagingProxy.h index b7cbe526f..77bcab2b6 100644 --- a/Source/WebCore/workers/WorkerMessagingProxy.h +++ b/Source/WebCore/workers/WorkerMessagingProxy.h @@ -49,7 +49,7 @@ namespace WebCore { class WorkerMessagingProxy : public WorkerContextProxy, public WorkerObjectProxy, public WorkerLoaderProxy { WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED; public: - WorkerMessagingProxy(Worker*); + explicit WorkerMessagingProxy(Worker*); // Implementations of WorkerContextProxy. // (Only use these methods in the worker object thread.) diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp index f16b8653b..768a019cd 100644 --- a/Source/WebCore/xml/XMLHttpRequest.cpp +++ b/Source/WebCore/xml/XMLHttpRequest.cpp @@ -354,7 +354,7 @@ void XMLHttpRequest::setResponseType(const String& responseType, ExceptionCode& else if (responseType == "arraybuffer") m_responseTypeCode = ResponseTypeArrayBuffer; else - ec = SYNTAX_ERR; + logConsoleError(scriptExecutionContext(), "XMLHttpRequest.responseType \"" + responseType + "\" is not supported."); } String XMLHttpRequest::responseType() |