diff options
Diffstat (limited to 'WebCore')
912 files changed, 31467 insertions, 14164 deletions
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index 318d8ae..a2a5c8c 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -157,6 +157,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/dom/%.cpp : $(intermediates)/dom/ # HTML GEN := \ $(intermediates)/html/JSBlob.h \ + $(intermediates)/html/JSBlobBuilder.h \ $(intermediates)/html/JSDOMFormData.h \ $(intermediates)/html/JSDataGridColumn.h \ $(intermediates)/html/JSDataGridColumnList.h \ @@ -345,6 +346,7 @@ GEN := \ $(intermediates)/storage/JSDatabaseCallback.h \ $(intermediates)/storage/JSDatabaseSync.h \ $(intermediates)/storage/JSSQLError.h \ + $(intermediates)/storage/JSSQLException.h \ $(intermediates)/storage/JSSQLResultSet.h \ $(intermediates)/storage/JSSQLResultSetRowList.h \ $(intermediates)/storage/JSSQLStatementCallback.h \ diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index 7cfc963..d852246 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -142,7 +142,11 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates) # HTML GEN := \ $(intermediates)/bindings/V8Blob.h \ +<<<<<<< HEAD $(intermediates)/bindings/V8DOMFormData.h \ +======= + $(intermediates)/bindings/V8BlobBuilder.h \ +>>>>>>> webkit.org at r61871 $(intermediates)/bindings/V8DataGridColumn.h \ $(intermediates)/bindings/V8DataGridColumnList.h \ $(intermediates)/bindings/V8File.h \ @@ -340,6 +344,7 @@ GEN := \ $(intermediates)/bindings/V8DatabaseCallback.h \ $(intermediates)/bindings/V8DatabaseSync.h \ $(intermediates)/bindings/V8SQLError.h \ + $(intermediates)/bindings/V8SQLException.h \ $(intermediates)/bindings/V8SQLResultSet.h \ $(intermediates)/bindings/V8SQLResultSetRowList.h \ $(intermediates)/bindings/V8SQLStatementCallback.h \ diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk index 43d09c4..2236452 100644 --- a/WebCore/Android.jscbindings.mk +++ b/WebCore/Android.jscbindings.mk @@ -125,7 +125,6 @@ LOCAL_SRC_FILES += \ bindings/js/JSLazyEventListener.cpp \ bindings/js/JSLocationCustom.cpp \ bindings/js/JSMainThreadExecState.cpp \ - bindings/js/JSMessageChannelConstructor.cpp \ bindings/js/JSMessageChannelCustom.cpp \ bindings/js/JSMessageEventCustom.cpp \ bindings/js/JSMessagePortCustom.cpp \ @@ -150,23 +149,20 @@ LOCAL_SRC_FILES += \ bindings/js/JSSVGMatrixCustom.cpp \ bindings/js/JSSVGPathSegCustom.cpp \ bindings/js/JSSVGPathSegListCustom.cpp \ - bindings/js/JSSharedWorkerConstructor.cpp \ bindings/js/JSSharedWorkerCustom.cpp \ bindings/js/JSStorageCustom.cpp \ bindings/js/JSStyleSheetCustom.cpp \ bindings/js/JSStyleSheetListCustom.cpp \ bindings/js/JSTextCustom.cpp \ bindings/js/JSTreeWalkerCustom.cpp \ - bindings/js/JSWebKitCSSMatrixConstructor.cpp \ - bindings/js/JSWebKitPointConstructor.cpp \ - bindings/js/JSWorkerConstructor.cpp \ + bindings/js/JSWebKitCSSMatrixCustom.cpp \ + bindings/js/JSWebKitPointCustom.cpp \ bindings/js/JSWorkerContextBase.cpp \ bindings/js/JSWorkerContextCustom.cpp \ bindings/js/JSWorkerContextErrorHandler.cpp \ bindings/js/JSWorkerCustom.cpp \ bindings/js/JSXMLHttpRequestCustom.cpp \ bindings/js/JSXMLHttpRequestUploadCustom.cpp \ - bindings/js/JSXSLTProcessorConstructor.cpp \ bindings/js/JSXSLTProcessorCustom.cpp \ bindings/js/ScheduledAction.cpp \ bindings/js/ScriptArray.cpp \ diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 4b283dc..1b02cc4 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -168,6 +168,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ dom/SelectElement.cpp \ dom/SelectorNodeList.cpp \ dom/SpaceSplitString.cpp \ + dom/StaticHashSetNodeList.cpp \ dom/StaticNodeList.cpp \ dom/StyleElement.cpp \ dom/StyledElement.cpp \ @@ -250,7 +251,11 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/AsyncImageResizer.cpp \ html/Blob.cpp \ html/CollectionCache.cpp \ +<<<<<<< HEAD html/DateComponents.cpp \ +======= + html/CSSPreloadScanner.cpp \ +>>>>>>> webkit.org at r61871 html/DOMFormData.cpp \ html/File.cpp \ html/FileList.cpp \ @@ -259,11 +264,12 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/FileStreamProxy.cpp \ html/FileThread.cpp \ html/FormDataList.cpp \ - html/HTML5EntityParser.cpp \ - html/HTML5Lexer.cpp \ - html/HTML5DocumentParser.cpp \ - html/HTML5TreeBuilder.cpp \ - html/HTML5ScriptRunner.cpp \ + html/HTMLEntityParser.cpp \ + html/HTMLTokenizer.cpp \ + html/HTMLDocumentParser.cpp \ + html/HTMLPreloadScanner.cpp \ + html/HTMLScriptRunner.cpp \ + html/HTMLTreeBuilder.cpp \ html/HTMLAllCollection.cpp \ html/HTMLCollection.cpp \ html/HTMLDataListElement.cpp \ @@ -274,8 +280,14 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/HTMLImageLoader.cpp \ html/HTMLNameCollection.cpp \ html/HTMLOptionsCollection.cpp \ +<<<<<<< HEAD +======= + html/LegacyHTMLTreeBuilder.cpp \ +>>>>>>> webkit.org at r61871 html/HTMLParserErrorCodes.cpp \ + html/HTMLParserScheduler.cpp \ html/HTMLTableRowsCollection.cpp \ +<<<<<<< HEAD html/HTMLViewSourceDocument.cpp \ html/ImageData.cpp \ html/ImageResizerThread.cpp \ @@ -283,6 +295,13 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/LegacyHTMLTreeConstructor.cpp \ html/PreloadScanner.cpp \ html/StepRange.cpp \ +======= + html/LegacyHTMLDocumentParser.cpp \ + html/HTMLViewSourceDocument.cpp \ + html/ImageData.cpp \ + html/ImageResizerThread.cpp \ + html/LegacyPreloadScanner.cpp \ +>>>>>>> webkit.org at r61871 html/TimeRanges.cpp \ html/ValidityState.cpp \ \ @@ -311,7 +330,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ loader/DocumentThreadableLoader.cpp \ loader/DocumentWriter.cpp \ loader/FormState.cpp \ + loader/FormSubmission.cpp \ loader/FrameLoader.cpp \ + loader/FrameLoaderStateMachine.cpp \ loader/HistoryController.cpp \ loader/ImageDocument.cpp \ loader/ImageLoader.cpp \ @@ -328,7 +349,11 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ loader/Request.cpp \ loader/ResourceLoadNotifier.cpp \ loader/ResourceLoader.cpp \ +<<<<<<< HEAD loader/SinkDocument.cpp \ +======= + loader/SubframeLoader.cpp \ +>>>>>>> webkit.org at r61871 loader/SubresourceLoader.cpp \ loader/TextDocument.cpp \ loader/TextResourceDecoder.cpp \ @@ -572,6 +597,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ platform/text/Base64.cpp \ platform/text/BidiContext.cpp \ + platform/text/Hyphenation.cpp \ platform/text/RegularExpression.cpp \ platform/text/SegmentedString.cpp \ platform/text/String.cpp \ @@ -727,7 +753,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ rendering/SVGRenderTreeAsText.cpp \ rendering/SVGRootInlineBox.cpp \ rendering/SVGShadowTreeElements.cpp \ - rendering/SVGTextLayoutUtilities.cpp + rendering/SVGTextChunkLayoutInfo.cpp \ + rendering/SVGTextLayoutUtilities.cpp \ + rendering/SVGTextQuery.cpp endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt index 2c0e6e0..ad93634 100644 --- a/WebCore/CMakeLists.txt +++ b/WebCore/CMakeLists.txt @@ -182,6 +182,7 @@ SET(WebCore_IDL_FILES dom/WheelEvent.idl html/Blob.idl + html/BlobBuilder.idl html/DataGridColumn.idl html/DataGridColumnList.idl html/DOMFormData.idl @@ -335,6 +336,7 @@ SET(WebCore_IDL_FILES storage/IDBSuccessEvent.idl storage/IndexedDatabaseRequest.idl storage/SQLError.idl + storage/SQLException.idl storage/SQLResultSet.idl storage/SQLResultSetRowList.idl storage/SQLStatementCallback.idl @@ -347,6 +349,8 @@ SET(WebCore_IDL_FILES storage/Storage.idl storage/StorageEvent.idl + websockets/WebSocket.idl + workers/AbstractWorker.idl workers/DedicatedWorkerContext.idl workers/SharedWorker.idl @@ -511,7 +515,7 @@ ENDIF() SET(WebCore_SOURCES ${DERIVED_SOURCES_DIR}/CSSGrammar.cpp ${DERIVED_SOURCES_DIR}/HTMLElementFactory.cpp - ${DERIVED_SOURCES_DIR}/HTMLEntityNames.c + ${DERIVED_SOURCES_DIR}/HTMLEntityNames.cpp ${DERIVED_SOURCES_DIR}/HTMLNames.cpp ${DERIVED_SOURCES_DIR}/JSHTMLElementWrapperFactory.cpp ${DERIVED_SOURCES_DIR}/UserAgentStyleSheetsData.cpp @@ -583,7 +587,7 @@ SET(WebCore_SOURCES bindings/js/JSElementCustom.cpp bindings/js/JSEventCustom.cpp bindings/js/JSEventListener.cpp - bindings/js/JSEventSourceConstructor.cpp + bindings/js/JSEventSourceCustom.cpp bindings/js/JSEventTarget.cpp bindings/js/JSExceptionBase.cpp bindings/js/JSGeolocationCustom.cpp @@ -612,7 +616,6 @@ SET(WebCore_SOURCES bindings/js/JSLazyEventListener.cpp bindings/js/JSLocationCustom.cpp bindings/js/JSMainThreadExecState.cpp - bindings/js/JSMessageChannelConstructor.cpp bindings/js/JSMessageChannelCustom.cpp bindings/js/JSMessageEventCustom.cpp bindings/js/JSMessagePortCustom.cpp @@ -630,7 +633,6 @@ SET(WebCore_SOURCES bindings/js/JSPluginElementFunctions.cpp bindings/js/JSPopStateEventCustom.cpp bindings/js/JSScriptProfileNodeCustom.cpp - bindings/js/JSSharedWorkerConstructor.cpp bindings/js/JSSharedWorkerCustom.cpp bindings/js/JSSQLResultSetRowListCustom.cpp bindings/js/JSSQLTransactionCustom.cpp @@ -640,16 +642,14 @@ SET(WebCore_SOURCES bindings/js/JSStyleSheetListCustom.cpp bindings/js/JSTextCustom.cpp bindings/js/JSTreeWalkerCustom.cpp - bindings/js/JSWebKitCSSMatrixConstructor.cpp - bindings/js/JSWebKitPointConstructor.cpp - bindings/js/JSWorkerConstructor.cpp + bindings/js/JSWebKitCSSMatrixCustom.cpp + bindings/js/JSWebKitPointCustom.cpp bindings/js/JSWorkerContextBase.cpp bindings/js/JSWorkerContextCustom.cpp bindings/js/JSWorkerContextErrorHandler.cpp bindings/js/JSWorkerCustom.cpp bindings/js/JSXMLHttpRequestCustom.cpp bindings/js/JSXMLHttpRequestUploadCustom.cpp - bindings/js/JSXSLTProcessorConstructor.cpp bindings/js/JSXSLTProcessorCustom.cpp bindings/js/ScheduledAction.cpp bindings/js/ScriptArray.cpp @@ -818,6 +818,7 @@ SET(WebCore_SOURCES dom/SelectElement.cpp dom/SelectorNodeList.cpp dom/SpaceSplitString.cpp + dom/StaticHashSetNodeList.cpp dom/StaticNodeList.cpp dom/StyleElement.cpp dom/StyledElement.cpp @@ -895,7 +896,9 @@ SET(WebCore_SOURCES html/AsyncImageResizer.cpp html/Blob.cpp + html/BlobBuilder.cpp html/CollectionCache.cpp + html/CSSPreloadScanner.cpp html/DOMDataGridDataSource.cpp html/DOMFormData.cpp html/DataGridColumn.cpp @@ -904,11 +907,12 @@ SET(WebCore_SOURCES html/File.cpp html/FileList.cpp html/FormDataList.cpp - html/HTML5EntityParser.cpp - html/HTML5Lexer.cpp - html/HTML5DocumentParser.cpp - html/HTML5TreeBuilder.cpp - html/HTML5ScriptRunner.cpp + html/HTMLEntityParser.cpp + html/HTMLTokenizer.cpp + html/HTMLDocumentParser.cpp + html/HTMLPreloadScanner.cpp + html/HTMLScriptRunner.cpp + html/HTMLTreeBuilder.cpp html/HTMLAllCollection.cpp html/HTMLAnchorElement.cpp html/HTMLAppletElement.cpp @@ -969,8 +973,9 @@ SET(WebCore_SOURCES html/HTMLOptionsCollection.cpp html/HTMLParagraphElement.cpp html/HTMLParamElement.cpp - html/LegacyHTMLTreeConstructor.cpp + html/LegacyHTMLTreeBuilder.cpp html/HTMLParserErrorCodes.cpp + html/HTMLParserScheduler.cpp html/HTMLPlugInElement.cpp html/HTMLPlugInImageElement.cpp html/HTMLPreElement.cpp @@ -989,13 +994,13 @@ SET(WebCore_SOURCES html/HTMLTableSectionElement.cpp html/HTMLTextAreaElement.cpp html/HTMLTitleElement.cpp - html/HTMLDocumentParser.cpp + html/LegacyHTMLDocumentParser.cpp html/HTMLUListElement.cpp html/HTMLViewSourceDocument.cpp html/ImageData.cpp html/ImageResizerThread.cpp html/LabelsNodeList.cpp - html/PreloadScanner.cpp + html/LegacyPreloadScanner.cpp html/StepRange.cpp html/ValidityState.cpp html/canvas/CanvasGradient.cpp @@ -1018,7 +1023,9 @@ SET(WebCore_SOURCES inspector/InspectorFrontendClientLocal.cpp inspector/InspectorFrontendHost.cpp inspector/InspectorResource.cpp + inspector/InspectorValues.cpp inspector/InspectorTimelineAgent.cpp + inspector/ScriptBreakpoint.cpp inspector/TimelineRecordFactory.cpp loader/Cache.cpp @@ -1039,7 +1046,9 @@ SET(WebCore_SOURCES loader/FTPDirectoryDocument.cpp loader/FTPDirectoryParser.cpp loader/FormState.cpp + loader/FormSubmission.cpp loader/FrameLoader.cpp + loader/FrameLoaderStateMachine.cpp loader/HistoryController.cpp loader/ImageDocument.cpp loader/ImageLoader.cpp @@ -1057,6 +1066,7 @@ SET(WebCore_SOURCES loader/ResourceLoadNotifier.cpp loader/ResourceLoader.cpp loader/SinkDocument.cpp + loader/SubframeLoader.cpp loader/SubresourceLoader.cpp loader/TextDocument.cpp loader/TextResourceDecoder.cpp @@ -1241,6 +1251,7 @@ SET(WebCore_SOURCES platform/text/Base64.cpp platform/text/BidiContext.cpp + platform/text/Hyphenation.cpp platform/text/RegularExpression.cpp platform/text/SegmentedString.cpp platform/text/String.cpp @@ -1297,6 +1308,7 @@ SET(WebCore_SOURCES rendering/RenderIFrame.cpp rendering/RenderImage.cpp rendering/RenderImageGeneratedContent.cpp + rendering/RenderIndicator.cpp rendering/RenderInline.cpp rendering/RenderLayer.cpp rendering/RenderLineBoxList.cpp @@ -1405,6 +1417,13 @@ SET(WebCore_SOURCES storage/StorageNamespaceImpl.cpp storage/StorageSyncManager.cpp + websockets/ThreadableWebSocketChannel.cpp + websockets/WebSocket.cpp + websockets/WebSocketChannel.cpp + websockets/WebSocketHandshake.cpp + websockets/WebSocketHandshakeRequest.cpp + websockets/WorkerThreadableWebSocketChannel.cpp + workers/AbstractWorker.cpp workers/DedicatedWorkerContext.cpp workers/DedicatedWorkerThread.cpp @@ -1500,7 +1519,9 @@ IF (ENABLE_SVG) rendering/SVGRenderTreeAsText.cpp rendering/SVGRootInlineBox.cpp rendering/SVGShadowTreeElements.cpp + rendering/SVGTextChunkLayoutInfo.cpp rendering/SVGTextLayoutUtilities.cpp + rendering/SVGTextQuery.cpp rendering/style/SVGRenderStyle.cpp rendering/style/SVGRenderStyleDefs.cpp svg/ColorDistance.cpp @@ -1672,9 +1693,9 @@ ENDFOREACH () LIST(APPEND WebCore_SOURCES ${JS_IDL_FILES}) -GENERATE_GPERF("c" ${WEBCORE_DIR}/html/HTMLEntityNames.gperf findEntity "-c") -GENERATE_GPERF("c" ${WEBCORE_DIR}/platform/ColorData.gperf findColor "") -GENERATE_GPERF("cpp" ${WEBCORE_DIR}/html/DocTypeStrings.gperf findDoctypeEntry "-F,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards") +GENERATE_GPERF(${WEBCORE_DIR}/html/HTMLEntityNames.gperf) +GENERATE_GPERF(${WEBCORE_DIR}/platform/ColorData.gperf) +GENERATE_GPERF(${WEBCORE_DIR}/html/DocTypeStrings.gperf) GENERATE_TOKENIZER() GENERATE_USER_AGENT_STYLES() @@ -1689,9 +1710,10 @@ ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSValueKe ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSPropertyNames.h) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSPrimitiveValueMappings.h CSSValueKeywords.h) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/HTMLDocument.cpp DocTypeStrings.cpp) -ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/platform/graphics/Color.cpp ColorData.c) +ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/platform/graphics/Color.cpp ColorData.cpp) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSParser.cpp tokenizer.cpp) -ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/PreloadScanner.cpp HTMLEntityNames.c) +ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/LegacyPreloadScanner.cpp HTMLEntityNames.cpp) +ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/HTMLEntityParser.cpp HTMLEntityNames.cpp) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSStyleSelector.cpp UserAgentStyleSheetsData.cpp UserAgentStyleSheets.h) GENERATE_DOM_NAMES_FACTORY(HTML ${WEBCORE_DIR}/html/HTMLTagNames.in ${WEBCORE_DIR}/html/HTMLAttributeNames.in "${HTML_FEATURES}") diff --git a/WebCore/CMakeListsEfl.txt b/WebCore/CMakeListsEfl.txt index 1cb6e44..da1f27a 100644 --- a/WebCore/CMakeListsEfl.txt +++ b/WebCore/CMakeListsEfl.txt @@ -51,12 +51,10 @@ LIST(APPEND WebCore_SOURCES platform/efl/SystemTimeEfl.cpp platform/efl/TemporaryLinkStubs.cpp platform/efl/WidgetEfl.cpp - platform/graphics/efl/FloatRectEfl.cpp platform/graphics/efl/FontEfl.cpp platform/graphics/efl/IconEfl.cpp platform/graphics/efl/ImageEfl.cpp platform/graphics/efl/IntPointEfl.cpp - platform/graphics/efl/IntRectEfl.cpp platform/posix/FileSystemPOSIX.cpp platform/text/efl/TextBreakIteratorInternalICUEfl.cpp ) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 7ba9026..8ab39c5 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,8613 @@ +2010-06-25 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Take a KURL parameter in Document's constructor. + This will remove the one case where Document::url() + and FrameLoader::url() are not equal, allowing us to + remove FrameLoader::url(). + + https://bugs.webkit.org/show_bug.cgi?id=41166 + + Refactor only, no new tests. + + * dom/DOMImplementation.cpp: + (WebCore::DOMImplementation::createDocument): Take a KURL and pass it through to Document. + (WebCore::DOMImplementation::createHTMLDocument): + * dom/DOMImplementation.h: + * dom/Document.cpp: + (WebCore::Document::Document): Call setURL() if a frame or a non-empty KURL is specified. + (WebCore::Document::initSecurityContext): m_url is now initialized, so use it instead + of m_frame->loader()->url() for initializing the SecurityOrigin. + * dom/Document.h: + (WebCore::Document::create): + (WebCore::Document::createXHTML): + * html/HTMLDocument.cpp: + * html/HTMLDocument.h: Add KURL parameter to create() and constructor. + * html/HTMLViewSourceDocument.cpp: + * html/HTMLViewSourceDocument.h: Add KURL parameter to create() and constructor. + * loader/CachedFont.cpp: + (WebCore::CachedFont::ensureSVGFontData): + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::createDocument): Take a KURL and pass it through to Document. + (WebCore::DocumentWriter::begin): Pass existing url parameter to constructors, and remove + redundant Document::setURL() call. + * loader/DocumentWriter.h: + * loader/FTPDirectoryDocument.cpp: + * loader/FTPDirectoryDocument.h: Add KURL parameter to create() and constructor. + * loader/ImageDocument.cpp: + * loader/ImageDocument.h: Add KURL parameter to create() and constructor. + * loader/MediaDocument.cpp: + * loader/MediaDocument.h: Add KURL parameter to create() and constructor. + * loader/PlaceholderDocument.h: Add KURL parameter to create() and constructor. + * loader/PluginDocument.cpp: + * loader/PluginDocument.h: Add KURL parameter to create() and constructor. + * loader/SinkDocument.cpp: + * loader/SinkDocument.h: Add KURL parameter to create() and constructor. + * loader/TextDocument.cpp: + * loader/TextDocument.h: Add KURL parameter to create() and constructor. + * svg/SVGDocument.cpp: + * svg/SVGDocument.h: Add KURL parameter to create() and constructor. + * xml/DOMParser.cpp: + (WebCore::DOMParser::parseFromString): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::responseXML): + * xml/XSLTProcessor.cpp: + (WebCore::XSLTProcessor::createDocumentFromSource): + +2010-06-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61812. + http://trac.webkit.org/changeset/61812 + https://bugs.webkit.org/show_bug.cgi?id=41216 + + breaks Chromium workers tests (Requested by mnaganov on + #webkit). + + * storage/AbstractDatabase.cpp: + * storage/AbstractDatabase.h: + * storage/Database.cpp: + (WebCore::Database::databaseInfoTableName): + (WebCore::guidMutex): + (WebCore::guidToVersionMap): + (WebCore::updateGuidVersionMap): + (WebCore::guidToDatabaseMap): + (WebCore::databaseVersionKey): + (WebCore::DatabaseCreationCallbackTask::create): + (WebCore::DatabaseCreationCallbackTask::performTask): + (WebCore::DatabaseCreationCallbackTask::DatabaseCreationCallbackTask): + (WebCore::Database::openDatabase): + (WebCore::Database::Database): + (WebCore::Database::openAndVerifyVersion): + (WebCore::retrieveTextResultFromDatabase): + (WebCore::Database::getVersionFromDatabase): + (WebCore::setTextValueInDatabase): + (WebCore::Database::setVersionInDatabase): + (WebCore::Database::versionMatchesExpected): + (WebCore::Database::close): + (WebCore::Database::disableAuthorizer): + (WebCore::Database::enableAuthorizer): + (WebCore::Database::setAuthorizerReadOnly): + (WebCore::Database::lastActionChangedDatabase): + (WebCore::Database::lastActionWasInsert): + (WebCore::Database::resetDeletes): + (WebCore::Database::hadDeletes): + (WebCore::guidForOriginAndName): + (WebCore::Database::resetAuthorizer): + (WebCore::Database::performOpenAndVerify): + (WebCore::Database::performCreationCallback): + (WebCore::Database::version): + (WebCore::Database::setExpectedVersion): + (WebCore::Database::stringIdentifier): + (WebCore::Database::displayName): + (WebCore::Database::estimatedSize): + (WebCore::Database::fileName): + * storage/Database.h: + (WebCore::Database::scriptExecutionContext): + (WebCore::Database::opened): + (WebCore::Database::isNew): + (WebCore::Database::databaseDebugName): + * storage/DatabaseAuthorizer.cpp: + (WebCore::DatabaseAuthorizer::DatabaseAuthorizer): + (WebCore::DatabaseAuthorizer::denyBasedOnTableName): + * storage/DatabaseAuthorizer.h: + (WebCore::DatabaseAuthorizer::create): + * storage/DatabaseSync.cpp: + (WebCore::DatabaseSync::databaseInfoTableName): + (WebCore::DatabaseSync::openDatabaseSync): + (WebCore::DatabaseSync::DatabaseSync): + (WebCore::DatabaseSync::~DatabaseSync): + (WebCore::DatabaseSync::version): + (WebCore::DatabaseSync::changeVersion): + (WebCore::DatabaseSync::transaction): + (WebCore::DatabaseSync::scriptExecutionContext): + * storage/DatabaseSync.h: + (WebCore::DatabaseSync::databaseDebugName): + * storage/DatabaseTask.cpp: + (WebCore::DatabaseOpenTask::DatabaseOpenTask): + (WebCore::DatabaseOpenTask::doPerformTask): + * storage/DatabaseTask.h: + (WebCore::DatabaseOpenTask::create): + +2010-06-25 Lei Zheng <lzheng@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add a flag to the ResourceResponse for tracking if a request was fetched when + Alternate-protocol is available. + https://bugs.webkit.org/show_bug.cgi?id=41001 + + No new tests. (This is just a setter and getter.) + + * platform/network/chromium/ResourceResponse.h: + (WebCore::ResourceResponse::ResourceResponse): + (WebCore::ResourceResponse::wasAlternateProtocolAvailable): + (WebCore::ResourceResponse::setWasAlternateProtocolAvailable): + +2010-06-25 Lyon Chen <liachen@rim.com> + + Reviewed by Darin Adler. + + InspectorCSSStore.cpp is not surrounded with ENABLE(INSPECTOR) + https://bugs.webkit.org/show_bug.cgi?id=41004 + + Surround InspectorCSSStore.cpp code with ENABLE(INSPECTOR) so it will not + break the build when INSPECTOR is disabled. + + * inspector/InspectorCSSStore.cpp: + +2010-06-25 No'am Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] WebGL: missing file + https://bugs.webkit.org/show_bug.cgi?id=40998 + + Added a missing file to WebCore.pro + + No new tests; build fix + + * WebCore.pro: + +2010-06-25 Adam Roben <aroben@apple.com> + + Windows build fix + + * WebCore.vcproj/WebCore.vcproj: Added a missing </File> tag. + +2010-06-25 Alex Milowski <alex@milowski.com> + + Reviewed by Kenneth Rohde Christiansen. + + This patch changes the vertical alignment to rely upon baseline + alignment for all MathML rendering. This fixes a number of layout + issues and the implementation is much more clean. + + Also, this patch adds a horizontal green line in the debug layout + so you can see the top padding of any RenderMathMLBlock instance. + + Test: mathml/presentation/row-alignment.xhtml + + * css/mathml.css: + * mathml/RenderMathMLBlock.cpp: + * mathml/RenderMathMLFraction.cpp: + * mathml/RenderMathMLFraction.h: + * mathml/RenderMathMLOperator.cpp: + * mathml/RenderMathMLOperator.h: + * mathml/RenderMathMLRoot.cpp: + * mathml/RenderMathMLRow.cpp: + * mathml/RenderMathMLRow.h: + * mathml/RenderMathMLSquareRoot.cpp: + * mathml/RenderMathMLSubSup.cpp: + * mathml/RenderMathMLUnderOver.cpp: + +2010-06-25 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Can't see source when hitting debugger statement in evaled source + https://bugs.webkit.org/show_bug.cgi?id=41058 + + Test: inspector/debugger-pause-in-eval-script.html + + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::sourceParsed): use lexical global object to figure out + where the script is compiled. Otherwise scripts typed in Web Inspector console will + be treated as ones evaluated in the context of Web Inspector and won't appear in the + scripts list. + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didParseSource): cache script sources for eval's too. + +2010-06-25 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Use a descriptive string in FileChooser when multiple files can + be selected. + https://bugs.webkit.org/show_bug.cgi?id=40943 + + EFL port has no tests yet, so no new tests. + + * platform/efl/FileChooserEfl.cpp: + (WebCore::FileChooser::basenameForWidth): + +2010-06-25 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + SVG Text Highlighting not yet supported (in Safari) + https://bugs.webkit.org/show_bug.cgi?id=41200 + + Add text match marker highlighting support for SVG text - searching for SVG text in Safari now paints the nice yellow highlighting rect, and the + white rectangles for all text matches. Behaves exactly like HTML text, but respecting SVGs per-character/per-chunk transformations, + allowing to highlight textPaths, tspans with absolute per-character positions etc.. + + Only manually testable, thus no new tests. + + * rendering/InlineBox.h: Expose calculateBoundaries() in non-SVG builds as well, now used by InlineTextBox too. + * rendering/InlineTextBox.h: Add calculateBoundaries(), which will be used to refactor some code in RenderText, see below. + (WebCore::InlineTextBox::calculateBoundaries): Just return a IntRect(x(), y(), width(), height()) here. + (WebCore::RenderObject::isSVGInlineText): + * rendering/RenderSVGInlineText.h: + (WebCore::RenderSVGInlineText::isSVGInlineText): Return true for isSVGInlineText(), return false for isSVGText() (default in RenderObject.h) + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::paint): Only paint box decorations in PaintPhase(Child)BlockBackground, exit afterwards just like RenderBlock does. + Otherwise the white text match marker rectangle gets drawn over the yellow highlight that Safari draws. + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::paint): Accept a new painting phase: PaintPhaseSelection, used by Safari when drawing the yellow highlight rect. + * rendering/RenderText.cpp: + (WebCore::RenderText::absoluteQuads): Use calculateBoundaries() instead of IntRect(x(), y(), width(), height()). SVG provides different boundaries here. + (WebCore::RenderText::absoluteQuadsForRange): Ditto. This is the main change, leading to correct text highlight placement. + * rendering/SVGInlineFlowBox.cpp: Add assertion that painting is not disabled, for consistency. Change paint phase assertion to include PaintPhaseSelection. + (WebCore::SVGInlineFlowBox::paint): + * rendering/SVGInlineTextBox.cpp: + (WebCore::SVGInlineTextBox::selectionRectForTextChunkPart): Refactored from selectionRect(), to share code between selectionRect/computeTextMatchMarkerRect. + (WebCore::SVGInlineTextBox::selectionRect): Use new helper function selectionRectForTextChunkPart(). + (WebCore::SVGInlineTextBox::paint): Ditto. Call new computeTextMatchMarkerRect() function. + (WebCore::SVGInlineTextBox::computeTextMatchMarkerRect): Implemented similar to HTML, but respecting SVGs concept of text chunk parts. + (WebCore::SVGInlineTextBox::paintText): In PaintPhaseSelection, only paint selected text, not anything before/after the selection start/end. + (WebCore::SVGInlineTextBox::calculateBoundaries): Early exit, if m_chunkTransformation is identity. + * rendering/SVGInlineTextBox.h: Added "bool paintSelectedTextOnly" to paintText() and add new computeTextMatchMarkerRect(RenderStyle*) function. + * rendering/SVGRootInlineBox.cpp: + (WebCore::SVGRootInlineBox::paint): Change paint phase assertion to include PaintPhaseSelection. + +2010-06-25 John Gregg <johnnyg@google.com> + + Reviewed by Darin Fisher. + + Notification should expose ltr/rtl as TextDirection, not String + https://bugs.webkit.org/show_bug.cgi?id=40871 + + No new tests; existing test covers this, just renaming a method. + + * notifications/Notification.h: + (WebCore::Notification::direction): + +2010-06-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61842. + http://trac.webkit.org/changeset/61842 + https://bugs.webkit.org/show_bug.cgi?id=41208 + + It broke Windows build (Requested by Ossy_ on #webkit). + + * ForwardingHeaders/wtf/win/OwnPtrWin.h: Removed. + +2010-06-25 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Darin Adler. + + Remove unneeded whitespace from svgtags.in. + https://bugs.webkit.org/show_bug.cgi?id=40912 + + make_names.pl throws an error at non-empty lines + when using cl.exe as preprocessor. + + * svg/svgtags.in: + +2010-06-25 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Rob Buis. + + Split up isSVGText() in isSVGText() / isSVGInlineText() + https://bugs.webkit.org/show_bug.cgi?id=41204 + + Introduce isSVGInlineText(), to provide a safe mechanism to differentiate between RenderSVGText / RenderSVGInlineText. + No change in functionality, thus no new tests. + + * rendering/RenderBlockLineLayout.cpp: + (WebCore::shouldPreserveNewline): s/isSVGText/isSVGInlineText/ + (WebCore::RenderBlock::findNextLineBreak): Ditto. + * rendering/RenderObject.h: + (WebCore::RenderObject::isSVGInlineText): Return false, by default. + * rendering/RenderSVGInlineText.h: + (WebCore::RenderSVGInlineText::isSVGInlineText): Return true here, don't return true anymore for isSVGText(). + * rendering/RenderText.cpp: + (WebCore::RenderText::setTextInternal): s/isSVGText/isSVGInlineText/ + * rendering/RenderTreeAsText.cpp: Remove hack, now that we can properly differentiate between RenderSVGText / RenderSVGInlineText. + (WebCore::write): + +2010-06-25 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Adam Barth. + + Change OwnPtrCommon to include platform-specific headers + https://bugs.webkit.org/show_bug.cgi?id=40279 + + Adding new type to OwnPtrCommon needlessly causes all ports to do full rebuilds. + Change OwnPtrCommon to include platform-specific headers to avoid all ports rebuilds. + + * ForwardingHeaders/wtf/win: Added. + * ForwardingHeaders/wtf/win/OwnPtrWin.h: Added. + +2010-06-25 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Adam Barth. + + Implement TextCodecs for WinCE port. + https://bugs.webkit.org/show_bug.cgi?id=32169 + Originally written by Yong Li <yong.li@torchmobile.com> + + * platform/graphics/FontCache.h: + * platform/graphics/wince/FontCacheWince.cpp: + (WebCore::FontCache::getMultiLanguageInterface): + * platform/text/wince/TextCodecWinCE.cpp: Added. + (WebCore::codePageCharsets): + (WebCore::knownCharsets): + (WebCore::supportedCharsets): + (WebCore::languageManager): + (WebCore::addCharset): + (WebCore::LanguageManager::LanguageManager): + (WebCore::getCodePage): + (WebCore::newTextCodecWinCE): + (WebCore::TextCodecWinCE::TextCodecWinCE): + (WebCore::TextCodecWinCE::~TextCodecWinCE): + (WebCore::TextCodecWinCE::registerBaseEncodingNames): + (WebCore::TextCodecWinCE::registerBaseCodecs): + (WebCore::TextCodecWinCE::registerExtendedEncodingNames): + (WebCore::TextCodecWinCE::registerExtendedCodecs): + (WebCore::getCodePageFlags): + (WebCore::findFirstNonAsciiCharacter): + (WebCore::decode): + (WebCore::TextCodecWinCE::decode): + (WebCore::TextCodecWinCE::encode): + (WebCore::TextCodecWinCE::enumerateSupportedEncodings): + * platform/text/wince/TextCodecWinCE.h: Added. + +2010-06-24 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Dirk Schulze. + + Bug 40880 - SVG properties fill and stroke do not accept system colors + https://bugs.webkit.org/show_bug.cgi?id=40880 + + Handle css system colors in fill and stroke properties. + + Test: svg/css/rect-system-color.xhtml + + * css/CSSParser.cpp: Remove comment and unneeded if condition + (WebCore::CSSParser::parseValue): + * css/SVGCSSParser.cpp: Allow css system colors + (WebCore::CSSParser::parseSVGValue): + +2010-06-24 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Make DocumentParser API private on subclasses to catch misuse bugs + https://bugs.webkit.org/show_bug.cgi?id=41186 + + This already found one bug: + https://bugs.webkit.org/show_bug.cgi?id=41187 + + Added a new HTMLDocumentParaser::parseDocumentFragment so that + DocumentFragment.cpp does not need to use private methods. + + * dom/DocumentFragment.cpp: + (WebCore::DocumentFragment::parseHTML): + * dom/XMLDocumentParser.h: + (WebCore::XMLDocumentParser::setIsXHTMLDocument): + (WebCore::XMLDocumentParser::isXHTMLDocument): + (WebCore::XMLDocumentParser::setIsXHTMLMPDocument): + (WebCore::XMLDocumentParser::isXHTMLMPDocument): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::parseDocumentFragment): + * html/HTMLDocumentParser.h: + * html/LegacyHTMLDocumentParser.cpp: + (WebCore::LegacyHTMLDocumentParser::parseDocumentFragment): + * html/LegacyHTMLDocumentParser.h: + (WebCore::LegacyHTMLDocumentParser::forceSynchronous): + (WebCore::LegacyHTMLDocumentParser::processingContentWrittenByScript): + * html/LegacyHTMLTreeBuilder.cpp: + (WebCore::LegacyHTMLTreeBuilder::reportErrorToConsole): + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::replaceDocument): + * loader/TextDocument.cpp: + +2010-05-28 Philippe Normand <pnormand@igalia.com> + + Reviewed by Gustavo Noronha. + + [GStreamer] multiple video sink support + https://bugs.webkit.org/show_bug.cgi?id=39472 + + Playbin2 video-sink is now a bin containing a tee element capable + of dispatching the buffers to multiple video sinks. By default + only our webkit video sink is used. This will allow + GStreamerGWorld to add support for autovideosink in the future. + + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): + (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): + (WebCore::MediaPlayerPrivateGStreamer::naturalSize): + (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: + +2010-06-24 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Sketch out AfterHeadMode for tree builder + https://bugs.webkit.org/show_bug.cgi?id=41191 + + This mode is fairly similar to the others. I needed to change some of + the types around w.r.t. Nodes/Elements. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + (WebCore::HTMLTreeBuilder::processToken): + (WebCore::HTMLTreeBuilder::insertElement): + * html/HTMLTreeBuilder.h: + (WebCore::HTMLTreeBuilder::ElementStack::push): + (WebCore::HTMLTreeBuilder::ElementStack::remove): + +2010-06-24 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Sketch out InHeadNoscriptMode for tree builder + https://bugs.webkit.org/show_bug.cgi?id=41189 + + Lots of notImplemented() calls in this state. I need to figure how to + delegate handling of a token from one state to another. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processToken): + +2010-06-24 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Sketch out InHeadMode for tree builder + https://bugs.webkit.org/show_bug.cgi?id=41184 + + This state is relatively straightforward. We introduce the stack of + open elements to track that notion in the spec. The old tree builder + has a nice data structure for that, which we'll probably steal, but I'd + like to see what the full API is first. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processToken): + (WebCore::HTMLTreeBuilder::insertCharacter): + (WebCore::HTMLTreeBuilder::insertGenericRCDATAElement): + (WebCore::HTMLTreeBuilder::insertGenericRawTextElement): + (WebCore::HTMLTreeBuilder::insertScriptElement): + * html/HTMLTreeBuilder.h: + (WebCore::HTMLTreeBuilder::ElementStack::pop): + (WebCore::HTMLTreeBuilder::ElementStack::top): + +2010-06-24 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Sketch out BeforeHeadMode tree builder state + https://bugs.webkit.org/show_bug.cgi?id=41183 + + This makes procesToken recursive, which might not be the best idea. + Also, we can now make fake AtomicHTMLTokens for use by the algorithm. + + * html/HTMLToken.h: + (WebCore::AtomicHTMLToken::AtomicHTMLToken): + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processToken): + (WebCore::HTMLTreeBuilder::insertElement): + * html/HTMLTreeBuilder.h: + +2010-06-22 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by David Hyatt. + + Add a NodeList-derivated wrapper class for a ListHashSet. + https://bugs.webkit.org/show_bug.cgi?id=41081 + + StaticHashSetList will work as a wrapper to ListHashSet objects that are + aimed to be exposed to the DOM. + + As a use case, the rect based HitTest (bug 40197) will store the retrieved nodes + in a ListHashSet. It is going to be exposed to the DOM through are nodesFromRect + of Document returning a NodeList (i.e. StatisHashSetList) wrapping a ListHashSet. + + No new tests. + +2010-06-24 Cris Neckar <cdn@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Out of bounds write in WebCore::PNGImageDecoder::rowAvailable + https://bugs.webkit.org/show_bug.cgi?id=40798 + + Catches error in row callback for libPNG when extra rows are returned. + + Test: fast/images/png-extra-row-crash.html + + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::rowAvailable): + +2010-06-24 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Clean up and document DocumentWriter::replaceDocument code path + https://bugs.webkit.org/show_bug.cgi?id=41182 + + No functional changes, thus no tests. + + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::replaceDocument): + - Remove comment which could be misleading. + +2010-06-23 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Implementing DatabaseSync::openDatabaseSync(). + https://bugs.webkit.org/show_bug.cgi?id=40607 + + Moved some common code from Database to AbstractDatabase. Made + performOpenAndVerify() virtual, since DatabaseSync doesn't need to + interact with DatabaseThread. Removed the m_creationCallback + field, since it's only needed in the openDatabase{Sync} methods. + + * storage/AbstractDatabase.cpp: + (WebCore::retrieveTextResultFromDatabase): + (WebCore::setTextValueInDatabase): + (WebCore::guidMutex): + (WebCore::guidToVersionMap): + (WebCore::updateGuidVersionMap): + (WebCore::guidToDatabaseMap): + (WebCore::guidForOriginAndName): + (WebCore::AbstractDatabase::databaseInfoTableName): + (WebCore::AbstractDatabase::AbstractDatabase): + (WebCore::AbstractDatabase::closeDatabase): + (WebCore::AbstractDatabase::version): + (WebCore::AbstractDatabase::performOpenAndVerify): + (WebCore::AbstractDatabase::scriptExecutionContext): + (WebCore::AbstractDatabase::securityOrigin): + (WebCore::AbstractDatabase::stringIdentifier): + (WebCore::AbstractDatabase::displayName): + (WebCore::AbstractDatabase::estimatedSize): + (WebCore::AbstractDatabase::fileName): + (WebCore::AbstractDatabase::databaseVersionKey): + (WebCore::AbstractDatabase::getVersionFromDatabase): + (WebCore::AbstractDatabase::setVersionInDatabase): + (WebCore::AbstractDatabase::versionMatchesExpected): + (WebCore::AbstractDatabase::setExpectedVersion): + (WebCore::AbstractDatabase::disableAuthorizer): + (WebCore::AbstractDatabase::enableAuthorizer): + (WebCore::AbstractDatabase::setAuthorizerReadOnly): + (WebCore::AbstractDatabase::lastActionChangedDatabase): + (WebCore::AbstractDatabase::lastActionWasInsert): + (WebCore::AbstractDatabase::resetDeletes): + (WebCore::AbstractDatabase::hadDeletes): + (WebCore::AbstractDatabase::resetAuthorizer): + * storage/AbstractDatabase.h: + (WebCore::AbstractDatabase::opened): + (WebCore::AbstractDatabase::isNew): + (WebCore::AbstractDatabase::databaseDebugName): + * storage/Database.cpp: + (WebCore::DatabaseCreationCallbackTask::create): + (WebCore::DatabaseCreationCallbackTask::performTask): + (WebCore::DatabaseCreationCallbackTask::DatabaseCreationCallbackTask): + (WebCore::Database::openDatabase): + (WebCore::Database::Database): + (WebCore::Database::version): + (WebCore::Database::openAndVerifyVersion): + (WebCore::Database::close): + (WebCore::Database::stop): + (WebCore::Database::performOpenAndVerify): + * storage/Database.h: + (WebCore::Database::sqliteDatabase): + * storage/DatabaseAuthorizer.cpp: + (WebCore::DatabaseAuthorizer::create): + (WebCore::DatabaseAuthorizer::DatabaseAuthorizer): + (WebCore::DatabaseAuthorizer::denyBasedOnTableName): + * storage/DatabaseAuthorizer.h: + * storage/DatabaseSync.cpp: + (WebCore::DatabaseSync::openDatabaseSync): + (WebCore::DatabaseSync::DatabaseSync): + (WebCore::DatabaseSync::changeVersion): + (WebCore::DatabaseSync::transaction): + (WebCore::DatabaseSync::markAsDeletedAndClose): + (WebCore::CloseSyncDatabaseOnContextThreadTask::create): + (WebCore::CloseSyncDatabaseOnContextThreadTask::performTask): + (WebCore::CloseSyncDatabaseOnContextThreadTask::CloseSyncDatabaseOnContextThreadTask): + (WebCore::DatabaseSync::closeImmediately): + * storage/DatabaseSync.h: + * storage/DatabaseTask.cpp: + (WebCore::DatabaseOpenTask::DatabaseOpenTask): + (WebCore::DatabaseOpenTask::doPerformTask): + * storage/DatabaseTask.h: + (WebCore::DatabaseOpenTask::create): + +2010-06-24 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * platform/network/cf/AuthenticationCF.h: + +2010-06-24 Martin Robinson <mrobinson@igalia.com> + + Unreviewed. Build fix. + + Fix the build after r61798. + + * platform/gtk/PasteboardHelper.cpp: + (WebCore::PasteboardHelper::getClipboardContents): + +2010-06-24 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Brady Eidson. + + https://bugs.webkit.org/show_bug.cgi?id=41178 + Timed refresh in subframes isn't stopped when going into b/f cache + + Test: fast/history/timed-refresh-in-cached-frame.html + + * history/CachedFrame.cpp: (WebCore::CachedFrame::CachedFrame): Top frame's stopLoading() + won't help cached subframes; stop loading from here. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::stopLoading): Don't stop loading in child frames. This didn't work + for cached frames due to frame tree having been already desonstructed, and it's not necessary + in non-cached case because stopLoading() will be called for subframes via + FrameLoader::detachFromParent() and closeURL(). + (WebCore::FrameLoader::pageHidden): This was a second code path that dispatched pagehide + event - it's no longer needed, because everything goes through FrameLoader::stopLoading(). + (WebCore::FrameLoader::commitProvisionalLoad): Don't call pageHidden(), the code for adding + frame to b/f cache will do everything. + + * loader/FrameLoader.h: Removed pageHidden(). + +2010-06-24 Eric Seidel <eric@webkit.org> + + Unreviewed. Fix the build. I am a bad man. + + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::replaceDocument): + +2010-06-24 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + Build fix for building against GTK+ 3.x. + + No new tests as functionality has not changed. + + * platform/gtk/GtkVersioning.h: + * platform/gtk/PasteboardHelper.cpp: + (WebCore::PasteboardHelper::getClipboardContents): + (WebCore::PasteboardHelper::fillSelectionData): + +2010-06-24 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Clean up and document DocumentWriter::replaceDocument code path + https://bugs.webkit.org/show_bug.cgi?id=41182 + + No functional change, thus no test. + + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::replaceDocument): + * loader/DocumentWriter.h: + +2010-06-24 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + Full-screened content doesn't keep the display on: Safari not grabbing a power assertion? + https://bugs.webkit.org/show_bug.cgi?id=40939 + rdar://problem/7996172 + + Export -[MediaElement playbackRate]; + + * WebCore.Video.exp: + +2010-06-21 Evan Martin <evan@chromium.org> + + Reviewed by Adam Barth. + + [chromium] overlapping characters in complex text + https://bugs.webkit.org/show_bug.cgi?id=40966 + + We need to clear all the buffers we hand to Harfbuzz before we use them. + While I'm here, refactor the code slightly to make its behavior more + clear and correct (previously, we would repeatedly double our buffer + size when we could have just sized it correctly on the second try). + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::TextRunWalker::TextRunWalker): + (WebCore::TextRunWalker::nextScriptRun): + (WebCore::TextRunWalker::createGlyphArrays): + (WebCore::TextRunWalker::shapeGlyphs): + +2010-06-24 Adele Peterson <adele@apple.com> + + Reviewed by Sam Weinig. + + Updated fix for <rdar://problem/8093680> "Paste and Match Style" should fire paste events + https://bugs.webkit.org/show_bug.cgi?id=41085 + + Covered by existing tests. + + * editing/EditorCommand.cpp: + (WebCore::executePasteAsPlainText): Added. + (WebCore::createCommandMap): Added pasteAsPlainText command. + +2010-06-24 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Sketch out BeforeHTMLMode state + https://bugs.webkit.org/show_bug.cgi?id=41133 + + In this patch, we switch the TreeBuidler over to using AtomicHTMLTokens + and sketch out another state. These states don't actually do anything + yet, I'm still just getting the structure of the spec into the code so + we can implement the details incrementally. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::constructTreeFromToken): + (WebCore::HTMLTreeBuilder::processToken): + (WebCore::HTMLTreeBuilder::insertDoctype): + (WebCore::HTMLTreeBuilder::insertComment): + * html/HTMLTreeBuilder.h: + (WebCore::HTMLTreeBuilder::parseError): + +2010-06-24 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add AtomicHTMLToken + https://bugs.webkit.org/show_bug.cgi?id=41131 + + We need an atomized version of the token for use in the tree builder. + Eventually, we should make the existing HTMLToken an internal detail of + the HTMLTokenizer. This new AtomicHTMLToken should be also be more + easily cached between the preload scanner and the tree builder. + + * html/HTMLToken.h: + (WebCore::AtomicHTMLToken::AtomicHTMLToken): + (WebCore::AtomicHTMLToken::type): + (WebCore::AtomicHTMLToken::name): + (WebCore::AtomicHTMLToken::selfClosing): + (WebCore::AtomicHTMLToken::attributes): + (WebCore::AtomicHTMLToken::characters): + (WebCore::AtomicHTMLToken::comment): + (WebCore::AtomicHTMLToken::publicIdentifier): + (WebCore::AtomicHTMLToken::systemIdentifier): + (WebCore::AtomicHTMLToken::forceQuirks): + * html/HTMLTreeBuilder.cpp: + (WebCore::convertToOldStyle): + (WebCore::HTMLTreeBuilder::passTokenToLegacyParser): + +2010-06-24 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Add RawDataDocumentParser to get rid of a bunch of copy/paste code in DocumentParser subclasses + https://bugs.webkit.org/show_bug.cgi?id=41136 + + I think this is likely far from the final design, + however this is almost entirely minus lines which is a + good thing. + + The original authors of these DocumentParser subclasses + seem to have just copied the files whole, as they all + had the same includes, many of which were unnecessary for + some of the files. + + I think eventually the FrameLoader will call a virtual + DocumentParser::appendData which will in turn decode + and call another write/appendData call. In the case + of these RawDataDocumentParsers, they will just override + the low-level appendData call instead of needing + DocumentWriter to have a special if based on + DocumentParser::wantsRawData. + + No functional change, thus no tests. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * dom/DocumentParser.h: + (WebCore::DocumentParser::writeRawData): + * loader/ImageDocument.cpp: + (WebCore::ImageDocumentParser::ImageDocumentParser): + (WebCore::ImageDocumentParser::finish): + * loader/MediaDocument.cpp: + (WebCore::MediaDocumentParser::MediaDocumentParser): + (WebCore::MediaDocumentParser::writeRawData): + * loader/PluginDocument.cpp: + (WebCore::PluginDocumentParser::PluginDocumentParser): + * loader/SinkDocument.cpp: + (WebCore::SinkDocument::createParser): + +2010-06-23 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Barth. + + REGRESSION (r61619): Memory corruption in open-source ICO decoder + https://bugs.webkit.org/show_bug.cgi?id=41107 + + * platform/image-decoders/bmp/BMPImageReader.cpp: + (WebCore::BMPImageReader::processInfoHeader): Fix memory corruption. + * platform/image-decoders/ico/ICOImageDecoder.cpp: + (WebCore::ICOImageDecoder::processDirectoryEntries): Handle sizing failure correctly (though failure should be impossible). + +2010-06-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61783. + http://trac.webkit.org/changeset/61783 + https://bugs.webkit.org/show_bug.cgi?id=41179 + + Caused a couple of test failures (Requested by japhet on + #webkit). + + * dom/DOMImplementation.cpp: + (WebCore::DOMImplementation::createDocument): + (WebCore::DOMImplementation::createHTMLDocument): + * dom/DOMImplementation.h: + * dom/Document.cpp: + (WebCore::Document::Document): + (WebCore::Document::initSecurityContext): + * dom/Document.h: + (WebCore::Document::create): + (WebCore::Document::createXHTML): + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::HTMLDocument): + * html/HTMLDocument.h: + (WebCore::HTMLDocument::create): + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument): + * html/HTMLViewSourceDocument.h: + (WebCore::HTMLViewSourceDocument::create): + * loader/CachedFont.cpp: + (WebCore::CachedFont::ensureSVGFontData): + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::createDocument): + (WebCore::DocumentWriter::begin): + * loader/DocumentWriter.h: + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): + * loader/FTPDirectoryDocument.h: + (WebCore::FTPDirectoryDocument::create): + * loader/ImageDocument.cpp: + (WebCore::ImageDocument::ImageDocument): + * loader/ImageDocument.h: + (WebCore::ImageDocument::create): + * loader/MediaDocument.cpp: + (WebCore::MediaDocument::MediaDocument): + * loader/MediaDocument.h: + (WebCore::MediaDocument::create): + * loader/PlaceholderDocument.h: + (WebCore::PlaceholderDocument::create): + (WebCore::PlaceholderDocument::PlaceholderDocument): + * loader/PluginDocument.cpp: + (WebCore::PluginDocument::PluginDocument): + * loader/PluginDocument.h: + (WebCore::PluginDocument::create): + * loader/SinkDocument.cpp: + (WebCore::SinkDocument::SinkDocument): + * loader/SinkDocument.h: + (WebCore::SinkDocument::create): + * loader/TextDocument.cpp: + (WebCore::TextDocument::TextDocument): + * loader/TextDocument.h: + (WebCore::TextDocument::create): + * svg/SVGDocument.cpp: + (WebCore::SVGDocument::SVGDocument): + * svg/SVGDocument.h: + (WebCore::SVGDocument::create): + * xml/DOMParser.cpp: + (WebCore::DOMParser::parseFromString): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::responseXML): + * xml/XSLTProcessor.cpp: + (WebCore::XSLTProcessor::createDocumentFromSource): + +2010-06-24 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Small code cleanup in RenderThemeGtk + https://bugs.webkit.org/show_bug.cgi?id=40989 + + Reduce the amount of duplicated code slightly and prepare this section for + future improvements, such as sharing the clipping rectangle calculation with + the slow path. + + No new tests as functionality has not changed. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::paintMozillaGtkWidget): Small code cleanup. + +2010-06-24 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Take a KURL parameter in Document's constructor. + This will remove the one case where Document::url() + and FrameLoader::url() are not equal, allowing us to + remove FrameLoader::url(). + + https://bugs.webkit.org/show_bug.cgi?id=41166 + + Refactor only, no new tests. + + * dom/DOMImplementation.cpp: + (WebCore::DOMImplementation::createDocument): Take a KURL and pass it through to Document. + (WebCore::DOMImplementation::createHTMLDocument): + * dom/DOMImplementation.h: + * dom/Document.cpp: + (WebCore::Document::Document): Call setURL() for non-empty KURL input parameters. + (WebCore::Document::initSecurityContext): m_url is now initialized, so use it instead + of m_frame->loader()->url() for initializing the SecurityOrigin. + * dom/Document.h: + (WebCore::Document::create): + (WebCore::Document::createXHTML): + * html/HTMLDocument.cpp: + * html/HTMLDocument.h: Add KURL parameter to create() and constructor. + * html/HTMLViewSourceDocument.cpp: + * html/HTMLViewSourceDocument.h: Add KURL parameter to create() and constructor. + * loader/CachedFont.cpp: + (WebCore::CachedFont::ensureSVGFontData): + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::createDocument): Take a KURL and pass it through to Document. + (WebCore::DocumentWriter::begin): Pass existing url parameter to constructors, and remove + redundant Document::setURL() call. + * loader/DocumentWriter.h: + * loader/FTPDirectoryDocument.cpp: + * loader/FTPDirectoryDocument.h: Add KURL parameter to create() and constructor. + * loader/ImageDocument.cpp: + * loader/ImageDocument.h: Add KURL parameter to create() and constructor. + * loader/MediaDocument.cpp: + * loader/MediaDocument.h: Add KURL parameter to create() and constructor. + * loader/PlaceholderDocument.h: Add KURL parameter to create() and constructor. + * loader/PluginDocument.cpp: + * loader/PluginDocument.h: Add KURL parameter to create() and constructor. + * loader/SinkDocument.cpp: + * loader/SinkDocument.h: Add KURL parameter to create() and constructor. + * loader/TextDocument.cpp: + * loader/TextDocument.h: Add KURL parameter to create() and constructor. + * svg/SVGDocument.cpp: + * svg/SVGDocument.h: Add KURL parameter to create() and constructor. + * xml/DOMParser.cpp: + (WebCore::DOMParser::parseFromString): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::responseXML): + * xml/XSLTProcessor.cpp: + (WebCore::XSLTProcessor::createDocumentFromSource): + +2010-06-24 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8044645> and https://bugs.webkit.org/show_bug.cgi?id=41082 + + Webarchives will null main resource cause a repro crash. + + Test: webarchive/loading/mainresource-null-mimetype-crash.html + + * loader/archive/cf/LegacyWebArchive.cpp: + (WebCore::LegacyWebArchive::createResource): Fail to create the archive resource if the main resource's + mime type is null. + +2010-06-24 Damian Kaleta <dkaleta@apple.com> + + Reviewed by Sam Weinig. + + Provide a way to obtain the rendered rectangle for box elements. + + * WebCore.base.exp: Export the symbol so we can see it in WebKit. + * dom/Node.cpp: + (WebCore::Node::renderRect): Added new ethod that will return a rendered rectangle for box elements. + * dom/Node.h: Ditto. + +2010-06-24 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Create specialized classes for Transform, + Image and WebGL layers to replace the rather monolithic LayerChromium class. + Layers can now own the GL texture they use for backing store and a different + shading program can be used by the compositor for each layer type. WebGL layers + are not yet hooked up to GraphicsContext3D. + https://bugs.webkit.org/show_bug.cgi?id=41106 + + * WebCore.gypi: + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::GraphicsLayerChromium): + (WebCore::GraphicsLayerChromium::setContentsToImage): + (WebCore::GraphicsLayerChromium::updateLayerPreserves3D): + * platform/graphics/chromium/GraphicsLayerChromium.h: + (WebCore::GraphicsLayerChromium::): + * platform/graphics/chromium/ImageLayerChromium.cpp: Added. + (WebCore::ImageLayerChromium::create): + (WebCore::ImageLayerChromium::ImageLayerChromium): + (WebCore::ImageLayerChromium::setContents): + (WebCore::ImageLayerChromium::updateTextureContents): + * platform/graphics/chromium/ImageLayerChromium.h: Added. + (WebCore::ImageLayerChromium::drawsContent): + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::create): + (WebCore::LayerChromium::LayerChromium): + (WebCore::LayerChromium::updateTextureContents): + (WebCore::LayerChromium::updateTextureRect): + * platform/graphics/chromium/LayerChromium.h: + (WebCore::LayerChromium::drawsContent): + (WebCore::LayerChromium::ownsTexture): + (WebCore::LayerChromium::textureId): + (WebCore::LayerChromium::setShaderProgramId): + (WebCore::LayerChromium::shaderProgramId): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::createLayerShader): + (WebCore::ShaderProgram::ShaderProgram): + (WebCore::LayerRendererChromium::LayerRendererChromium): + (WebCore::LayerRendererChromium::~LayerRendererChromium): + (WebCore::LayerRendererChromium::useShaderProgram): + (WebCore::LayerRendererChromium::drawTexturedQuad): + (WebCore::LayerRendererChromium::drawLayers): + (WebCore::LayerRendererChromium::drawDebugBorder): + (WebCore::LayerRendererChromium::updateLayersRecursive): + (WebCore::LayerRendererChromium::drawLayer): + (WebCore::LayerRendererChromium::bindCommonAttribLocations): + (WebCore::LayerRendererChromium::initializeSharedGLObjects): + * platform/graphics/chromium/LayerRendererChromium.h: + (WebCore::LayerRendererChromium::): + * platform/graphics/chromium/TransformLayerChromium.cpp: Added. + (WebCore::TransformLayerChromium::create): + (WebCore::TransformLayerChromium::TransformLayerChromium): + * platform/graphics/chromium/TransformLayerChromium.h: Added. + (WebCore::TransformLayerChromium::drawsContent): + * platform/graphics/chromium/WebGLLayerChromium.cpp: Added. + (WebCore::WebGLLayerChromium::WebGLLayerChromium): + (WebCore::WebGLLayerChromium::textureId): + (WebCore::WebGLLayerChromium::updateTextureContents): + (WebCore::WebGLLayerChromium::setContext): + * platform/graphics/chromium/WebGLLayerChromium.h: Added. + (WebCore::WebGLLayerChromium::drawsContent): + (WebCore::WebGLLayerChromium::ownsTexture): + (WebCore::WebGLLayerChromium::shaderProgramId): + (WebCore::WebGLLayerChromium::setShaderProgramId): + +2010-06-24 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Inspector cleanup + better DevTools alignment with Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=41094 + + - Removed a bunch of unused methods from all over the place + - Added client callbacks for states surviving navigation + - Implemented more user-friendly stub for InspectorFrontendHost.platform + + * inspector/InspectorClient.h: + (WebCore::InspectorClient::resourceTrackingWasEnabled): + (WebCore::InspectorClient::resourceTrackingWasDisabled): + (WebCore::InspectorClient::timelineProfilerWasStarted): + (WebCore::InspectorClient::timelineProfilerWasStopped): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::enableResourceTracking): + (WebCore::InspectorController::disableResourceTracking): + (WebCore::InspectorController::ensureSettingsLoaded): + (WebCore::InspectorController::startTimelineProfiler): + (WebCore::InspectorController::stopTimelineProfiler): + * inspector/InspectorFrontend.cpp: + * inspector/InspectorFrontend.h: + * inspector/front-end/InspectorBackendStub.js: + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.platform): + +2010-06-23 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=41099 + Assertion failure: !m_suspended when XMLHttpRequest fails + + This was a general problem with load failure timer not being deferred. + + Test: manual-tests/xhr-failure-behind-alert.html + + * manual-tests/xhr-failure-behind-alert.html: Added. + + * platform/network/ResourceHandle.cpp: + (WebCore::ResourceHandle::fireFailure): Added an empty case for NoFailure. Reset + m_scheduledFailureType to NoFailure when firing. + (WebCore::ResourceHandle::setDefersLoading): Stop failure timer when deferring, restart when + un-deferring loads. + + * platform/network/ResourceHandle.h: Renamed m_failureType to m_scheduledFailureType to + make it clear that it is only set when a timer is scheduled. + + * platform/network/ResourceHandleInternal.h: + (WebCore::ResourceHandleInternal::ResourceHandleInternal): Initialize m_scheduledFailureType + to NoFailure, so that we can look at it when un-deferring loads. + + * platform/network/android/ResourceHandleAndroid.cpp: + (WebCore::ResourceHandle::platformSetDefersLoading): + * platform/network/cf/ResourceHandleCFNet.cpp: + (WebCore::ResourceHandle::platformSetDefersLoading): + * platform/network/curl/ResourceHandleCurl.cpp: + (WebCore::ResourceHandle::platformSetDefersLoading): + * platform/network/mac/ResourceHandleMac.mm: + (WebCore::ResourceHandle::platformSetDefersLoading): + * platform/network/qt/ResourceHandleQt.cpp: + (WebCore::ResourceHandle::platformSetDefersLoading): + * platform/network/soup/ResourceHandleSoup.cpp: + Platform specific parts of setDefersLoading() are now in a separate function. + +2010-06-24 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: revert 61766. + + * inspector/InspectorClient.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::enableResourceTracking): + (WebCore::InspectorController::disableResourceTracking): + (WebCore::InspectorController::ensureSettingsLoaded): + (WebCore::InspectorController::startTimelineProfiler): + (WebCore::InspectorController::stopTimelineProfiler): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::setAttachedWindow): + * inspector/InspectorFrontend.h: + * inspector/front-end/InspectorBackendStub.js: + (.WebInspector.InspectorBackendStub.prototype.setAttachedWindowHeight): + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.platform): + +2010-06-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Inspector cleanup + better DevTools alignment with Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=41094 + + - Removed a bunch of unused methods from all over the place + - Added client callbacks for states surviving navigation + - Implemented more user-friendly stub for InspectorFrontendHost.platform + + * inspector/InspectorClient.h: + (WebCore::InspectorClient::resourceTrackingWasEnabled): + (WebCore::InspectorClient::resourceTrackingWasDisabled): + (WebCore::InspectorClient::timelineProfilerWasStarted): + (WebCore::InspectorClient::timelineProfilerWasStopped): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::enableResourceTracking): + (WebCore::InspectorController::disableResourceTracking): + (WebCore::InspectorController::ensureSettingsLoaded): + (WebCore::InspectorController::startTimelineProfiler): + (WebCore::InspectorController::stopTimelineProfiler): + * inspector/InspectorFrontend.cpp: + * inspector/InspectorFrontend.h: + * inspector/front-end/InspectorBackendStub.js: + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.platform): + +2010-06-24 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Inspector & SVG Text have problems, kids of RenderSVGText are not properly placed. + https://bugs.webkit.org/show_bug.cgi?id=41143 + + Simplify code path taken for SVG text in InspectorController, take the code path currently only used for RenderInline, + that just calls absoluteQuads(), and displays the result. Refactored code that all SVG renderers (except RenderSVGRoot) + take this code path -> highlighting now works as expected. + + Don't use absoluteClippedOverlowRect() in the various RenderSVG*::absoluteQuads() methods, as we're loosing floating-point precision. + Instead use localToAbsoluteQuad(strokeBoundingBox()) in order to highlight the unclipped, unfiltered, etc.. region that this renderer would paint. + + No new tests, as this is only manual testable - at least I didn't find any Inspector-Highlighting tests, if someone knows please mail me. + + * inspector/InspectorController.cpp: + (WebCore::drawHighlightForLineBoxesOrSVGRenderer): + (WebCore::InspectorController::drawNodeHighlight): + * rendering/RenderSVGBlock.cpp: + (WebCore::RenderSVGBlock::absoluteRects): ASSERT_NOT_REACHED() here. SVG should only be inspected through absoluteQuads(). + * rendering/RenderSVGBlock.h: Add absoluteRects() in this base class for RenderForeignObject/RenderSVGText. + * rendering/RenderSVGHiddenContainer.cpp: Remove absoluteRects() - RenderSVGModelObject already has it. + * rendering/RenderSVGHiddenContainer.h: Ditto. + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::absoluteRects): ASSERT_NOT_REACHED() here. + (WebCore::RenderSVGImage::absoluteQuads): Don't use absoluteClippedOverlowRect() but localToAbsoluteQuad(repaintRectInLocalCoordinates()). + * rendering/RenderSVGImage.h: + (WebCore::RenderSVGImage::objectBoundingBox): Inlined + * rendering/RenderSVGInline.cpp: + (WebCore::RenderSVGInline::absoluteQuads): Take RenderSVGText translation into account, allows inspecting <tspan>/<tref> etc. + * rendering/RenderSVGInline.h: + * rendering/RenderSVGModelObject.cpp: + (WebCore::RenderSVGModelObject::absoluteRects): ASSERT_NOT_REACHED() here. + (WebCore::RenderSVGModelObject::absoluteQuads): Don't use absoluteClippedOverlowRect() but localToAbsoluteQuad(repaintRectInLocalCoordinates()). + * rendering/RenderSVGModelObject.h: + * rendering/RenderSVGRoot.cpp: Fix typo in license s/aint/along. Need to touch this file in order to let Mac build. + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::mapLocalToContainer): Remove hack, which moved the transformState by x()/y(). Not needed anymore. + (WebCore::RenderSVGText::absoluteQuads): Proper implementation, respecting x/y translation. + * rendering/RenderSVGText.h: Reorder some functions. + * rendering/SVGRenderSupport.h: Removed last virtual function strokeBoundingBox(). + +2010-06-24 Kent Tamura <tkent@chromium.org> + + Unreviewed. Build fix for Tiger. + + * platform/mac/ThemeMac.mm: + (WebCore::setControlSize): + +2010-06-24 Kent Tamura <tkent@chromium.org> + + Unreviewed. Build fix for Tiger. + + * platform/mac/ThemeMac.mm: + (WebCore::setControlSize): + (WebCore::ThemeMac::inflateControlPaintRect): + +2010-06-24 Kent Tamura <tkent@chromium.org> + + Unreviewed. Build fix for Chromium Mac. + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::isSpeechEnabled): + +2010-06-24 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Symbian build fix. + + The QML WebKit integration needs to be part of QtWebKit.sis + + * WebCore.pro: Deploy qmlwebkitplugin.dll. + +2010-06-24 Satish Sampath <satish@chromium.org> + + Reviewed by Kent Tamura. + + Add a speech button to input elements, no rendering or actions yet. + + Speech Input: Add a speech button to text input element (no rendering or actions yet) + https://bugs.webkit.org/show_bug.cgi?id=40925 + + No new tests. Will create a layout test in a subsequent patch. + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSSelector.cpp: + (WebCore::CSSSelector::pseudoId): + (WebCore::nameToPseudoTypeMap): + (WebCore::CSSSelector::extractPseudoType): + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/CSSValueKeywords.in: + * css/html.css: + (input::-webkit-input-speech-button): + * dom/InputElement.h: + * html/HTMLAttributeNames.in: + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::isSpeechEnabled): + * html/HTMLInputElement.h: + * platform/ThemeTypes.h: + (WebCore::): + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::nodeAtPoint): + (WebCore::RenderTextControlSingleLine::forwardEvent): + (WebCore::RenderTextControlSingleLine::styleDidChange): + (WebCore::RenderTextControlSingleLine::hasControlClip): + (WebCore::RenderTextControlSingleLine::controlClipRect): + (WebCore::RenderTextControlSingleLine::textBlockWidth): + (WebCore::RenderTextControlSingleLine::preferredContentWidth): + (WebCore::RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight): + (WebCore::RenderTextControlSingleLine::createSubtreeIfNeeded): + (WebCore::RenderTextControlSingleLine::createSpeechButtonStyle): + (WebCore::RenderTextControlSingleLine::clientPaddingRight): + * rendering/RenderTextControlSingleLine.h: + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::adjustStyle): + (WebCore::RenderTheme::paint): + (WebCore::RenderTheme::paintBorderOnly): + (WebCore::RenderTheme::paintDecorations): + * rendering/TextControlInnerElements.cpp: + (WebCore::InputFieldSpeechButtonElement::InputFieldSpeechButtonElement): + (WebCore::InputFieldSpeechButtonElement::create): + (WebCore::InputFieldSpeechButtonElement::defaultEventHandler): + * rendering/TextControlInnerElements.h: + * rendering/style/RenderStyleConstants.h: + (WebCore::): + +2010-06-24 Kent Tamura <tkent@chromium.org> + + Reviewed by Adam Barth. + + [Mac] The upper button of <input type=number> has no visual effect on click + https://bugs.webkit.org/show_bug.cgi?id=38380 + + Because we have no ways to draw an NSStepperCell with its up button + highlighted, use HIThemeDrawButton() instead. + + Test: platform/mac/fast/forms/input-appearance-spinbutton-up.html + + * platform/mac/ThemeMac.mm: + (WebCore::controlSizeFromPixelSize): + New function. Made from a part of setControlSize(). + (WebCore::setControlSize): + (WebCore::convertControlStatesToThemeDrawState): + (WebCore::paintStepper): Use HITheme API instead of NSStepperCell. + (WebCore::ThemeMac::inflateControlPaintRect): + Use controlSizeFromPixelSize(). + +2010-06-24 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: implement layout tests for debugger + https://bugs.webkit.org/show_bug.cgi?id=40774 + + Test: inspector/debugger-pause-on-debugger-statement.html + + * bindings/js/ScriptDebugServer.cpp: remove unused obsolete code that deals with global listeners. + (WebCore::ScriptDebugServer::ScriptDebugServer): + (WebCore::ScriptDebugServer::removeListener): + (WebCore::ScriptDebugServer::dispatchFunctionToListeners): + (WebCore::ScriptDebugServer::pauseIfNeeded): + (WebCore::ScriptDebugServer::didAddListener): + (WebCore::ScriptDebugServer::didRemoveListener): + * bindings/js/ScriptDebugServer.h: + * platform/mac/EventLoopMac.mm: + (WebCore::EventLoop::cycle): wait at most 10ms for new event, otherwise layout tests would + hang because in their case there may be no events ever. + +2010-06-24 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Fixed evaluation & logging of null values in console. + Changed handling of null and undefined in ScriptValue::toString() + to match JSC bindings (i.e. "null" and "undefined" instead of ""). + https://bugs.webkit.org/show_bug.cgi?id=40980 + + * bindings/v8/ScriptValue.cpp: + (WebCore::ScriptValue::toString): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-06-24 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: live edit doesn't work when resource tracking is off + https://bugs.webkit.org/show_bug.cgi?id=41076 + + * inspector/front-end/ScriptView.js: + (WebInspector.ScriptView.prototype._sourceIDForLine): implement this method for ScriptView, + it's needed for editLine to work. + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Sketch out InitialMode of HTML5 tree builder + https://bugs.webkit.org/show_bug.cgi?id=41126 + + Transliterated from the spec. Currently doesn't do anything. Mostly + an experiment to see where this goes. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processToken): + (WebCore::HTMLTreeBuilder::insertDoctype): + (WebCore::HTMLTreeBuilder::insertComment): + * html/HTMLTreeBuilder.h: + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add all the HTML5 tree builder insertion modes + https://bugs.webkit.org/show_bug.cgi?id=41124 + + These are just copied verbatim from the spec. No tests because these + don't do anything yet. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + (WebCore::HTMLTreeBuilder::passTokenToLegacyParser): + * html/HTMLTreeBuilder.h: + (WebCore::HTMLTreeBuilder::): + +2010-06-23 Eric Seidel <eric@webkit.org> + + Unreviewed. Fix namespace indent. Just whitespace changes. + + * dom/DocumentParser.h: + (WebCore::DocumentParser::~DocumentParser): + (WebCore::DocumentParser::isExecutingScript): + (WebCore::DocumentParser::stopParsing): + (WebCore::DocumentParser::processingData): + (WebCore::DocumentParser::wantsRawData): + (WebCore::DocumentParser::writeRawData): + (WebCore::DocumentParser::wellFormed): + (WebCore::DocumentParser::lineNumber): + (WebCore::DocumentParser::columnNumber): + (WebCore::DocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::DocumentParser::htmlTreeBuilder): + (WebCore::DocumentParser::asHTMLDocumentParser): + (WebCore::DocumentParser::inViewSourceMode): + (WebCore::DocumentParser::setInViewSourceMode): + (WebCore::DocumentParser::document): + (WebCore::DocumentParser::xssAuditor): + (WebCore::DocumentParser::setXSSAuditor): + (WebCore::DocumentParser::DocumentParser): + +2010-06-23 Eric Seidel <eric@webkit.org> + + Unreviewed. Speculative build fix for Qt. + + Move Document* down onto DocumentParser, since every DocumentParser needs one. + https://bugs.webkit.org/show_bug.cgi?id=41117 + + XMLDocumentParserQt is a huge pile of donkey barf. + I can't believe I ever r+'d the creation of this pile of + copy/paste code. + + I clearly missed removing m_doc from this code as well and thus + broke Qt. + + We really need to fix both XMLDocumentParserLibxml2 and + XMLDocumentParserQt not to be so poorly abstracted so + that if we're going to have two of them they can at least + share some code. + + * dom/XMLDocumentParserQt.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + (WebCore::XMLDocumentParser::~XMLDocumentParser): + (WebCore::XMLDocumentParser::doWrite): + (WebCore::XMLDocumentParser::doEnd): + (WebCore::XMLDocumentParser::parse): + (WebCore::XMLDocumentParser::startDocument): + (WebCore::XMLDocumentParser::parseStartElement): + (WebCore::XMLDocumentParser::parseEndElement): + (WebCore::XMLDocumentParser::parseProcessingInstruction): + (WebCore::XMLDocumentParser::parseCdata): + (WebCore::XMLDocumentParser::parseComment): + (WebCore::XMLDocumentParser::parseDtd): + +2010-06-23 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Move Document* down onto DocumentParser, since every DocumentParser needs one. + https://bugs.webkit.org/show_bug.cgi?id=41117 + + This eliminated the need for document() on HTMLDocumentParser. + This paves the way for more code sharing between various + DocumentParser subclasses. + + * dom/DocumentParser.h: + (WebCore::DocumentParser::inViewSourceMode): + (WebCore::DocumentParser::setInViewSourceMode): + (WebCore::DocumentParser::document): + (WebCore::DocumentParser::DocumentParser): + * dom/XMLDocumentParser.cpp: + (WebCore::XMLDocumentParser::isWMLDocument): + (WebCore::XMLDocumentParser::pushCurrentNode): + (WebCore::XMLDocumentParser::popCurrentNode): + (WebCore::XMLDocumentParser::clearCurrentNodeStack): + (WebCore::XMLDocumentParser::enterText): + (WebCore::XMLDocumentParser::end): + (WebCore::XMLDocumentParser::insertErrorMessageBlock): + * dom/XMLDocumentParser.h: + * dom/XMLDocumentParserLibxml2.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + (WebCore::XMLDocumentParser::~XMLDocumentParser): + (WebCore::XMLDocumentParser::doWrite): + (WebCore::XMLDocumentParser::startElementNs): + (WebCore::XMLDocumentParser::endElementNs): + (WebCore::XMLDocumentParser::processingInstruction): + (WebCore::XMLDocumentParser::cdataBlock): + (WebCore::XMLDocumentParser::comment): + (WebCore::XMLDocumentParser::startDocument): + (WebCore::XMLDocumentParser::internalSubset): + (WebCore::XMLDocumentParser::initializeParserContext): + (WebCore::XMLDocumentParser::doEnd): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::HTMLDocumentParser): + * html/HTMLDocumentParser.h: + * html/LegacyHTMLDocumentParser.cpp: + (WebCore::LegacyHTMLDocumentParser::LegacyHTMLDocumentParser): + (WebCore::LegacyHTMLDocumentParser::begin): + (WebCore::LegacyHTMLDocumentParser::scriptHandler): + (WebCore::LegacyHTMLDocumentParser::scriptExecution): + (WebCore::LegacyHTMLDocumentParser::parseTag): + (WebCore::LegacyHTMLDocumentParser::continueProcessing): + (WebCore::LegacyHTMLDocumentParser::willWriteHTML): + (WebCore::LegacyHTMLDocumentParser::didWriteHTML): + (WebCore::LegacyHTMLDocumentParser::write): + (WebCore::LegacyHTMLDocumentParser::stopParsing): + (WebCore::LegacyHTMLDocumentParser::timerFired): + (WebCore::LegacyHTMLDocumentParser::end): + (WebCore::LegacyHTMLDocumentParser::processToken): + (WebCore::LegacyHTMLDocumentParser::processDoctypeToken): + (WebCore::LegacyHTMLDocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::LegacyHTMLDocumentParser::executeExternalScriptsIfReady): + (WebCore::LegacyHTMLDocumentParser::executeExternalScriptsTimerFired): + * html/LegacyHTMLDocumentParser.h: + * loader/ImageDocument.cpp: + (WebCore::ImageDocumentParser::ImageDocumentParser): + (WebCore::ImageDocumentParser::imageDocument): + (WebCore::ImageDocumentParser::write): + (WebCore::ImageDocumentParser::writeRawData): + (WebCore::ImageDocumentParser::finish): + (WebCore::ImageDocumentParser::finishWasCalled): + (WebCore::ImageDocumentParser::isWaitingForScripts): + (WebCore::ImageDocument::createParser): + * loader/MediaDocument.cpp: + (WebCore::MediaDocumentParser::MediaDocumentParser): + (WebCore::MediaDocumentParser::createDocumentStructure): + (WebCore::MediaDocumentParser::finish): + (WebCore::MediaDocumentParser::finishWasCalled): + * loader/PluginDocument.cpp: + (WebCore::PluginDocumentParser::PluginDocumentParser): + (WebCore::PluginDocumentParser::createDocumentStructure): + (WebCore::PluginDocumentParser::writeRawData): + (WebCore::PluginDocumentParser::finish): + (WebCore::PluginDocumentParser::finishWasCalled): + * loader/SinkDocument.cpp: + (WebCore::SinkDocumentParser::SinkDocumentParser): + * loader/TextDocument.cpp: + (WebCore::TextDocumentParser::TextDocumentParser): + (WebCore::TextDocumentParser::write): + (WebCore::TextDocumentParser::finish): + (WebCore::TextDocumentParser::finishWasCalled): + +2010-06-23 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Start to clean up DocumentParser interface + https://bugs.webkit.org/show_bug.cgi?id=41114 + + The first of many cleanups needed to the DocumentParser + interface. Rename executingScript() to isExecutingScript() + and make it return a bool instead of an int. Also added a + FIXME to XMLDocumentParser about implementing it and did + some minor other cleanup to the XMLDocumentParser header. + + No functional change, thus no tests. + + * dom/Document.cpp: + (WebCore::Document::open): + * dom/DocumentParser.h: + (WebCore::DocumentParser::isExecutingScript): + * dom/XMLDocumentParser.h: + (WebCore::XMLDocumentParser::wellFormed): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::attemptToEnd): + (WebCore::HTMLDocumentParser::endIfDelayed): + (WebCore::HTMLDocumentParser::isExecutingScript): + * html/HTMLDocumentParser.h: + * html/LegacyHTMLDocumentParser.h: + (WebCore::LegacyHTMLDocumentParser::isExecutingScript): + +2010-06-22 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Simon Fraser. + + Implement IDL attribute for HTML5 hidden + https://bugs.webkit.org/show_bug.cgi?id=41039 + + Test: fast/html/hidden-attr-dom.html + + * html/HTMLElement.idl: Just add to the IDL file. [Reflect] takes + care of the rest. + +2010-06-23 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Chris Fleizach. + + [Gtk] nameFromChildren is obsolete + https://bugs.webkit.org/show_bug.cgi?id=36128 + + Look to the AtkText interface implemented by the objects in + question. + + Test: platform/gtk/accessibility/name-from-label.html + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_get_name): + (webkit_accessible_table_get_column_description): + (webkit_accessible_table_get_row_description): + +2010-06-23 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Port FileSystem + https://bugs.webkit.org/show_bug.cgi?id=34323 + + Port FileSystem with IFileMgr interface. + + * platform/FileSystem.h: + * platform/brew/FileSystemBrew.cpp: Added. + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::fileExists): + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::pathByAppendingComponent): + (WebCore::fileSystemRepresentation): + (WebCore::canonicalPath): + (WebCore::makeAllDirectories): + (WebCore::homeDirectoryPath): + (WebCore::pathGetFileName): + (WebCore::directoryName): + (WebCore::openTemporaryFile): + (WebCore::closeFile): + (WebCore::writeToFile): + (WebCore::unloadModule): + (WebCore::listDirectory): + +2010-06-23 Alexendar Pavlov <apavlov@chromium.org> + + Reviewed by David Hyatt. + + Swap checks in Position::isCandidate so that the less expensive + nodeIsUserSelectNode (node && node->renderer() && + node->renderer()->style()->userSelect() == SELECT_NONE) came first. + + (Was Web Inspector: Hangup when expanding elements with enormous + text node content in Elements panel). + + https://bugs.webkit.org/show_bug.cgi?id=35926 + + * dom/Position.cpp: + (WebCore::Position::isCandidate): + * dom/PositionIterator.cpp: + (WebCore::PositionIterator::isCandidate): + +2010-06-23 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Add PopupMenu implementation + https://bugs.webkit.org/show_bug.cgi?id=40226 + + Delegate PopupMenu handling to ChromeClientBrew. + + * page/brew/ChromeClientBrew.h: Added. + * platform/PopupMenu.h: + * platform/brew/PopupMenuBrew.cpp: Added. + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + +2010-06-23 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Implement format conversions in texImage2D and texSubImage2D taking HTML data + https://bugs.webkit.org/show_bug.cgi?id=40319 + + Generalized code supporting premultiplication of alpha and + vertical flip to pack texture data into requested format and type. + Handled incoming image data of various formats, RGBA and BGRA in + particular, both to reduce the number of temporary copies during + texture upload and to support premultiplying alpha for the + texImage2D and texSubImage2D entry points taking ArrayBufferView + in a subsequent bug. Added test case exercising all combinations + of format/type combinations, premultiplication of alpha, and + Image/ImageData upload. (Incorporated pnglib.js under + fast/canvas/webgl/resources/ to be able to generate Image elements + programmatically.) Tested in Safari on Mac OS X and in Chromium on + Mac OS X, Windows and Linux. + + Test: fast/canvas/webgl/tex-image-with-format-and-type.html + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::readPixels): + (WebCore::WebGLRenderingContext::texImage2DImpl): + (WebCore::WebGLRenderingContext::texImage2D): + (WebCore::WebGLRenderingContext::texSubImage2DImpl): + (WebCore::WebGLRenderingContext::texSubImage2D): + (WebCore::WebGLRenderingContext::validateTexFuncFormatAndType): + (WebCore::WebGLRenderingContext::validateTexFuncParameters): + * platform/graphics/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::computeFormatAndTypeParameters): + (WebCore::GraphicsContext3D::extractImageData): + (WebCore::GraphicsContext3D::flipVertically): + (WebCore::doUnpackingAndPacking): + (WebCore::doPacking): + (WebCore::GraphicsContext3D::packPixels): + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + * platform/graphics/cg/GraphicsContext3DCG.cpp: + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/mac/GraphicsContext3DMac.mm: + (WebCore::narrowInternalFormat): + (WebCore::GraphicsContext3D::texImage2D): + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/skia/GraphicsContext3DSkia.cpp: + (WebCore::GraphicsContext3D::getImageData): + +2010-06-23 Stephen White <senorblanco@chromium.org> + + Unreviewed; correcting bad patch. + + In my haste to land r61710, I mistakenly landed the wrong version, in + which a chunk of code was moved. This patch moves that chunk of code + to where it was in the patch that was reviewed. Mea culpa. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::ImageQualityController::shouldPaintAtLowQuality): + +2010-06-23 Stephen White <senorblanco@chromium.org> + + Reviewed by David Hyatt. + + This is a tweak to the resize algorithm introduced in r61341, and + is a fix for the regression described in + https://bugs.webkit.org/show_bug.cgi?id=41036 + + The goal is to bring back the some of old behaviour, without regressing + too much of the performance gains in r61341. + + The old algorithm was: + - on first resize, draw in high quality and record the paint time + - if we've already drawn at this size, use the same quality as last time + - on subsequent resizes, if the resize occurs within X ms of the + previous one, draw at low quality and set a timer (one timer per + image). + - when each timer expires, draw that image at high quality + + The r61341 algorithm was: + - on first resize, draw the image in low quality, add it to a list of + resized images, and set a timer (one timer for all images) + - when the timer expires, redraw all resized images in high quality + + The new algorithm is: + - on first resize, if no other animated resizes are outstanding, draw in + high quality and set the timer (one timer for all images) + - if any images have been resized to two different sizes in the last + X ms, draw all resized images in low quality and kick the timer + forward + - when the timer expires, if any animated resizes occured, redraw all + resized images in high quality, and reset the flag + + This should cause GUIMark and the IE9 demos to have good performance + after the first frame, while other pages with only static resizes + should be unaffected. + + * rendering/RenderBoxModelObject.cpp: + Change the LastPaintTimeMap to a LastPaintSizeMap: we now record the + last size an image was resized to, rather than the time it was painted + (the time actually became redundant in r61341 when I added the + check for m_timer.isActive(): we only care if anything is resizing + while the timer is active). + (WebCore::ImageQualityController::ImageQualityController): + Add an initializer for the m_animatedResizeIsActive flag. + (WebCore::ImageQualityController::objectDestroyed): + Reset the m_animatedResizeIsActive flag if this was the last object + in the list. + (WebCore::ImageQualityController::highQualityRepaintTimerFired): + Only repaint all the images if there was an animated resize (otherwise, + everything is already high quality). + (WebCore::ImageQualityController::shouldPaintAtLowQuality): + Implement the above algorithm. + +2010-06-23 Abhishek Arya <inferno@chromium.org> + + Reviewed by Kenneth Rohde Christiansen. + + Bad cast after DOM mutation in RenderMenuList + https://bugs.webkit.org/show_bug.cgi?id=40828 + + Firing the onchange event on select which changes its size > 1 causes the select + object to change from a menulist to a listbox. However, when propogating the events, + we do a bad cast assuming the object will remain a menulist. Added proper checks to + make sure we check the renderer after the onchange is fired and propogate the event + based on correct object type. + + Test: fast/events/select-onchange-crash.html + + * dom/SelectElement.cpp: + (WebCore::SelectElement::setSelectedIndex): + +2010-06-23 Andy Estes <aestes@apple.com> + + Reviewed by Alexey Proskuryakov. + + <rdar://problem/8107855> Prevent a crash in WebCore when removing an + object element with an invalid data URL in in a listener to its + beforeload event. + https://bugs.webkit.org/show_bug.cgi?id=41054 + + Tests: fast/dom/beforeload/remove-bad-object-in-beforeload-listener.html + + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::renderFallbackContent): Exit early if the + object element is not in the document. + * rendering/RenderEmbeddedObject.cpp: + (WebCore::RenderEmbeddedObject::updateWidget): If RenderWidget::destroy() + was called during processing of onbeforeload, do not proceed with loading + the object. + +2010-06-23 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [gtk] web fonts not loaded properly in scribd html5 reader + https://bugs.webkit.org/show_bug.cgi?id=38758 + + Drop filling the pattern with default values, because this + restricts the matching more than we want. + + * platform/graphics/cairo/FontCacheCairo.cpp: + (WebCore::FontCache::createFontPlatformData): + +2010-06-23 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [gtk] web fonts not loaded properly in scribd html5 reader + https://bugs.webkit.org/show_bug.cgi?id=38758 + + Also special-case `sans' amd `mono', which are aliases commonly + used in GTK+ applications. + + * platform/graphics/cairo/FontCacheCairo.cpp: + (WebCore::isWellKnownFontName): + +2010-06-23 Justin Schuh <jschuh@chromium.org> + + Unreviewed, rolling out r61695. + http://trac.webkit.org/changeset/61695 + https://bugs.webkit.org/show_bug.cgi?id=40798 + + 61695 broke all the Linux builds. + + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::rowAvailable): + +2010-06-23 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Fix PluginViewNone.cpp compilation for ports that also compile PluginView.cpp + https://bugs.webkit.org/show_bug.cgi?id=37939 + + * plugins/PluginViewNone.cpp: + (WebCore::PluginView::handleFocusInEvent): + (WebCore::PluginView::handleFocusOutEvent): + (WebCore::PluginView::keepAlive): + (WebCore::PluginView::privateBrowsingStateChanged): + (WebCore::PluginView::setJavaScriptPaused): + +2010-06-23 Cris Neckar <cdn@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Out of bounds write in WebCore::PNGImageDecoder::rowAvailable + https://bugs.webkit.org/show_bug.cgi?id=40798 + + Catches error in row callback for libPNG when extra rows are returned. + + Test: fast/images/png-extra-row-crash.html + + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::rowAvailable): + +2010-06-23 James Robinson <jamesr@chromium.org> + + Reviewed by Dan Bernstein. + + Do not set needsLayout when the style attribute changes on an SVG element + https://bugs.webkit.org/show_bug.cgi?id=40366 + + SVGSVGElement::svgAttributeChanged was incorrectly calling renderer()->setNeedsLayout(true) + whenever the styleAttr changed on its element. This could happen during layout in some + circumstances due to lazy style attribute synchronization. When it did, it could cause the + layout flags to become inconsistent. See the test case for details. + + Changes to an element's style attribute always mark an element as needing layout anyway so + this call was redundant. + + Test: fast/repaint/svg-layout-root-style-attr-update.html + + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::isKnownAttribute): + +2010-06-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + r61215 broke Acid3 + https://bugs.webkit.org/show_bug.cgi?id=41034 + + The code added in r61215, which tests whether the root renderer will fill + the entire viewport, should not run for subframes. So bail from + RenderView::paintBoxDecorations() if document()->ownerElement() is not null. + The old code was trying to do this by checking 'elt', but that ends up as + null after the for loop above. + + We can also bail early if the is no FrameView(). + + Test: fast/frames/paint-iframe-background.html + + * rendering/RenderView.cpp: + (WebCore::RenderView::paintBoxDecorations): + +2010-06-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: do not reset profiles panel on navigation. + + https://bugs.webkit.org/show_bug.cgi?id=41068 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didCommitLoad): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::resetProfilesPanel): + * inspector/InspectorFrontend.h: + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel): + (WebInspector.ProfilesPanel.prototype.populateInterface): + (WebInspector.ProfilesPanel.prototype.profilerWasDisabled): + (WebInspector.ProfilesPanel.prototype._reset): + (WebInspector.ProfilesPanel.prototype._clearProfiles): + * inspector/front-end/inspector.js: + (WebInspector.resetProfilesPanel): + +2010-06-23 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: InspectorController should be added only once as ScriptDebugListener to + ScriptDebugServer. + https://bugs.webkit.org/show_bug.cgi?id=41070 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::connectFrontend): + (WebCore::InspectorController::disconnectFrontend): + (WebCore::InspectorController::enableDebuggerFromFrontend): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): don't call InspectorBackend.enableDebugger if debugger is always enabled, + InspectorController will do this on its side when the front end is connected. + +2010-06-23 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Clear breakpoints before restoring them, not after. + https://bugs.webkit.org/show_bug.cgi?id=41071 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::enableDebuggerFromFrontend): + +2010-06-23 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Do not render the full frame when there is some elements with fixed positioning + https://bugs.webkit.org/show_bug.cgi?id=33150 + + Do not render the full frame when there is some elements with fixed positioning + https://bugs.webkit.org/show_bug.cgi?id=33150 + + The frame view take into acount the list of fixed object when scrolling + the view. If the number of object is lower than a certain threshold, the pixel + are blitted, and the invalidated area updated. + + * page/FrameView.cpp: + (WebCore::FrameView::addFixedObject): + (WebCore::FrameView::removeFixedObject): + (WebCore::FrameView::scrollContentsFastPath): + * page/FrameView.h: + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollContents): + (WebCore::ScrollView::scrollContentsFastPath): + * platform/ScrollView.h: + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::repaintRectIncludingDescendants): + * rendering/RenderLayer.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::styleWillChange): + +2010-06-23 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Fix displaying of several CPU profiles with the same name. + + https://bugs.webkit.org/show_bug.cgi?id=40992 + + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfileGroupSidebarTreeElement.prototype.onselect): + +2010-06-23 Adam Barth <abarth@webkit.org> + + Unreviewed. clean-header-guards that were made dirty by recent + renames. + + * html/HTMLDocumentParser.h: + * html/HTMLPreloadScanner.h: + * html/HTMLTokenizer.h: + * html/HTMLTreeBuilder.h: + * html/LegacyHTMLDocumentParser.h: + * html/LegacyHTMLTreeBuilder.h: + * html/LegacyPreloadScanner.h: + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename LegacyHTMLTreeConstructor to LegacyHTMLTreeBuilder + https://bugs.webkit.org/show_bug.cgi?id=41053 + + There was some debate about whether to call this class (and the + non-legacy version) "tree builder" or "tree constructor". Maciej + pointed out that other implementations (including Mozilla and HTML5Lib) + call it a tree builder. The path of least resistance seems to be call + it that for now. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/Document.cpp: + * dom/DocumentParser.h: + (WebCore::DocumentParser::htmlTreeConstructor): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::htmlTreeConstructor): + * html/HTMLDocumentParser.h: + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::removedFromTree): + * html/HTMLInputElement.cpp: + * html/HTMLMeterElement.cpp: + * html/HTMLProgressElement.cpp: + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + * html/HTMLTreeBuilder.h: + (WebCore::HTMLTreeBuilder::legacyTreeConstructor): + * html/LegacyHTMLDocumentParser.cpp: + (WebCore::LegacyHTMLDocumentParser::LegacyHTMLDocumentParser): + * html/LegacyHTMLDocumentParser.h: + (WebCore::LegacyHTMLDocumentParser::htmlTreeConstructor): + * html/LegacyHTMLTreeBuilder.cpp: Copied from WebCore/html/LegacyHTMLTreeConstructor.cpp. + (WebCore::LegacyHTMLTreeBuilder::LegacyHTMLTreeBuilder): + (WebCore::LegacyHTMLTreeBuilder::~LegacyHTMLTreeBuilder): + (WebCore::LegacyHTMLTreeBuilder::reset): + (WebCore::LegacyHTMLTreeBuilder::setCurrent): + (WebCore::LegacyHTMLTreeBuilder::limitDepth): + (WebCore::LegacyHTMLTreeBuilder::insertNodeAfterLimitDepth): + (WebCore::LegacyHTMLTreeBuilder::parseToken): + (WebCore::LegacyHTMLTreeBuilder::parseDoctypeToken): + (WebCore::LegacyHTMLTreeBuilder::insertNode): + (WebCore::LegacyHTMLTreeBuilder::handleError): + (WebCore::LegacyHTMLTreeBuilder::textCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::commentCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::headCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::bodyCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::framesetCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::formCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::isindexCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::selectCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::ddCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::dtCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::rpCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::rtCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::nestedCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::nestedPCloserCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::nestedStyleCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::tableCellCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::tableSectionCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::noembedCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::noframesCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::noscriptCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::pCloserCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::pCloserStrictCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::mapCreateErrorCheck): + (WebCore::LegacyHTMLTreeBuilder::getNode): + (WebCore::LegacyHTMLTreeBuilder::allowNestedRedundantTag): + (WebCore::LegacyHTMLTreeBuilder::processCloseTag): + (WebCore::LegacyHTMLTreeBuilder::isHeadingTag): + (WebCore::LegacyHTMLTreeBuilder::isInline): + (WebCore::LegacyHTMLTreeBuilder::isResidualStyleTag): + (WebCore::LegacyHTMLTreeBuilder::isAffectedByResidualStyle): + (WebCore::LegacyHTMLTreeBuilder::handleResidualStyleCloseTagAcrossBlocks): + (WebCore::LegacyHTMLTreeBuilder::reopenResidualStyleTags): + (WebCore::LegacyHTMLTreeBuilder::pushBlock): + (WebCore::LegacyHTMLTreeBuilder::popBlock): + (WebCore::LegacyHTMLTreeBuilder::popOneBlockCommon): + (WebCore::LegacyHTMLTreeBuilder::popOneBlock): + (WebCore::LegacyHTMLTreeBuilder::moveOneBlockToStack): + (WebCore::LegacyHTMLTreeBuilder::checkIfHasPElementInScope): + (WebCore::LegacyHTMLTreeBuilder::popInlineBlocks): + (WebCore::LegacyHTMLTreeBuilder::freeBlock): + (WebCore::LegacyHTMLTreeBuilder::createHead): + (WebCore::LegacyHTMLTreeBuilder::handleIsindex): + (WebCore::LegacyHTMLTreeBuilder::startBody): + (WebCore::LegacyHTMLTreeBuilder::finished): + (WebCore::LegacyHTMLTreeBuilder::reportErrorToConsole): + * html/LegacyHTMLTreeBuilder.h: Copied from WebCore/html/LegacyHTMLTreeConstructor.h. + * html/LegacyHTMLTreeConstructor.cpp: Removed. + * html/LegacyHTMLTreeConstructor.h: Removed. + * html/StepRange.cpp: + * html/ValidityState.cpp: + * rendering/RenderSlider.cpp: + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename the preload scanners + https://bugs.webkit.org/show_bug.cgi?id=41052 + + Renames PreloadScanner to LegacyPreloadScanner because this code is now + off by default. Also, rename HTML5PreloadScanner to + HTMLPreloadScanner. We're not calling it PreloadScanner because we've + factored out the CSSPreloadScanner and the HTMLPreloadScanner from the + original PreloadScanner. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTML5PreloadScanner.cpp: Removed. + * html/HTML5PreloadScanner.h: Removed. + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::pumpTokenizer): + * html/HTMLDocumentParser.h: + * html/HTMLPreloadScanner.cpp: Copied from WebCore/html/HTML5PreloadScanner.cpp. + (WebCore::HTMLPreloadScanner::HTMLPreloadScanner): + (WebCore::HTMLPreloadScanner::appendToEnd): + (WebCore::HTMLPreloadScanner::scan): + (WebCore::HTMLPreloadScanner::processToken): + (WebCore::HTMLPreloadScanner::scanningBody): + * html/HTMLPreloadScanner.h: Copied from WebCore/html/HTML5PreloadScanner.h. + * html/LegacyHTMLDocumentParser.cpp: + (WebCore::LegacyHTMLDocumentParser::scriptHandler): + (WebCore::LegacyHTMLDocumentParser::scriptExecution): + * html/LegacyHTMLDocumentParser.h: + * html/LegacyPreloadScanner.cpp: Copied from WebCore/html/PreloadScanner.cpp. + (WebCore::LegacyPreloadScanner::LegacyPreloadScanner): + (WebCore::LegacyPreloadScanner::~LegacyPreloadScanner): + (WebCore::LegacyPreloadScanner::begin): + (WebCore::LegacyPreloadScanner::end): + (WebCore::LegacyPreloadScanner::reset): + (WebCore::LegacyPreloadScanner::scanningBody): + (WebCore::LegacyPreloadScanner::write): + (WebCore::LegacyPreloadScanner::clearLastCharacters): + (WebCore::LegacyPreloadScanner::rememberCharacter): + (WebCore::LegacyPreloadScanner::lastCharactersMatch): + (WebCore::LegacyPreloadScanner::consumeEntity): + (WebCore::LegacyPreloadScanner::tokenize): + (WebCore::LegacyPreloadScanner::processAttribute): + (WebCore::LegacyPreloadScanner::emitCharacter): + (WebCore::LegacyPreloadScanner::tokenizeCSS): + (WebCore::LegacyPreloadScanner::emitTag): + (WebCore::LegacyPreloadScanner::emitCSSRule): + * html/LegacyPreloadScanner.h: Copied from WebCore/html/PreloadScanner.h. + * html/PreloadScanner.cpp: Removed. + * html/PreloadScanner.h: Removed. + * page/XSSAuditor.cpp: + (WebCore::XSSAuditor::decodeHTMLEntities): + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Yet more HTML5 => HTML renames + https://bugs.webkit.org/show_bug.cgi?id=41051 + + This patch renames HTML5DocumentParser to HTMLDocumentParser and + HTML5TreeBuilder to HTMLTreeBuilder. There was some discussion about + whether to use the name HTMLTreeBuilder or HTMLTreeConstructor, but + tree builder seems to be the dominate name in other implementations. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/DocumentFragment.cpp: + (WebCore::DocumentFragment::parseHTML): + * html/HTML5DocumentParser.cpp: Removed. + * html/HTML5DocumentParser.h: Removed. + * html/HTML5PreloadScanner.cpp: + (WebCore::HTML5PreloadScanner::scan): + (WebCore::HTML5PreloadScanner::processToken): + * html/HTML5TreeBuilder.cpp: Removed. + * html/HTML5TreeBuilder.h: Removed. + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::createParser): + * html/HTMLDocumentParser.cpp: Copied from WebCore/html/HTML5DocumentParser.cpp. + (WebCore::HTMLDocumentParser::HTMLDocumentParser): + (WebCore::HTMLDocumentParser::~HTMLDocumentParser): + (WebCore::HTMLDocumentParser::begin): + (WebCore::HTMLDocumentParser::stopParsing): + (WebCore::HTMLDocumentParser::processingData): + (WebCore::HTMLDocumentParser::pumpTokenizerIfPossible): + (WebCore::HTMLDocumentParser::isScheduledForResume): + (WebCore::HTMLDocumentParser::resumeParsingAfterYield): + (WebCore::HTMLDocumentParser::runScriptsForPausedTreeConstructor): + (WebCore::HTMLDocumentParser::pumpTokenizer): + (WebCore::HTMLDocumentParser::willPumpLexer): + (WebCore::HTMLDocumentParser::didPumpLexer): + (WebCore::HTMLDocumentParser::write): + (WebCore::HTMLDocumentParser::end): + (WebCore::HTMLDocumentParser::attemptToEnd): + (WebCore::HTMLDocumentParser::endIfDelayed): + (WebCore::HTMLDocumentParser::finish): + (WebCore::HTMLDocumentParser::finishWasCalled): + (WebCore::HTMLDocumentParser::executingScript): + (WebCore::HTMLDocumentParser::inScriptExecution): + (WebCore::HTMLDocumentParser::lineNumber): + (WebCore::HTMLDocumentParser::columnNumber): + (WebCore::HTMLDocumentParser::htmlTreeConstructor): + (WebCore::HTMLDocumentParser::isWaitingForScripts): + (WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution): + (WebCore::HTMLDocumentParser::watchForLoad): + (WebCore::HTMLDocumentParser::stopWatchingForLoad): + (WebCore::HTMLDocumentParser::shouldLoadExternalScriptFromSrc): + (WebCore::HTMLDocumentParser::notifyFinished): + (WebCore::HTMLDocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::HTMLDocumentParser::script): + * html/HTMLDocumentParser.h: Copied from WebCore/html/HTML5DocumentParser.h. + * html/HTMLParserScheduler.cpp: + (WebCore::HTMLParserScheduler::HTMLParserScheduler): + * html/HTMLParserScheduler.h: + * html/HTMLTreeBuilder.cpp: Copied from WebCore/html/HTML5TreeBuilder.cpp. + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + (WebCore::HTMLTreeBuilder::~HTMLTreeBuilder): + (WebCore::HTMLTreeBuilder::handleScriptStartTag): + (WebCore::HTMLTreeBuilder::handleScriptEndTag): + (WebCore::HTMLTreeBuilder::takeScriptToProcess): + (WebCore::HTMLTreeBuilder::adjustedLexerState): + (WebCore::HTMLTreeBuilder::passTokenToLegacyParser): + (WebCore::HTMLTreeBuilder::constructTreeFromToken): + (WebCore::HTMLTreeBuilder::processToken): + (WebCore::HTMLTreeBuilder::finished): + (WebCore::HTMLTreeBuilder::isScriptingFlagEnabled): + * html/HTMLTreeBuilder.h: Copied from WebCore/html/HTML5TreeBuilder.h. + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + More HTML5 => HTML renames + https://bugs.webkit.org/show_bug.cgi?id=41049 + + This patch renames HTML5ScriptRunner, HTML5ScriptRunnerHost, and + HTML5Token to remove the "5" from their names. These clases aren't + specific to HTML5 and will be used going forward. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/CSSPreloadScanner.cpp: + (WebCore::CSSPreloadScanner::scan): + * html/CSSPreloadScanner.h: + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::notifyFinished): + * html/HTML5DocumentParser.h: + * html/HTML5PreloadScanner.cpp: + (WebCore::HTMLNames::PreloadTask::PreloadTask): + (WebCore::HTMLNames::PreloadTask::processAttributes): + (WebCore::HTML5PreloadScanner::processToken): + * html/HTML5PreloadScanner.h: + * html/HTML5ScriptRunner.cpp: Removed. + * html/HTML5ScriptRunner.h: Removed. + * html/HTML5ScriptRunnerHost.h: Removed. + * html/HTML5Token.h: Removed. + * html/HTML5TreeBuilder.cpp: + (WebCore::convertToOldStyle): + (WebCore::HTML5TreeBuilder::handleScriptEndTag): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + (WebCore::HTML5TreeBuilder::constructTreeFromToken): + (WebCore::HTML5TreeBuilder::processToken): + * html/HTML5TreeBuilder.h: + * html/HTMLScriptRunner.cpp: Copied from WebCore/html/HTML5ScriptRunner.cpp. + (WebCore::HTMLScriptRunner::HTMLScriptRunner): + (WebCore::HTMLScriptRunner::~HTMLScriptRunner): + (WebCore::HTMLScriptRunner::sourceFromPendingScript): + (WebCore::HTMLScriptRunner::isPendingScriptReady): + (WebCore::HTMLScriptRunner::executePendingScript): + (WebCore::HTMLScriptRunner::executeScript): + (WebCore::HTMLScriptRunner::hasScriptsWaitingForLoad): + (WebCore::HTMLScriptRunner::watchForLoad): + (WebCore::HTMLScriptRunner::stopWatchingForLoad): + (WebCore::HTMLScriptRunner::execute): + (WebCore::HTMLScriptRunner::haveParsingBlockingScript): + (WebCore::HTMLScriptRunner::executeParsingBlockingScripts): + (WebCore::HTMLScriptRunner::executeScriptsWaitingForLoad): + (WebCore::HTMLScriptRunner::executeScriptsWaitingForStylesheets): + (WebCore::HTMLScriptRunner::requestScript): + (WebCore::HTMLScriptRunner::runScript): + * html/HTMLScriptRunner.h: Copied from WebCore/html/HTML5ScriptRunner.h. + * html/HTMLScriptRunnerHost.h: Copied from WebCore/html/HTML5ScriptRunnerHost.h. + (WebCore::HTMLScriptRunnerHost::~HTMLScriptRunnerHost): + * html/HTMLToken.h: Copied from WebCore/html/HTML5Token.h. + (WebCore::HTMLToken::HTMLToken): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::nextToken): + (WebCore::HTMLTokenizer::emitCharacter): + (WebCore::HTMLTokenizer::emitCurrentToken): + (WebCore::HTMLTokenizer::shouldEmitBufferedCharacterToken): + * html/HTMLTokenizer.h: + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename HTML5EntityParser to HTMLEntityParser + https://bugs.webkit.org/show_bug.cgi?id=41048 + + Mostly the result of do-webcore-rename, but I tweaked the header guard + and the name of the free function. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTML5EntityParser.cpp: Removed. + * html/HTML5EntityParser.h: Removed. + * html/HTMLEntityParser.cpp: Copied from WebCore/html/HTML5EntityParser.cpp. + (WebCore::consumeHTMLEntity): + * html/HTMLEntityParser.h: Copied from WebCore/html/HTML5EntityParser.h. + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::processEntity): + (WebCore::HTMLTokenizer::nextToken): + +2010-06-22 Yuta Kitamura <yutak@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Add a new class that stores information about WebSocket handshake response. + + In the future, instances of the new class will be passed to the Web Inspector + so that it will be able to display information about WebSocket handshake + response. + + WebSocket: Add WebSocketHandshakeResponse + https://bugs.webkit.org/show_bug.cgi?id=38728 + + Test: websocket/tests/handshake-fail-by-no-cr.html + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * websockets/WebSocketHandshake.cpp: + (WebCore::trimConsoleMessage): + (WebCore::WebSocketHandshake::readServerHandshake): + (WebCore::WebSocketHandshake::serverHandshakeResponse): + (WebCore::WebSocketHandshake::readStatusLine): Moved from extractResponseCode. + Add more error checks and make error messages more descriptive. + (WebCore::WebSocketHandshake::readHTTPHeaders): + (WebCore::WebSocketHandshake::processHeaders): + * websockets/WebSocketHandshake.h: + * websockets/WebSocketHandshakeResponse.cpp: Added. + (WebCore::WebSocketHandshakeResponse::ChallengeResponse::ChallengeResponse): + (WebCore::WebSocketHandshakeResponse::ChallengeResponse::set): + (WebCore::WebSocketHandshakeResponse::WebSocketHandshakeResponse): + (WebCore::WebSocketHandshakeResponse::~WebSocketHandshakeResponse): + (WebCore::WebSocketHandshakeResponse::statusCode): + (WebCore::WebSocketHandshakeResponse::setStatusCode): + (WebCore::WebSocketHandshakeResponse::statusText): + (WebCore::WebSocketHandshakeResponse::setStatusText): + (WebCore::WebSocketHandshakeResponse::headerFields): + (WebCore::WebSocketHandshakeResponse::addHeaderField): + (WebCore::WebSocketHandshakeResponse::clearHeaderFields): + (WebCore::WebSocketHandshakeResponse::challengeResponse): + (WebCore::WebSocketHandshakeResponse::setChallengeResponse): + * websockets/WebSocketHandshakeResponse.h: Added. + +2010-06-23 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + Implement page format data programming interface. + The final goal is to implement CSS Paged Media Module Level 3 (http://dev.w3.org/csswg/css3-page/). + To begin with, this change adds methods to know: + - if page box is visible, + - the page area rectangle, and + - preferred page size. + + https://bugs.webkit.org/show_bug.cgi?id=37538 + + Test: printing/page-format-data.html + + * WebCore.base.exp: + * css/CSSParser.cpp: + (WebCore::CSSParser::parseSizeParameter): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + (WebCore::CSSStyleSelector::applyPageSizeProperty): + (WebCore::CSSStyleSelector::pageSizeFromName): + (WebCore::CSSStyleSelector::mmLength): + (WebCore::CSSStyleSelector::inchLength): + * css/CSSStyleSelector.h: + * css/html.css: + (@page): + * dom/Document.cpp: + (WebCore::Document::isPageBoxVisible): + (WebCore::Document::pageAreaRectInPixels): + (WebCore::Document::preferredPageSizeInPixels): + * dom/Document.h: + * page/PrintContext.cpp: + (WebCore::PrintContext::isPageBoxVisible): + (WebCore::PrintContext::pageAreaRectInPixels): + (WebCore::PrintContext::preferredPageSizeInPixels): + * page/PrintContext.h: + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::pageSize): + (WebCore::InheritedFlags::setPageSize): + * rendering/style/StyleRareNonInheritedData.h: + +2010-06-23 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename lexer and m_lexer to tokenizer and m_tokenizer, respectively + https://bugs.webkit.org/show_bug.cgi?id=41046 + + This is a follow up to the recent HTML5Lexer => HTMLTokenizer rename. + + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::begin): + (WebCore::HTML5DocumentParser::pumpLexer): + (WebCore::HTML5DocumentParser::willPumpLexer): + (WebCore::HTML5DocumentParser::didPumpLexer): + (WebCore::HTML5DocumentParser::lineNumber): + (WebCore::HTML5DocumentParser::columnNumber): + * html/HTML5DocumentParser.h: + * html/HTML5PreloadScanner.cpp: + (WebCore::HTML5PreloadScanner::scan): + (WebCore::HTML5PreloadScanner::processToken): + * html/HTML5PreloadScanner.h: + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + (WebCore::HTML5TreeBuilder::handleScriptStartTag): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + * html/HTML5TreeBuilder.h: + * html/HTMLTokenizer.h: + * html/LegacyHTMLDocumentParser.h: + +2010-06-23 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Eric Seidel. + + Reproducible crash in com.apple.WebCore 0x01ed3784 WebCore::RenderLineBoxList::appendLineBox(WebCore::InlineFlowBox*) + 36 + https://bugs.webkit.org/show_bug.cgi?id=40953 + + REGRESSION (r58209-58231): Memory corruption with invalid SVG + https://bugs.webkit.org/show_bug.cgi?id=40173 + + Fix several crashes, all related to <foreignObject> and/or invalid SVG documents. + - Only allow <svg> nodes, as direct children of a <foreignObject>, not any other "partial" SVG content. + - Assure to create RenderSVGRoot objects for <svg> nodes in <foreignObject>, treat them as "outermost SVG elements". + - Never allow any partial SVG content to appear in any document. Only <svg> elements are allowed. + + Tests: svg/custom/bug45331.svg + svg/foreignObject/disallowed-svg-nodes-as-direct-children.svg + svg/foreignObject/no-crash-with-svg-content-in-html-document.svg + svg/foreignObject/svg-document-as-direct-child.svg + svg/foreignObject/svg-document-in-html-document.svg + svg/foreignObject/text-tref-02-b.svg + + * dom/Element.cpp: Added childShouldCreateRenderer, with ENABLE(SVG) guards. + (WebCore::Element::childShouldCreateRenderer): Only create a renderer for a SVG child, if we're a SVG element, or if the child is a <svg> element. + * dom/Element.h: Added childShouldCreateRenderer, with ENABLE(SVG) guards. + * svg/SVGForeignObjectElement.cpp: + (WebCore::SVGForeignObjectElement::childShouldCreateRenderer): Disallow arbitary SVG content, only <svg> elements are allowed as direct children of a <foreignObject> + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::isOutermostSVG): Be sure to create RenderSVGRoot objects for <svg> elements inside <foreignObject> + +2010-06-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename HTML5Lexer to HTMLTokenizer + https://bugs.webkit.org/show_bug.cgi?id=41045 + + This might be slightly confusing given that the old class was called + HTMLTokenizer, but it matches the terminology in the HTML5 spec. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::pumpLexer): + * html/HTML5DocumentParser.h: + * html/HTML5Lexer.cpp: Removed. + * html/HTML5Lexer.h: Removed. + * html/HTML5PreloadScanner.cpp: + (WebCore::HTML5PreloadScanner::processToken): + * html/HTML5PreloadScanner.h: + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + (WebCore::HTML5TreeBuilder::handleScriptStartTag): + (WebCore::HTML5TreeBuilder::adjustedLexerState): + * html/HTML5TreeBuilder.h: + * html/HTMLTokenizer.cpp: Copied from WebCore/html/HTML5Lexer.cpp. + (WebCore::HTMLNames::isEndTagBufferingState): + (WebCore::HTMLTokenizer::HTMLTokenizer): + (WebCore::HTMLTokenizer::~HTMLTokenizer): + (WebCore::HTMLTokenizer::reset): + (WebCore::HTMLTokenizer::processEntity): + (WebCore::HTMLTokenizer::nextToken): + (WebCore::HTMLTokenizer::temporaryBufferIs): + (WebCore::HTMLTokenizer::addToPossibleEndTag): + (WebCore::HTMLTokenizer::isAppropriateEndTag): + (WebCore::HTMLTokenizer::emitCharacter): + (WebCore::HTMLTokenizer::emitCodePoint): + (WebCore::HTMLTokenizer::emitParseError): + (WebCore::HTMLTokenizer::emitCurrentToken): + (WebCore::HTMLTokenizer::shouldEmitBufferedCharacterToken): + * html/HTMLTokenizer.h: Copied from WebCore/html/HTML5Lexer.h. + +2010-06-22 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Qt/Symbian build fix. + + Fix "make clean" to not try to execute clean commands for + the extra targets we use to simulate "make install". + + * WebCore.pro: Use no_clean in CONFIG of extra compilers. + +2010-06-22 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Run clean-header-guards to fix some header guards + https://bugs.webkit.org/show_bug.cgi?id=41044 + + No functional changes, thus no tests. + + This entire change was generated by running + clean-header-guards, and then reverting changes + to files which shouldn't be changed. Those which + are left all should be updated. + + Some of these changes are just fixing 755 permissions + to be 644, since it seems various files have the wrong + execute bit which don't need it. clean-header-guards + made those (welcome) permission fixes unintentionally. + + * bindings/v8/custom/V8HTMLAudioElementConstructor.h: + * bindings/v8/custom/V8HTMLImageElementConstructor.h: + * bindings/v8/custom/V8HTMLOptionElementConstructor.h: + * dom/Touch.h: + * dom/TouchList.h: + * dom/XMLDocumentParser.h: + * dom/XMLDocumentParserScope.h: + * html/HTML5DocumentParser.h: + * html/LegacyHTMLTreeConstructor.h: + * loader/CrossOriginPreflightResultCache.h: + * page/OriginAccessEntry.h: + * page/win/FrameWin.h: + * platform/ThreadTimers.h: + * platform/chromium/KeyboardCodes.h: + * platform/graphics/chromium/FontPlatformDataChromiumWin.h: + * platform/graphics/chromium/FontUtilsChromiumWin.h: + * platform/graphics/filters/FEBlend.h: + * platform/graphics/filters/FEColorMatrix.h: + * platform/graphics/filters/FEComponentTransfer.h: + * platform/graphics/filters/FEComposite.h: + * platform/graphics/gstreamer/DataSourceGStreamer.h: + * platform/graphics/gstreamer/VideoSinkGStreamer.h: + - I checked, this crazy define was not referenced + anywhere else. It's safe to change the name. :) + * platform/graphics/haiku/FontPlatformData.h: + * platform/graphics/qt/FontCustomPlatformData.h: + * platform/graphics/skia/SkiaFontWin.h: + * platform/graphics/win/GraphicsLayerCACF.h: + * platform/graphics/win/QTMovieWinTimer.h: + * platform/graphics/win/RefCountedGDIHandle.h: + * platform/graphics/win/WebLayer.h: + * platform/graphics/win/WebTiledLayer.h: + * platform/graphics/wince/FontPlatformData.h: + * platform/graphics/wx/FontPlatformData.h: + * platform/network/CredentialStorage.h: + * platform/network/cf/FormDataStreamCFNet.h: + * platform/network/curl/FormDataStreamCurl.h: + * platform/network/qt/DnsPrefetchHelper.h: + * platform/network/qt/QNetworkReplyHandler.h: + * platform/win/PlatformScrollBar.h: + * plugins/PluginDatabase.h: + * plugins/PluginPackage.h: + * plugins/PluginStream.h: + * plugins/qt/PluginContainerQt.h: + * plugins/symbian/npinterface.h: + * rendering/RenderSelectionInfo.h: + * rendering/SVGRenderSupport.h: + * storage/IDBObjectStoreImpl.h: + * svg/animation/SMILTimeContainer.h: + * wml/WMLErrorHandling.h: + +2010-06-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename HTMLDocumentParser to LegacyHTMLDocumentParser + https://bugs.webkit.org/show_bug.cgi?id=41043 + + As requested by Darin Adler. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::checkLoaded): + * dom/Document.cpp: + (WebCore::Document::write): + * dom/DocumentFragment.cpp: + * dom/DocumentParser.h: + (WebCore::DocumentParser::asHTMLDocumentParser): + * dom/XMLDocumentParserLibxml2.cpp: + * dom/XMLDocumentParserQt.cpp: + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::columnNumber): + * html/HTML5TreeBuilder.cpp: + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::createParser): + * html/HTMLDocumentParser.cpp: Removed. + * html/HTMLDocumentParser.h: Removed. + * html/HTMLFormControlElement.cpp: + * html/HTMLParserScheduler.cpp: + (WebCore::parserChunkSize): + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createParser): + (WebCore::HTMLViewSourceDocument::addViewSourceToken): + * html/HTMLViewSourceDocument.h: + * html/LegacyHTMLDocumentParser.cpp: Copied from WebCore/html/HTMLDocumentParser.cpp. + (WebCore::LegacyHTMLDocumentParser::LegacyHTMLDocumentParser): + (WebCore::LegacyHTMLDocumentParser::reset): + (WebCore::LegacyHTMLDocumentParser::begin): + (WebCore::LegacyHTMLDocumentParser::setForceSynchronous): + (WebCore::LegacyHTMLDocumentParser::processListing): + (WebCore::LegacyHTMLDocumentParser::parseNonHTMLText): + (WebCore::LegacyHTMLDocumentParser::scriptHandler): + (WebCore::LegacyHTMLDocumentParser::scriptExecution): + (WebCore::LegacyHTMLDocumentParser::parseComment): + (WebCore::LegacyHTMLDocumentParser::parseServer): + (WebCore::LegacyHTMLDocumentParser::parseProcessingInstruction): + (WebCore::LegacyHTMLDocumentParser::parseText): + (WebCore::LegacyHTMLDocumentParser::parseEntity): + (WebCore::LegacyHTMLDocumentParser::parseDoctype): + (WebCore::LegacyHTMLDocumentParser::parseTag): + (WebCore::LegacyHTMLDocumentParser::continueProcessing): + (WebCore::LegacyHTMLDocumentParser::advance): + (WebCore::LegacyHTMLDocumentParser::willWriteHTML): + (WebCore::LegacyHTMLDocumentParser::didWriteHTML): + (WebCore::LegacyHTMLDocumentParser::write): + (WebCore::LegacyHTMLDocumentParser::stopParsing): + (WebCore::LegacyHTMLDocumentParser::processingData): + (WebCore::LegacyHTMLDocumentParser::timerFired): + (WebCore::LegacyHTMLDocumentParser::end): + (WebCore::LegacyHTMLDocumentParser::finish): + (WebCore::LegacyHTMLDocumentParser::finishWasCalled): + (WebCore::LegacyHTMLDocumentParser::processToken): + (WebCore::LegacyHTMLDocumentParser::processDoctypeToken): + (WebCore::LegacyHTMLDocumentParser::~LegacyHTMLDocumentParser): + (WebCore::LegacyHTMLDocumentParser::enlargeBuffer): + (WebCore::LegacyHTMLDocumentParser::enlargeScriptBuffer): + (WebCore::LegacyHTMLDocumentParser::executeScriptsWaitingForStylesheets): + (WebCore::LegacyHTMLDocumentParser::notifyFinished): + (WebCore::LegacyHTMLDocumentParser::executeExternalScriptsIfReady): + (WebCore::LegacyHTMLDocumentParser::executeExternalScriptsTimerFired): + (WebCore::LegacyHTMLDocumentParser::continueExecutingExternalScripts): + (WebCore::LegacyHTMLDocumentParser::isWaitingForScripts): + (WebCore::LegacyHTMLDocumentParser::setSrc): + (WebCore::parseLegacyHTMLDocumentFragment): + * html/LegacyHTMLDocumentParser.h: Copied from WebCore/html/HTMLDocumentParser.h. + (WebCore::LegacyHTMLDocumentParser::asHTMLDocumentParser): + * html/LegacyHTMLTreeConstructor.cpp: + (WebCore::LegacyHTMLTreeConstructor::reportErrorToConsole): + * html/LegacyHTMLTreeConstructor.h: + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::FTPDirectoryDocumentParser): + (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): + (WebCore::FTPDirectoryDocumentParser::finish): + * page/XSSAuditor.h: + +2010-06-22 Shinichiro Hamaji <hamaji@chromium.org> + + Unreviewed attempt to fix the windows build. + + Split out HTML5DocumentParser yield/resume logic into a separate class + https://bugs.webkit.org/show_bug.cgi?id=41018 + + * WebCore.vcproj/WebCore.vcproj: + +2010-06-22 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Split out HTML5DocumentParser yield/resume logic into a separate class + https://bugs.webkit.org/show_bug.cgi?id=41018 + + The HTML5DocumentParser is just the coordinator, and shouldn't have + any real parsing logic of his own. Continuing along that path, I'm + moving the when-to-yield/resume logic out into a separate class. + + I could have create a new HTMLParserSchedulerHost virtual interface + to allow the HTMLParserScheduler to talk back to the + HTML5DocumentParser, but instead I just exposed the one method it + needs (resumeParsing()) as a public method. Since no code besides + HTMLDocument (and DocumentFrament) ever should know about the + HTML5DocumentParser DocumentParser subclass, no class should ever + see the resumeParsing() method anyway. + + Most of this change is just moving code from HTML5DocumentParser + to the new HTMLParserScheduler. + + Some of this change is wrapping previous direct access to + m_continueNextChunkTimer.isActive() with isScheduledForResume(). + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::stopParsing): + (WebCore::HTML5DocumentParser::processingData): + (WebCore::HTML5DocumentParser::pumpLexerIfPossible): + (WebCore::HTML5DocumentParser::isScheduledForResume): + (WebCore::HTML5DocumentParser::resumeParsing): + (WebCore::HTML5DocumentParser::pumpLexer): + (WebCore::HTML5DocumentParser::end): + (WebCore::HTML5DocumentParser::attemptToEnd): + (WebCore::HTML5DocumentParser::endIfDelayed): + * html/HTML5DocumentParser.h: + (WebCore::HTML5DocumentParser::document): + - Exposed for HTMLParserScheduler. + * html/HTMLParserScheduler.cpp: Added. + (WebCore::parserTimeLimit): Moved from HTML5DocumentParser. + (WebCore::parserChunkSize): ditto. + (WebCore::HTMLParserScheduler::HTMLParserScheduler): + (WebCore::HTMLParserScheduler::~HTMLParserScheduler): + (WebCore::isLayoutTimerActive): + (WebCore::HTMLParserScheduler::continueNextChunkTimerFired): + - Moved from HTML5DocumentParser. + * html/HTMLParserScheduler.h: Added. + (WebCore::HTMLParserScheduler::PumpSession::PumpSession): + - Moved from HTML5DocumentParser. + (WebCore::HTMLParserScheduler::shouldContinueParsing): + (WebCore::HTMLParserScheduler::isScheduledForResume): + +2010-06-22 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: move nodeByPath from InjectedScript to InspectorBackend. + + https://bugs.webkit.org/show_bug.cgi?id=40988 + + * inspector/InjectedScriptHost.cpp: + * inspector/InjectedScriptHost.h: + * inspector/InjectedScriptHost.idl: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::pushNodeByPathToFrontend): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::pushNodeByPathToFrontend): + (WebCore::InspectorDOMAgent::nodeForPath): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::didPushNodeByPathToFrontend): + * inspector/InspectorFrontend.h: + * inspector/front-end/DOMAgent.js: + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.setDocument): + * inspector/front-end/InjectedScript.js: + * inspector/front-end/InjectedScriptAccess.js: + +2010-06-22 David Levin <levin@chromium.org> + + Reviewed by Alexey Proskuryakov. + + REGRESSION: (r47291): Upload progress events are not fired for simple cross-site XHR. + https://bugs.webkit.org/show_bug.cgi?id=39029 + + Specifically, WebKit should fire upload events if one or more event listeners are + registered on the XMLHttpRequestUpload object when send is called in an async manner. + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::createRequest): Allow upload events to be fired when there are + handlers for them in the cross-origin simple request case. + +2010-06-22 Kent Tamura <tkent@chromium.org> + + Reviewed by Adam Barth. + + Fix uninitialized SubframeLoader::m_containsPlugins + https://bugs.webkit.org/show_bug.cgi?id=41035 + + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::SubframeLoader): + Initialize m_containsPlugins with false. + +2010-06-22 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Adam Barth. + + Add BlobBuilder.idl to expose BlobBuilder interface + https://bugs.webkit.org/show_bug.cgi?id=40593 + + (Resubmitting with the correct file set.) + + BlobBuilder is defined in FileAPI's FileWriter spec. + (http://dev.w3.org/2009/dap/file-system/file-writer.html) + + Also removes the ENABLE_FILE_WRITER ifdef guard for BlobBuilder. + + Tests: http/tests/local/blob/send-data-blob.html + http/tests/local/blob/send-hybrid-blob.html + http/tests/local/blob/send-sliced-data-blob.html + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/BlobBuilder.cpp: + (WebCore::BlobBuilder::append): + * html/BlobBuilder.h: + * html/BlobBuilder.idl: Added. + * page/DOMWindow.idl: + +2010-06-22 Kent Tamura <tkent@chromium.org> + + Unreviewed, build fix for r61648. + + * platform/graphics/GraphicsContext3D.h: + +2010-06-22 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Kent Tamura. + + Define GraphicsContext3D::platformLayer() for all remaining (non PLATFORM(MAC)) + ports to get RenderLayerBacking.cpp compiling again. + https://bugs.webkit.org/show_bug.cgi?id=41026 + + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::platformLayer): + +2010-06-22 Eric Seidel <eric@webkit.org> + + Unreviewed. Rolling out http://trac.webkit.org/changeset/61638 + made a few tests crash. + + Make PendingScript hold a CachedResourceClient open for its lifetime + https://bugs.webkit.org/show_bug.cgi?id=40968 + + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::watchForLoad): + (WebCore::HTML5DocumentParser::notifyFinished): + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::~HTML5ScriptRunner): + (WebCore::HTML5ScriptRunner::sourceFromPendingScript): + (WebCore::HTML5ScriptRunner::isPendingScriptReady): + (WebCore::HTML5ScriptRunner::executePendingScript): + (WebCore::HTML5ScriptRunner::hasScriptsWaitingForLoad): + (WebCore::HTML5ScriptRunner::watchForLoad): + (WebCore::HTML5ScriptRunner::stopWatchingForLoad): + (WebCore::HTML5ScriptRunner::executeScriptsWaitingForLoad): + (WebCore::HTML5ScriptRunner::executeScriptsWaitingForStylesheets): + (WebCore::HTML5ScriptRunner::requestScript): + * html/HTML5ScriptRunner.h: + (WebCore::HTML5ScriptRunner::PendingScript::): + (WebCore::HTML5ScriptRunner::PendingScript::PendingScript): + (WebCore::HTML5ScriptRunner::PendingScript::watchingForLoad): + * html/HTML5ScriptRunnerHost.h: + +2010-06-22 Adele Peterson <adele@apple.com> + + Reviewed by Darin Adler. + + Fix for Crash when the renderer for the button in <input type="number"> goes away during event handling + https://bugs.webkit.org/show_bug.cgi?id=41013 + + Test: fast/forms/input-number-crash.html + + * rendering/TextControlInnerElements.cpp: (WebCore::SpinButtonElement::defaultEventHandler): + Nil check the RenderBox since its possible the renderer has gone away during event handling. + +2010-06-22 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Eric Seidel. + + Pull script line number from DocumentParser instead of pushing it to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=40649 + + This approach is cleaner and improves WebCore/benchmarks/parser/html-parser.html by ~2%. + + Tests: fast/js/script-line-number.html + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + (WebCore::ScriptController::eventHandlerLineNumber): + * bindings/js/ScriptController.h: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::eventHandlerLineNumber): + (WebCore::ScriptController::eventHandlerColumnNumber): + * bindings/v8/ScriptController.h: + * bindings/v8/ScriptEventListener.cpp: + (WebCore::createAttributeEventListener): + * bindings/v8/V8Proxy.h: + * dom/XMLDocumentParserLibxml2.cpp: + (WebCore::XMLDocumentParser::startElementNs): + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::pumpLexer): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::processToken): + +2010-06-22 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Eric Seidel. + + Make PendingScript hold a CachedResourceClient open for its lifetime + https://bugs.webkit.org/show_bug.cgi?id=40968 + + This replaces the mechanism introduced in r61374 with a simpler + approach from preventing unexpected purges; always keep a client open. + This will approach will allow deferred scripts to add a client after + the resource may have already been loaded without having to worry about + the buffer being purged in the meantime. + + No new tests because making a CachedResource purge itself is not + testable from a LayoutTest. + + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::watchForLoad): + (WebCore::HTML5DocumentParser::notifyFinished): + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::~HTML5ScriptRunner): + (WebCore::HTML5ScriptRunner::sourceFromPendingScript): + (WebCore::HTML5ScriptRunner::isPendingScriptReady): + (WebCore::HTML5ScriptRunner::executePendingScript): + (WebCore::HTML5ScriptRunner::watchForLoad): + (WebCore::HTML5ScriptRunner::stopWatchingForLoad): + (WebCore::HTML5ScriptRunner::executeScriptsWaitingForLoad): + (WebCore::HTML5ScriptRunner::executeScriptsWaitingForStylesheets): + (WebCore::HTML5ScriptRunner::requestScript): + * html/HTML5ScriptRunner.h: + (WebCore::HTML5ScriptRunner::PendingScript::PendingScript): + (WebCore::HTML5ScriptRunner::PendingScript::~PendingScript): + (WebCore::HTML5ScriptRunner::PendingScript::setCachedScript): + (WebCore::HTML5ScriptRunner::PendingScript::cachedScript): + (WebCore::HTML5ScriptRunner::PendingScript::notifyFinished): + * html/HTML5ScriptRunnerHost.h: + +2010-06-22 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Fragment parsing needs to go through the HTML5 Parser code path + https://bugs.webkit.org/show_bug.cgi?id=40645 + + Added a new HTML5DocumentParser::parseHTMLDocumentFragment + codepath which optionally calls through to the old fragment + parsing path, now renamed parseLegacyHTMLDocumentFragment. + + * dom/Element.cpp: + (WebCore::Element::createContextualFragment): + - Use document()->createDocumentFragment() instead + of DocumentFragment::create() to match other callers + (and not depend on DocumentFragment.h). + - Update call to parseHTMLDocumentFragment to use the new + HTML5 parser codepath. + * dom/MappedAttributeEntry.h: + - Add a FIXME about this horrible enum placement. + Sadly this will cause a world-rebuild for everyone. + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::runScriptsForPausedTreeConstructor): + - The main pumpLexer function has gotten to large. Move the script + running logic into this new function. + - Handle the case where we have no m_scriptRunner (fragment case). + (WebCore::HTML5DocumentParser::pumpLexer): + - Use new runScriptsForPausedTreeConstructor(). + (WebCore::HTML5DocumentParser::executingScript): + (WebCore::HTML5DocumentParser::inScriptExecution): + - New function to handle the case where m_scriptRunner is null. + (WebCore::HTML5DocumentParser::resumeParsingAfterScriptExecution): + - Use inScriptExecution() instead of m_scriptRunner->inScriptExecution(). + (WebCore::HTML5DocumentParser::executeScript): ditto. + (WebCore::HTML5DocumentParser::notifyFinished): ditto. + (WebCore::HTML5DocumentParser::executeScriptsWaitingForStylesheets): ditto. + (WebCore::shouldUseLegacyParser): + - Helper function to check the html5ParserEnabled() setting. + (WebCore::HTML5DocumentParser::parseHTMLDocumentFragment): + - Run HTML5DocumentParser in fragment mode, or optionally run + the legacy parser if !html5ParserEnabled(). + * html/HTML5DocumentParser.h: + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::HTML5TreeBuilder): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + - Implement the FragmentScriptingNotAllowed hack for platform/Pasteboard. + * html/HTML5TreeBuilder.h: + * html/HTMLDocumentParser.cpp: + (WebCore::parseLegacyHTMLDocumentFragment): + - Renamed from parseHTMLDocumentFragment + * html/HTMLDocumentParser.h: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::insertAdjacentHTML): + - Call HTML5DocumentParser::parseHTMLDocumentFragment. + * platform/mac/PasteboardMac.mm: + (WebCore::Pasteboard::documentFragment): ditto. + * xml/XSLTProcessor.cpp: + (WebCore::createFragmentFromSource): ditto. + +2010-06-22 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=40643 + + Final phase of moving ownership of WebGLLayer to GraphicsContext3D. + As it turns out, I still have to have a separate CGLContextObj for + rendering because Core Animation composites in a separate thread, + so we need to disconnect WebGL rendering from CA compositing. But + this change is still worthwhile because it reduces dependencies + and makes it easier to port WebGL to other platforms. + + No new tests since this is just restructuring and the current tests + are all still valid and do a sufficient test of WebGL functionality. + + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::platformLayer): + * platform/graphics/GraphicsLayer.h: + (WebCore::GraphicsLayer::setContentsToWebGL): + (WebCore::GraphicsLayer::setWebGLNeedsDisplay): + * platform/graphics/mac/GraphicsContext3DMac.mm: Add creation of WebGLLayer + (WebCore::GraphicsContext3D::GraphicsContext3D): + * platform/graphics/mac/GraphicsLayerCA.h: + (WebCore::GraphicsLayerCA::): + * platform/graphics/mac/GraphicsLayerCA.mm: Handle setting of WebGLLayer as content the same as for MediaLayer. Also changed WebGL related names for clarity + (WebCore::GraphicsLayerCA::GraphicsLayerCA): + (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): + (WebCore::GraphicsLayerCA::updateContentsWebGLLayer): + (WebCore::GraphicsLayerCA::setContentsToWebGL): + (WebCore::GraphicsLayerCA::setWebGLNeedsDisplay): + * platform/graphics/mac/WebGLLayer.h: + * platform/graphics/mac/WebGLLayer.mm: Got rid of storage for context and texture, now just store GraphicsContext3D and get them from there when needed + (-[WebGLLayer copyCGLPixelFormatForDisplayMask:]): + (-[WebGLLayer copyCGLContextForPixelFormat:]): + (-[WebGLLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:]): + (-[WebGLLayer copyImageSnapshotWithColorSpace:]): + * rendering/RenderLayerBacking.cpp: Changed init of WebGL contentsLayer to pass WebGLLayer rather than GraphicsContext3D + (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): + (WebCore::RenderLayerBacking::rendererContentChanged): + +2010-06-22 Darin Adler <darin@apple.com> + + Reviewed by Dave Hyatt. + + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::parseMappedAttribute): Removed incorrect FIXME comments. + +2010-06-22 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/8119403> REGRESSION (r61548): PLT is almost 1.5% slower, Google page cycler slower + https://bugs.webkit.org/show_bug.cgi?id=41012 + + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeHorizontalPositionsForLine): Removed a redundant statement that was + left over in the original patch and resulted in double the calls to RenderText::width() here. + (WebCore::RenderBlock::findNextLineBreak): Changed the order of evaluating conditions for a + potential speedup. + +2010-06-22 Darin Adler <darin@apple.com> + + Reviewed by Alexey Proskuryakov. + + Alexey asked me to take out the autorelease pools because he believes + that there is no code that should be running using Objective-C + autorelease. Most likely, the code that is triggering these stderr + messages is incorrect, and that bug should be fixed instead. + + * workers/WorkerRunLoop.cpp: + (WebCore::WorkerRunLoop::run): Roll out use of AutodrainedPool. + +2010-06-22 Darin Adler <darin@apple.com> + + Reviewed by Brady Eidson. + + Fix autorelease problem seen when running worker regression tests. + We were seeing logs to stderr saying autorelease was used without + an autorelease pool being set up. + + * workers/WorkerRunLoop.cpp: + (WebCore::WorkerRunLoop::run): Use an AutodrainedPool as the file + thread, icon database, and database thread do. No effect on platforms + other than Mac. + +2010-06-22 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + AX: If an element that is a continuation is removed, its parent tree is not notified appropriately that their children have changed + https://bugs.webkit.org/show_bug.cgi?id=41000 + + Test: accessibility/removed-continuation-element-causes-crash.html + + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::updateChildrenIfNecessary): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::childrenChanged): + (WebCore::AccessibilityRenderObject::addChildren): + * accessibility/AccessibilityRenderObject.h: + +2010-06-22 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Barth. + + Override setFailed() in each image decoder to clean up any temporary + objects. + https://bugs.webkit.org/show_bug.cgi?id=35411 + + In a few cases, we need to be careful to avoid deleting objects until + after they're no longer needed. These cases usually mean some jumping + through hoops, to the detriment of code simplicity. + + No layout tests because this does not change the visible output of + decoding in any way. + + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::setData): + * platform/image-decoders/bmp/BMPImageDecoder.cpp: + (WebCore::BMPImageDecoder::setFailed): + (WebCore::BMPImageDecoder::decode): + * platform/image-decoders/bmp/BMPImageDecoder.h: + * platform/image-decoders/bmp/BMPImageReader.cpp: + (WebCore::BMPImageReader::decodeBMP): + (WebCore::BMPImageReader::readInfoHeaderSize): + (WebCore::BMPImageReader::processInfoHeader): + (WebCore::BMPImageReader::readInfoHeader): + (WebCore::BMPImageReader::processBitmasks): + (WebCore::BMPImageReader::processColorTable): + (WebCore::BMPImageReader::processRLEData): + (WebCore::BMPImageReader::processNonRLEData): + * platform/image-decoders/bmp/BMPImageReader.h: + (WebCore::BMPImageReader::): + * platform/image-decoders/gif/GIFImageDecoder.cpp: + (WebCore::GIFImageDecoder::setFailed): + (WebCore::GIFImageDecoder::decode): + * platform/image-decoders/gif/GIFImageDecoder.h: + * platform/image-decoders/ico/ICOImageDecoder.cpp: + (WebCore::ICOImageDecoder::setFailed): + (WebCore::ICOImageDecoder::decode): + * platform/image-decoders/ico/ICOImageDecoder.h: + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::JPEGImageReader::decode): + (WebCore::JPEGImageDecoder::setFailed): + (WebCore::JPEGImageDecoder::decode): + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageReader::decode): + (WebCore::PNGImageDecoder::PNGImageDecoder): + (WebCore::PNGImageDecoder::setFailed): + (WebCore::PNGImageDecoder::headerAvailable): + (WebCore::PNGImageDecoder::decode): + * platform/image-decoders/png/PNGImageDecoder.h: + +2010-06-04 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + Remove side effects of form submission and prepare FormDataBuilder for splitting up. + https://bugs.webkit.org/show_bug.cgi?id=40184 + + Refactoring, covered by existing tests. + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::prepareFormSubmission): + * Changed to use new accessors on FormDataBuilder; + * Simplified the logic around action URL; + * Removed form submission side effect of element's enctype property being updated when + submitting a mailto form; + * Removed unnecessary updating of action URL for mailto forms. + (WebCore::HTMLFormElement::submit): Moved action URL check into prepareFormSubmission. + (WebCore::HTMLFormElement::parseMappedAttribute): Updated to use new methods on FormDataBuilder. + * html/HTMLFormElement.h: Removed decls for isMailtoForm and dataEncoding methods; + moved m_target and m_url to FormDataBuilder. + * platform/network/FormData.cpp: + (WebCore::FormData::appendDOMFormData): Removed unnecessary instantiation of FormDataBuilder. + * platform/network/FormDataBuilder.cpp: + (WebCore::FormDataBuilder::parseAction): Moved from HTMLFormControl. + * platform/network/FormDataBuilder.h: + (WebCore::FormDataBuilder::action): Ditto. + (WebCore::FormDataBuilder::target): Ditto. + (WebCore::FormDataBuilder::setTarget): Ditto. + +2010-06-22 Yuta Kitamura <yutak@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Fix WebSocketHandshakeRequest so that it fits the new handshake protocol. + + The new WebSocket specification (draft 76 and later) allows a browser to + send header fields in arbitrary order. Thus we can use a HTTPHeaderMap to + store header fields instead of Vector of pairs of a field name and + a field value. + + This patch also does refactoring of WebSocketHandshakeRequest class + to make it simpler and easier to use. + + Fix WebSocketHandshakeRequest so that it fits the new handshake protocol + https://bugs.webkit.org/show_bug.cgi?id=39864 + + No new tests, because there is no functional change. + + * websockets/WebSocketHandshake.cpp: + (WebCore::WebSocketHandshake::clientHandshakeRequest): + * websockets/WebSocketHandshakeRequest.cpp: + (WebCore::WebSocketHandshakeRequest::Key3::Key3): + (WebCore::WebSocketHandshakeRequest::Key3::set): + (WebCore::WebSocketHandshakeRequest::WebSocketHandshakeRequest): + (WebCore::WebSocketHandshakeRequest::requestMethod): + (WebCore::WebSocketHandshakeRequest::url): + (WebCore::WebSocketHandshakeRequest::addHeaderField): + (WebCore::WebSocketHandshakeRequest::headerFields): + (WebCore::WebSocketHandshakeRequest::key3): + (WebCore::WebSocketHandshakeRequest::setKey3): + * websockets/WebSocketHandshakeRequest.h: + +2010-06-20 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + <meter> should be yellow when min < value < low < optimum + https://bugs.webkit.org/show_bug.cgi?id=40824 + + Fixed a wrong conditional on HTMLMeterElement::gaugeRegion(). + + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::gaugeRegion): + + Tests: fast/dom/HTMLMeterElement/meter-appearances-capacity.html + fast/dom/HTMLMeterElement/meter-optimums.html + +2010-06-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Follow the HTML5 spec more closely w.r.t. when to save the insertion point + https://bugs.webkit.org/show_bug.cgi?id=40976 + + The spec always increments the nesting level and saves the insertion + point at the same time. In this patch, we now do those operations + packaged as a RAII. + + As a side effect, the test case below no longer ASSERTs. (The output + is wrong, but we'll get to that next.) + + Test: fast/tokenizer/write-on-load.html + + * html/HTML5ScriptRunner.cpp: + (WebCore::NestScript::NestScript): + (WebCore::NestScript::~NestScript): + (WebCore::HTML5ScriptRunner::executePendingScript): + (WebCore::HTML5ScriptRunner::executeScript): + (WebCore::HTML5ScriptRunner::requestScript): + (WebCore::HTML5ScriptRunner::runScript): + * html/HTMLInputStream.h: + +2010-06-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Expose HTMLInputStream to ScriptRunner so that ScriptRunner can save the insertion point itself + https://bugs.webkit.org/show_bug.cgi?id=40975 + + This saves us having to call back into the HTML5DocumentParser each + time we need to save the insertion point. This prepares us for another + place we need to save the insertion point. + + * html/HTML5DocumentParser.cpp: + * html/HTML5DocumentParser.h: + (WebCore::HTML5DocumentParser::inputStream): + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::executeScript): + (WebCore::HTML5ScriptRunner::requestScript): + * html/HTML5ScriptRunnerHost.h: + +2010-06-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move HTMLInputStream to its own file + https://bugs.webkit.org/show_bug.cgi?id=40974 + + No new tests, just code motion. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTML5DocumentParser.h: + +2010-06-21 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Save the insertion point before beforeload events + https://bugs.webkit.org/show_bug.cgi?id=40973 + + We need to save the insertion point before dispatching the beforeload + event in case someone decides to document.write during beforeload. + Prior to this patch, such writes would pump the lexer too much and + tokenize the rest of the document before executing the script. + + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::dispatchBeforeLoad): + * html/HTML5DocumentParser.h: + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::requestScript): + * html/HTML5ScriptRunnerHost.h: + +2010-06-21 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + document.write from BeforeLoad should not assert + https://bugs.webkit.org/show_bug.cgi?id=40971 + + We're setting the parse blocking script too early. It's not actually + blocking parsing yet. + + Test: fast/tokenizer/write-before-load.html + + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::requestScript): + +2010-06-21 Chris Fleizach <cfleizach@apple.com> + + No review. QT build fix again. + + AX: VoiceOver does not announce WAI-ARIA state change of aria-expanded + https://bugs.webkit.org/show_bug.cgi?id=40927 + + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::postNotification): + +2010-06-21 Chris Fleizach <cfleizach@apple.com> + + No review. QT build fix. + + AX: VoiceOver does not announce WAI-ARIA state change of aria-expanded + https://bugs.webkit.org/show_bug.cgi?id=40927 + + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::postNotification): + +2010-06-21 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + AX: VoiceOver does not announce WAI-ARIA state change of aria-expanded + https://bugs.webkit.org/show_bug.cgi?id=40927 + + Test: platform/mac/accessibility/aria-expanded-notifications.html + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::handleAriaExpandedChange): + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::handleAriaExpandedChange): + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::handleAriaExpandedChanged): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged): + * accessibility/AccessibilityRenderObject.h: + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::postPlatformNotification): + * dom/Element.cpp: + (WebCore::Element::updateAfterAttributeChanged): + +2010-06-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61585. + http://trac.webkit.org/changeset/61585 + https://bugs.webkit.org/show_bug.cgi?id=40950 + + It broke builds (Requested by kinuko on #webkit). + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/BlobBuilder.cpp: + (WebCore::BlobBuilder::appendString): + (WebCore::BlobBuilder::appendBlob): + * html/BlobBuilder.h: + * page/DOMWindow.idl: + +2010-06-21 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Adam Barth. + + Add BlobBuilder.idl to expose BlobBuilder interface + https://bugs.webkit.org/show_bug.cgi?id=40593 + + BlobBuilder is defined in FileAPI's FileWriter spec. + (http://dev.w3.org/2009/dap/file-system/file-writer.html) + + Also removes the ENABLE_FILE_WRITER ifdef guard for BlobBuilder. + + Tests: http/tests/local/blob/send-data-blob.html + http/tests/local/blob/send-hybrid-blob.html + http/tests/local/blob/send-sliced-data-blob.html + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/BlobBuilder.cpp: + (WebCore::BlobBuilder::append): + * html/BlobBuilder.h: + * html/BlobBuilder.idl: Added. + * page/DOMWindow.idl: + +2010-06-21 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + FrameLoader cleanup: Split high level subframe and plugin + loading functions into a separate class. + https://bugs.webkit.org/show_bug.cgi?id=40453 + + Refactor only, no new tests. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.base.exp: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/DOMImplementation.cpp: + * history/PageCache.cpp: + * html/HTMLFrameElementBase.cpp: + * html/HTMLMediaElement.cpp: + * loader/FrameLoader.cpp: + * loader/FrameLoader.h: + (WebCore::FrameLoader::subframeLoader): + * loader/PluginDocument.cpp: + * loader/SubframeLoader.cpp: Added. + (WebCore::SubframeLoader::SubframeLoader): + (WebCore::toPlugInElement): + (WebCore::SubframeLoader::clear): + (WebCore::SubframeLoader::requestFrame): + (WebCore::SubframeLoader::requestObject): + (WebCore::FrameLoader::loadMediaPlayerProxyPlugin): + (WebCore::SubframeLoader::createJavaAppletWidget): + (WebCore::SubframeLoader::loadSubframe): + (WebCore::SubframeLoader::allowPlugins): + (WebCore::SubframeLoader::shouldUsePlugin): + (WebCore::SubframeLoader::loadPlugin): + (WebCore::SubframeLoader::completeURL): + * loader/SubframeLoader.h: Added. + (WebCore::SubframeLoader::containsPlugins): + * page/Page.cpp: + * page/XSSAuditor.h: + * platform/graphics/wince/MediaPlayerProxy.cpp: + * plugins/MimeType.cpp: + * rendering/RenderApplet.cpp: + * rendering/RenderEmbeddedObject.cpp: + +2010-06-21 Nate Chapin <japhet@chromium.org> + + Unreviewed, build fix. + + Bad merge, left a reference to m_committedFirstRealDocumentLoad in + http://trac.webkit.org/changeset/61568. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::transitionToCommitted): + +2010-06-21 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Remove a couple of FrameLoader's unused boolean members + (m_receivedData, m_cancellingWithLoadInProcess) and merge + several more into a single state machine called FrameLoaderStateMachine + (m_firstLayoutDone, m_creatingInitialEmptyDocument, + m_isDisplayingInitialEmptyDocument, m_committedFirstRealDocumentLoad). + + https://bugs.webkit.org/show_bug.cgi?id=39695 + + Refactor only, so no new tests. + + * WebCore.base.exp: + * WebCore.xcodeproj/project.pbxproj: + * loader/DocumentWriter.cpp: + (WebCore::DocumentWriter::createDocument): + (WebCore::DocumentWriter::begin): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::FrameLoader): + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::stopLoading): + (WebCore::FrameLoader::didOpenURL): + (WebCore::FrameLoader::didExplicitOpen): + (WebCore::FrameLoader::clear): + (WebCore::FrameLoader::didBeginDocument): + (WebCore::FrameLoader::finishedParsing): + (WebCore::FrameLoader::provisionalLoadStarted): + (WebCore::FrameLoader::logCanCachePageDecision): + (WebCore::FrameLoader::logCanCacheFrameDecision): + (WebCore::FrameLoader::frameHasLoaded): + (WebCore::FrameLoader::commitProvisionalLoad): + (WebCore::FrameLoader::transitionToCommitted): + (WebCore::FrameLoader::finishedLoadingDocument): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::didFirstLayout): + (WebCore::FrameLoader::frameLoadCompleted): + (WebCore::FrameLoader::dispatchDidCommitLoad): + * loader/FrameLoader.h: + (WebCore::FrameLoader::stateMachine): + * loader/FrameLoaderStateMachine.cpp: Added. + * loader/FrameLoaderStateMachine.h: Added. + * loader/HistoryController.cpp: + (WebCore::HistoryController::restoreScrollPositionAndViewState): + (WebCore::HistoryController::saveDocumentState): + * loader/ProgressTracker.cpp: + (WebCore::ProgressTracker::incrementProgress): + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleLocationChange): + (WebCore::RedirectScheduler::scheduleFormSubmission): + +2010-06-21 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix. Fix header includes for ENABLE(DATABASE) + + * bindings/js/JSExceptionBase.cpp: + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Fix clang++ build. + + * loader/FormSubmission.h: + +2010-06-21 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + Add a missing include in AsyncImageResizer.h + + * html/AsyncImageResizer.h: Added the IntSize include. + +2010-06-21 Adam Roben <aroben@apple.com> + + Call NotifyAddrChange again each time we are notified of a change + + NotifyAddrChange only notifies you of a single change. If you want to + listen for subsequent changes, you have to call it again. + + Fixes <http://webkit.org/b/33004> NetworkStateNotifier ignores all + state changes after the first. + + No test possible, as we don't have a way to modify the system's + network adapters when running tests. + + Reviewed by Anders Carlsson. + + * platform/network/win/NetworkStateNotifierWin.cpp: + (WebCore::NetworkStateNotifier::addrChangeCallback): Call + registerForAddressChange as soon as we're notified of an address + change, so we'll also get notified of the *next* address change. I + added the call here instead of in addressChanged (which is called + later on the main thread) to minimize the time between the callback + and registering again (so that we won't miss changes that happen in + rapid succession). + +2010-06-21 Dan Bernstein <mitz@apple.com> + + Release build fix + + * rendering/RenderBlockLineLayout.cpp: + (WebCore::tryHyphenating): + +2010-06-21 Dan Bernstein <mitz@apple.com> + + Windows build fix + + * WebCore.vcproj/WebCore.vcproj: Fixed a typo. + +2010-06-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + CSS3: Implement the 'hyphens' and 'hyphenate-character' properties + https://bugs.webkit.org/show_bug.cgi?id=10228 + + Tests: fast/text/hyphenate-character.html + fast/text/hyphens.html + + Added -webkit-hyphens and -webkit-hyphenate-character as specified in + <http://www.w3.org/TR/2010/WD-css3-gcpm-20100608/#hyphenation>. + + * Android.mk: Added Hyphenation.cpp. + * CMakeLists.txt: Ditto. + * GNUmakefile.am: Added Hyphenation.{cpp,h}. + * WebCore.base.exp: Exported wkGetHyphenationLocationBeforeIndex(). + * WebCore.gypi: Added Hyphenation.{cpp,h}. + * WebCore.pro: Added Hyphenation.{cpp,h}. + * WebCore.vcproj/WebCore.vcproj: Added Hyphenation.{cpp,h}. + * WebCore.xcodeproj/project.pbxproj: Added Hyphenation.{cpp,h}. + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added the -webkit-hyphenate-character + and -webkit-hyphens cases. + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): Validate values for the new properties. + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added. Maps from a Hyphens value to an identifier. + (WebCore::CSSPrimitiveValue::operator Hyphens): Added. Maps from an identifier to a Hyphens value. + * css/CSSPropertyNames.in: Added -webkit-hyphenate-character and -webkit-hyphens. + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): Apply the new properties to the RenderStyle. + * css/CSSValueKeywords.in: + * platform/mac/WebCoreSystemInterface.h: Added wkGetHyphenationLocationBeforeIndex. + * platform/mac/WebCoreSystemInterface.mm: Ditto. + * platform/text/CharacterNames.h: Added the hyphen character. + * platform/text/Hyphenation.cpp: Added. + (WebCore::lastHyphenLocation): Added this default implementation for platforms that do not implement + hyphenation yet. It calls notImplemented() and returns 0. + * platform/text/Hyphenation.h: Added. + * platform/text/cf/HyphenationCF.cpp: Added. + (WebCore::lastHyphenLocation): Returns the last hyphenation location occurring in the given string before + the given index. Uses the current search locale (which is based on the top language preference of the user) + for hyphenation. + * platform/text/mac/HyphenationMac.mm: Added. + (WebCore::lastHyphenLocation): Returns the last hyphenation location occurring in the given string before + the given index. Returns 0 if the current search locale is not "en", because the platform only knows how to + hyphenate English. + * rendering/BidiRun.h: + (WebCore::BidiRun::BidiRun): Added a boolean member, m_hasHyphen, and initialized it to false in the constructor. + * rendering/InlineBox.h: + (WebCore::InlineBox::InlineBox): Renamed m_hasEllipsisBox to m_hasEllipsisBoxOrHyphen, because this bit is now + shared by two subclass: RootInlineBox uses it for hasEllipsisBox(), while InlineTextBox uses it for hasHyphen(). + * rendering/InlineTextBox.cpp: + (WebCore::adjustCharactersAndLengthForHyphen): Added this helper function to get the hyphen string from the style + and return a UChar* and length for the concatenation of the given text with the hyphen string. + (WebCore::InlineTextBox::selectionRect): If the selected range touches the end and the box has a hyphen, + compute the width of the text with the hyphen string concatenated to it. + (WebCore::InlineTextBox::paint): If the box has a hyphen, draw the text with the hyphen string concatenated to it. + (WebCore::InlineTextBox::paintSelection): Similarly concatenate the hyphen string. + * rendering/InlineTextBox.h: + (WebCore::InlineTextBox::hasHyphen): Added this accessor. + (WebCore::InlineTextBox::setHasHyphen): Ditto. + * rendering/RenderBlock.h: + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::constructLine): Copy the m_hasHyphen flag from the run to its text box. + (WebCore::RenderBlock::computeHorizontalPositionsForLine): Add the width of the hyphen string when computing the + width of a box that has a hyphen. + (WebCore::RenderBlock::layoutInlineChildren): If the line was hyphenated, set the m_hasHyphen flag on the + logically last run. + (WebCore::tryHyphenating): Added this helper function which checks if a piece of text that does not fit on the + line could be hyphenated such that the part before the hyphen, including the hyphen, would fit. Given the amount + of space remaining on the line, it finds the longest prefix that can fit in the remaining space (which leaving room for + the hyphen), and then checks for a hyphenation location within that prefix. + (WebCore::RenderBlock::findNextLineBreak): In the 'hyphens: none' case, prevent line breaks at soft hyphens. + In the 'hyphens: auto' case, try hyphenating when a word will not fit in the remaining space on the line. + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::detachEllipsisBox): Changed to use hasEllipsisBox() and setHasEllipsisBox(). + (WebCore::RootInlineBox::clearTruncation): Ditto. + (WebCore::RootInlineBox::placeEllipsis): Ditto. + (WebCore::RootInlineBox::paintEllipsisBox): Ditto. + (WebCore::RootInlineBox::nodeAtPoint): Ditto. + (WebCore::RootInlineBox::ellipsisBox): Ditto. + * rendering/RootInlineBox.h: + (WebCore::RootInlineBox::hasEllipsisBox): Added this accessor. + (WebCore::RootInlineBox::setHasEllipsisBox): Ditto. + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::diff): Return a layout hint if the hyphens setting or hyphenate-character differs. + (WebCore::RenderStyle::hyphenString): Added. For hyphenate-character: auto, returns the hyphen character. + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::hyphens): Added this accessor. + (WebCore::InheritedFlags::hyphenateCharacter): Ditto. + (WebCore::InheritedFlags::setHyphens): Ditto. + (WebCore::InheritedFlags::setHyphenateCharacter): Ditto. + (WebCore::InheritedFlags::initialHyphens): Added. Returns HyphensManual. + (WebCore::InheritedFlags::initialHyphenateCharacter): Added. Returns the null string, corresponding to + a value of 'auto'. + * rendering/style/RenderStyleConstants.h: + Added a Hyphens enum. + * rendering/style/StyleRareInheritedData.cpp: + (WebCore::StyleRareInheritedData::StyleRareInheritedData): Initialize and copy the new members. + (WebCore::StyleRareInheritedData::operator==): Compare the new members. + * rendering/style/StyleRareInheritedData.h: Added two new members: hyphens and hyphenateCharacter. + +2010-06-03 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + Plumb FormSubmission through to ScheduledFormSubmission. + https://bugs.webkit.org/show_bug.cgi?id=40137 + + No behavior change, covered by existing tests. + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::prepareFormSubmission): Moved creation of action URL + instance here from FrameLoader::submit, because it makes more sense here, + also added a FIXME to investigate existing code later. + * loader/FormSubmission.cpp: + (WebCore::FormSubmission::FormSubmission): Changed action to be a KURL, not a String. + (WebCore::FormSubmission::create): Ditto. + (WebCore::FormSubmission::populateFrameLoadRequest): Added, moving the logic from + FrameLoader::submit closer to the data. + * loader/FormSubmission.h: + (WebCore::FormSubmission::action): Changed type to KURL. + (WebCore::FormSubmission::clearTarget): Added. + (WebCore::FormSubmission::referrer): Added. + (WebCore::FormSubmission::setReferrer): Added. + (WebCore::FormSubmission::origin): Added. + (WebCore::FormSubmission::setOrigin): Added. + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::submitForm): Cleaned up to make it more about decision-making, + not data manipulation. + * loader/RedirectScheduler.cpp: + (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): Changed to accept FormSubmission as argument. + (WebCore::ScheduledFormSubmission::fire): Changed to use FormSubmission. + (WebCore::RedirectScheduler::scheduleFormSubmission): Removed assert that no longer makes sense, + changed to use FormSubmission. + * loader/RedirectScheduler.h: Updated ScheduledFormSubmission decl to hold FormSubmission ref. + +2010-06-21 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Speech Input Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=40878 + + No new tests are needed, because there is no new functionality. + + * Configurations/FeatureDefines.xcconfig: + * GNUmakefile.am: + * WebCore.pri: + +2010-06-21 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + Delete DOM storage databases when they are empty. + https://bugs.webkit.org/show_bug.cgi?id=40767 + + Even if a page clears its local storage, the database file for it stays around, + and there is currently no mechanism that deletes them. + + After doing the "final sync" of a storage area, the StorageAreaSyncMaster should + see if the database is empty, and in that case delete it. + + Tests: + manual-tests/localstorage-empty-database.html + + * manual-tests/localstorage-empty-database.html: + Added link to clear local storage for testing that the file is removed. + * storage/LocalStorageTask.cpp: + (WebCore::LocalStorageTask::LocalStorageTask): + Added local storage task type DeleteEmptyDatabase. + (WebCore::LocalStorageTask::performTask): + Ditto. + * storage/LocalStorageTask.h: + (WebCore::LocalStorageTask::): + Ditto. + (WebCore::LocalStorageTask::createDeleteEmptyDatabase): + Ditto. + * storage/StorageAreaSync.cpp: + (WebCore::StorageAreaSync::scheduleFinalSync): + When scheduling final sync, also schedule DeleteEmptyDatabase. + (WebCore::StorageAreaSync::sync): + Return early if final sync has nothing to sync. + (WebCore::StorageAreaSync::deleteEmptyDatabase): + Added function to check if a database is empty and in that case delete it. + * storage/StorageAreaSync.h: + Ditto. + * storage/StorageSyncManager.cpp: + (WebCore::StorageSyncManager::scheduleDeleteEmptyDatabase): + Added function for scheduling DeleteEmptyDatabase task. + * storage/StorageSyncManager.h: + Ditto. + +2010-06-21 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Avoid unnecessary image conversion in RGBA32Buffer::zeroFill() + https://bugs.webkit.org/show_bug.cgi?id=40910 + + * platform/image-decoders/qt/RGBA32BufferQt.cpp: + (WebCore::RGBA32Buffer::zeroFill): + +2010-06-21 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Decode images directly to QPixmap + https://bugs.webkit.org/show_bug.cgi?id=40797 + + Decode images to QPixmap directly instead of QImage when possible. + RGBA32Buffer transforms the pixmap back to image if + necessary. + + This improve the performance with certain graphic system, and + can reduce memory usage. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::setData): + (WebCore::ImageDecoderQt::internalHandleCurrentImage): + * platform/image-decoders/ImageDecoder.h: + (WebCore::RGBA32Buffer::getAddr): + * platform/image-decoders/qt/RGBA32BufferQt.cpp: + (WebCore::RGBA32Buffer::clear): + (WebCore::RGBA32Buffer::zeroFill): + (WebCore::RGBA32Buffer::copyBitmapData): + (WebCore::RGBA32Buffer::setSize): + (WebCore::RGBA32Buffer::asNewNativeImage): + (WebCore::RGBA32Buffer::setPixmap): + +2010-06-20 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Adding the SQLException class which will be used to report sync DB errors. + https://bugs.webkit.org/show_bug.cgi?id=40607 + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMBinding.cpp: + (WebCore::setDOMException): + * bindings/js/JSExceptionBase.cpp: + (WebCore::toExceptionBase): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::setDOMException): + * bindings/v8/V8Proxy.h: + * dom/ExceptionCode.cpp: + (WebCore::): + (WebCore::getExceptionCodeDescription): + * dom/ExceptionCode.h: + (WebCore::): + * page/DOMWindow.idl: + * storage/SQLException.h: Added. + (WebCore::SQLException::create): + (WebCore::SQLException::): + (WebCore::SQLException::SQLException): + * storage/SQLException.idl: Added. + +2010-06-20 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: don't add ScriptDebugServer as v8 listener if browser exposes + v8 debugging protocol. + https://bugs.webkit.org/show_bug.cgi?id=40844 + + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::ScriptDebugServer): + (WebCore::ScriptDebugServer::addListener): + (WebCore::ScriptDebugServer::setEnabled): + (WebCore::ScriptDebugServer::isDebuggerAlwaysEnabled): + * bindings/v8/ScriptDebugServer.h: + +2010-06-20 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed build fix. + + [EFL] Build break for r61527 + https://bugs.webkit.org/post_bug.cgi + + * CMakeLists.txt: Add loader/FormSubmission.cpp + +2010-06-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Remove bogus const qualifiers. + + * platform/mac/PasteboardHelper.h: + +2010-06-20 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Kent Tamura. + + Buildfix for NotificationCenter.h. + https://bugs.webkit.org/show_bug.cgi?id=40890 + + ScriptExecutionContext::completeURL is used in header, + but ScriptExecutionContext.h wasn't included. + + * notifications/NotificationCenter.h: + +2010-06-20 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Eric Seidel. + + Recognize async attribute on HTML script tags. + https://bugs.webkit.org/show_bug.cgi?id=39026 + + This does not implement async behavior, it only parses the async + attribute for HTML script tags. SVG script tags continue to not + support the async attribute. + + Tests: fast/dom/HTMLScriptElement/script-async-attr.html + svg/dom/SVGScriptElement/script-async-attr.svg + + * dom/ScriptElement.cpp: + (WebCore::ScriptElementData::isAsynchronous): + (WebCore::ScriptElementData::isDeferred): + * dom/ScriptElement.h: + * html/HTMLAttributeNames.in: + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::async): + (WebCore::HTMLScriptElement::setAsync): + (WebCore::HTMLScriptElement::defer): + (WebCore::HTMLScriptElement::asyncAttributeValue): + (WebCore::HTMLScriptElement::deferAttributeValue): + * html/HTMLScriptElement.h: + * html/HTMLScriptElement.idl: + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::asyncAttributeValue): + (WebCore::SVGScriptElement::deferAttributeValue): + * svg/SVGScriptElement.h: + +2010-06-20 Nikita Vasilyev <me@elv1s.ru> + + Reviewed by Joseph Pecoraro. + + Web Inspector: Auto-completion for CSS property names in Styles pane + https://bugs.webkit.org/show_bug.cgi?id=17374 + + Added autocompletion for CSS properties. A suggestion for a property + shows when you type. You can also cycle through known property names + using the Up and Down arrow keys. + + * WebCore.gypi: + * inspector/front-end/CSSCompletions.js: Added. + (WebInspector.CSSCompletions): + (WebInspector.CSSCompletions.startsWith): + (WebInspector.CSSCompletions.firstStartsWith): + (WebInspector.CSSCompletions._firstIndexOfPrefix): + (WebInspector.CSSCompletions.next): + (WebInspector.CSSCompletions.previous): + (WebInspector.CSSCompletions._closest): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/utilities.js: + (Text.prototype.select): + (): + +2010-06-14 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + Introduce FormSubmission, the structure representing a form submission. + https://bugs.webkit.org/show_bug.cgi?id=40084 + + No change in functionality, covered by existing tests. + + * GNUmakefile.am: Added FormSubmission.h/cpp. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::prepareFormSubmission): Renamed prepareFormData to prepareFormSubmission, + added code for populating a FormSubmission instance, moved the loop of accumulating text input + values into this functions (it belongs here logically). + (WebCore::HTMLFormElement::submit): Modified to use prepareFormSubmission. + * html/HTMLFormElement.h: + * loader/FormSubmission.cpp: Added. + * loader/FormSubmission.h: Added. + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::submitForm): Modified to use FormSubmission. Stopped plumbing further to keep + the patch size down. + * loader/FrameLoader.h: Modified submitForm signature. + +2010-06-20 Joseph Pecoraro <joepeck@webkit.org> + + Unreviewed rollout r61506, because it made 1 test crash. + + Causes crash. Will approach the solution in a different way. + +2010-06-20 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Should Autocomplete Style Properties + https://bugs.webkit.org/show_bug.cgi?id=38448 + + This Autocompletes style properties when in the console. + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-06-20 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] NPP_SetWindow seems to not be called when TestNetscapePlugin is moved + + https://bugs.webkit.org/show_bug.cgi?id=36702 + + setNPWindowIfNeeded() is called on paint() in PluginViewQt, which doesn't + work for DRT. So call it if we are in DRT mode and the window geometry + has changed. + + Unskips plugins/reentrant-update-widget-positions.html + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + +2010-06-19 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Adam Barth. + + Persist V8's ScriptData to the memory cache. + https://bugs.webkit.org/show_bug.cgi?id=38661 + + This stores V8's ScriptData in the memory cache and also causes the + network platform layer to be notified of the available cacheable + metadata. + + Chromium's morejs benchmark showed a ~7% improvement when this was + originally submitted (before it had to be rolled back). + + Test: fast/js/parser-high-byte-character.html + + * bindings/v8/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + (WebCore::ScriptSourceCode::cachedScript): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::compileScript): + (WebCore::V8Proxy::precompileScript): + (WebCore::V8Proxy::evaluate): + * bindings/v8/V8Proxy.h: + +2010-06-19 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Port SocketStream + https://bugs.webkit.org/show_bug.cgi?id=39671 + + Port SocketStream with BREW MP's ISocket interface. + + * platform/network/brew/SocketStreamError.h: Added. + (WebCore::SocketStreamError::SocketStreamError): + * platform/network/brew/SocketStreamHandle.h: Added. + (WebCore::SocketStreamHandle::create): + * platform/network/brew/SocketStreamHandleBrew.cpp: Added. + (WebCore::socketStreamConnectCallback): + (WebCore::getHostByNameCallback): + (WebCore::socketReadableCallback): + (WebCore::networkManager): + (WebCore::SocketStreamHandlePrivate::SocketStreamHandlePrivate): + (WebCore::SocketStreamHandlePrivate::~SocketStreamHandlePrivate): + (WebCore::SocketStreamHandlePrivate::socketConnected): + (WebCore::SocketStreamHandlePrivate::socketReadyRead): + (WebCore::SocketStreamHandlePrivate::connect): + (WebCore::SocketStreamHandlePrivate::send): + (WebCore::SocketStreamHandlePrivate::close): + (WebCore::SocketStreamHandlePrivate::socketClosed): + (WebCore::SocketStreamHandlePrivate::socketError): + (WebCore::SocketStreamHandle::SocketStreamHandle): + (WebCore::SocketStreamHandle::~SocketStreamHandle): + (WebCore::SocketStreamHandle::platformSend): + (WebCore::SocketStreamHandle::platformClose): + (WebCore::SocketStreamHandle::didReceiveAuthenticationChallenge): + (WebCore::SocketStreamHandle::receivedCredential): + (WebCore::SocketStreamHandle::receivedRequestToContinueWithoutCredential): + (WebCore::SocketStreamHandle::receivedCancellation): + * platform/network/brew/SocketStreamHandlePrivate.h: Added. + +2010-06-19 Nikita Vasilyev <me@elv1s.ru> + + Reviewed by Pavel Feldman. + + Web Inspector: Prevent from copying "filename.css" in Styles pane + https://bugs.webkit.org/show_bug.cgi?id=40420 + + * inspector/front-end/Section.js: + (WebInspector.Section.prototype.set subtitle): + (WebInspector.Section.prototype.get subtitleAsText): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection): + * inspector/front-end/inspector.css: + (.styles-section .subtitle::before, .styles-section .subtitle a::before): + +2010-06-19 Alex Milowski <alex@milowski.com> + + Reviewed by Darin Adler. + + A fix for a change in https://bugs.webkit.org/show_bug.cgi?id=39941 + that caused a compile error in MathML. + https://bugs.webkit.org/show_bug.cgi?id=40827 + + * mathml/MathMLElement.cpp: + (WebCore::MathMLElement::MathMLElement): + +2010-06-19 Kartikaya Gupta <kagupta@rim.com> + + Reviewed by Nikolas Zimmermann. + + CPP bindings missing some APIs + https://bugs.webkit.org/show_bug.cgi?id=40570 + + Add missing C++ DOM API bindings. Specifically: + - NodeFilter callback support + - Missing custom method implementations in HTMLCollection and HTMLOptionsCollection + - Missing EventTarget static type-determination methods + - Fix CPP binding generator to not generate d-ptrs for classes that extend EventTarget and just use the parent's d-ptr instead + - Switch binding generator to use DOMWindow instead of AbstractView so that necessary W3C-defined methods (e.g. getComputedStyle) are accessible. + + * bindings/cpp/WebDOMDOMWindowCustom.cpp: Added. + (WebDOMDOMWindow::addEventListener): + (WebDOMDOMWindow::removeEventListener): + * bindings/cpp/WebDOMEventTarget.cpp: + (toWebKit): + * bindings/cpp/WebDOMEventTarget.h: + * bindings/cpp/WebDOMHTMLCollectionCustom.cpp: Added. + (WebDOMHTMLCollection::item): + (WebDOMHTMLCollection::namedItem): + * bindings/cpp/WebDOMHTMLOptionsCollectionCustom.cpp: Added. + (WebDOMHTMLOptionsCollection::length): + (WebDOMHTMLOptionsCollection::setLength): + * bindings/cpp/WebDOMNodeFilterCustom.cpp: Added. + (WebDOMNodeFilter::acceptNode): + (toWebKit): + * bindings/cpp/WebNativeNodeFilterCondition.cpp: Added. + (WebNativeNodeFilterCondition::WebNativeNodeFilterCondition): + (WebNativeNodeFilterCondition::~WebNativeNodeFilterCondition): + (WebNativeNodeFilterCondition::acceptNode): + * bindings/cpp/WebNativeNodeFilterCondition.h: Added. + (WebNativeNodeFilterCondition::create): + * bindings/scripts/CodeGeneratorCPP.pm: + * dom/NodeFilter.idl: + * page/DOMWindow.idl: + +2010-06-19 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Adding a conditional gyp dependency for the WebCore target to + the gles2_c_lib which is required by the gpu compositor. The dependency will + only kick in if the accelerated_compositing path is enabled. + https://bugs.webkit.org/show_bug.cgi?id=40801 + + * WebCore.gyp/WebCore.gyp: + +2010-06-19 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Platform plugin's multi-select does not take OptGroup into account + https://bugs.webkit.org/show_bug.cgi?id=40718 + + In multi-select elements, optgroup elements are counted in the index calculation, + but in single-select they are not. Keep the same logic even when NO_LISTBOX_RENDERING + is enabled. + Added tests to the existing manual test, as testing this requires a special build, in which + NO_LISTBOX_RENDERING is enabled. + + * html/HTMLSelectElement.cpp: + (WebCore::HTMLSelectElement::listBoxSelectItem): + * manual-tests/no-listbox-rendering.html: + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::listBoxSelectItem): + +2010-06-19 Thomas Van Lenten <thomasvl@chromium.org> + + Reviewed by David Levin. + + Warnings from -Wextra in a Chromium Mac build + 1. checks of unsigned >= 0 + 2. enumeral and non-enumeral type in conditional expression + 3. copy ctors that don't call the super copy ctor or ctor + No functionality change so no new tests. + + https://bugs.webkit.org/show_bug.cgi?id=40791 + + * platform/chromium/ChromiumDataObject.cpp: + (WebCore::ChromiumDataObject::ChromiumDataObject): + * platform/chromium/ThemeChromiumMac.mm: + (WebCore::updateStates): + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::updateActiveState): + +2010-06-19 Ben Murdoch <benm@google.com> + + Reviewed by Pavel Feldman. + + Fix build break with inspector disabled. + https://bugs.webkit.org/show_bug.cgi?id=40790 + + Replace a #include with a forward declaration. + + Fixing a build break so no new tests required. + + * inspector/InspectorController.h: Forward declare InspectorValue + rather than #including its header which has its content guarded + out. + +2010-06-19 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Fisher. + + [chromium]Refactor input method related APIs. + https://bugs.webkit.org/show_bug.cgi?id=40608 + + No new tests are needed, because there is no new functionality. + + * page/FocusController.cpp: + (WebCore::FocusController::setFocusedNode): + +2010-06-19 George Wright <gwright@rim.com> + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=40720 + + Make setWapInputFormat() public again as CSSStyleSelector.cpp calls this when WCSS is enabled. + + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::data): + +2010-06-02 Robert Hogan <robert@webkit.org> + + Reviewed by Adam Barth. + + [Qt] Support evaluateScriptInIsolatedWorld() + + https://bugs.webkit.org/show_bug.cgi?id=40079 + + getOwnPropertyNames() crashes if PropertyNameArray is size 0. This change allows + http/tests/world-reuse.html and didClearWindowObject.html to fail instead of crash. + + * WebCore.pro: Add qwebscriptworld.* + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-06-19 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Eric Seidel. + + Some very minor cleanups for HTML5 Parser + https://bugs.webkit.org/show_bug.cgi?id=40638 + + No new tests because no new functionality. + + * html/HTML5DocumentParser.cpp: + (WebCore::): Make ctor explicit. + * html/HTML5DocumentParser.h: + (WebCore::HTML5DocumentParser::InsertionPointRecord::InsertionPointRecord): Make ctor explicit. + * html/HTML5Lexer.cpp: + (WebCore::HTMLNames::isEndTagBufferingState): Use switch to generate an efficient table with single branch. + * html/HTML5Token.h: + (WebCore::HTML5Token::forceQuirks): Add const. + * html/HTML5TreeBuilder.h: + (WebCore::HTML5TreeBuilder::isPaused): Add const. + +2010-06-18 Aaron Boodman <aa@chromium.org> + + Remove WebKit::WebDocument::isXHTMLDocument. + https://bugs.webkit.org/show_bug.cgi?id=40815 + + * dom/Document.h: remove isXHTML() getter. + +2010-06-19 Aaron Boodman <aa@chromium.org> + + Unreviewed, rolling out r61466. + http://trac.webkit.org/changeset/61466 + https://bugs.webkit.org/show_bug.cgi?id=40816 + + Landed wrong change + + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::initContextIfNeeded): + * bindings/v8/V8DOMWindowShell.h: + +2010-06-18 Aaron Boodman <aa@chromium.org> + + WebKit API: Undo static hooks into V8 when WebKit is shut down. + https://bugs.webkit.org/show_bug.cgi?id=40816 + + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::initContextIfNeeded): + (WebCore::V8DOMWindowShell::initializeV8IfNeeded): + (WebCore::V8DOMWindowShell::uninitializeV8IfNeeded): + * bindings/v8/V8DOMWindowShell.h: + +2010-06-18 Jessie Berlin <jberlin@webkit.org> + + Reviewed by Darin Adler. + + Bug 19509 - Database Tables in the Inspector should be sortable + https://bugs.webkit.org/show_bug.cgi?id=19509 + + * inspector/front-end/StoragePanel.js: + (WebInspector.StoragePanel.prototype.dataGridForResult): + Make each column in the DataGrid sortable. + (WebInspector.StoragePanel.prototype._sortDataGrid.comparator): + Make sure to sort numeric columns by their numeric values, instead of lexicographically. + (WebInspector.StoragePanel.prototype._sortDataGrid): + Sort the entries in the DataGrid based on the selected column. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + More clang++ warning fixes. + + * inspector/InspectorFrontendClientLocal.cpp: + (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight): + * platform/graphics/mac/FontPlatformData.h: + * platform/graphics/mac/WebLayer.mm: + (-[CALayer _descriptionWithPrefix:]): + +2010-06-18 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + * WebCore.gyp/WebCore.gyp: Modified inclusion rule in to actually add WebSystemInterface.mm. + +2010-06-18 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + * WebCore.gyp/WebCore.gyp: Renamed WebSystemInterface.m to WebSystemInterface.mm. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make WebCoreSystemInterface.h a C++ only header + https://bugs.webkit.org/show_bug.cgi?id=40867 + + * platform/mac/WebCoreSystemInterface.h: + +2010-06-18 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Convert column span from an unsigned short type to an unsigned int + type. Fixes a divide-by-zero crash arising from using a zero colspan + value coming from a narrow cast of an int to an unsigned short. + https://bugs.webkit.org/show_bug.cgi?id=40812 + + Test: fast/table/zero-colspan-crash.html + + * rendering/RenderTable.h: Change span from unsigned short to unsigned int. + * rendering/RenderTableSection.cpp: Fix a compiler warning with comparing + unsigned int with signed int. Value of an unsigned int here cannot be + greater than maximum positive value of a signed int. + (WebCore::RenderTableSection::addCell): + +2010-06-18 Ananth Jasty <ext-ananth.jasty@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Text spacing miscalculation when using wordSpacing. + https://bugs.webkit.org/show_bug.cgi?id=40483 + + Removed wordSpacing compensation in FontQt whitespace width + calculation. The QFontMetrics::width() overload that takes + a character does not take QFont's word spacing into account. + + * platform/graphics/qt/FontQt.cpp: + (WebCore::Font::floatWidthForComplexText): + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Get rid of PluginDataMac.mm and use the plug-in strategy instead + https://bugs.webkit.org/show_bug.cgi?id=40860 + + * WebCore.xcodeproj/project.pbxproj: + * page/mac/WebCoreViewFactory.h: + * plugins/PluginData.cpp: + (WebCore::PluginData::refresh): + (WebCore::PluginData::initPlugins): + * plugins/PluginStrategy.h: + * plugins/mac/PluginDataMac.mm: Removed. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Fix some (not all) clang++ warnings. + + * dom/Position.h: + (WebCore::lastOffsetInNode): + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::deleteInsignificantText): + * loader/appcache/ApplicationCache.cpp: + (WebCore::ApplicationCache::resourceForRequest): + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::offsetForPosition): + (WebCore::ComplexTextController::collectComplexTextRuns): + * platform/network/CredentialStorage.cpp: + (WebCore::protectionSpaceMapKeyFromURL): + * rendering/style/StyleRareNonInheritedData.h: + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add stubbed out WebPlatformStrategies class to WebKit. + https://bugs.webkit.org/show_bug.cgi?id=40851 + + * WebCore.base.exp: + * platform/PlatformStrategies.cpp: + * platform/PlatformStrategies.h: + (WebCore::PlatformStrategies::~PlatformStrategies): + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Fix build errors when building with clang++. + + * loader/archive/cf/LegacyWebArchiveMac.mm: + Move the const qualifier to the right place. + + * page/EditorClient.h: + * platform/Pasteboard.h: + Use @class when forward declaring Objective-C classes in Objective-C. + +2010-06-18 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=40852 + <rdar://problem/8105498> Limit simultaneous DNS prefetch request number (40852) + + No change in functionality, so no tests. + + We still queue up to 64 names, but only make up to 8 requests at once. If there are names + remaining in queue, we retry after a short timeout (which is easier than posting + notifications from client callback). + + * platform/network/cf/DNSCFNet.cpp: + (WebCore::DNSResolveQueue::add): + (WebCore::DNSResolveQueue::fired): + +2010-06-18 Zhenyao Mo <zmo@google.com> + + Reviewed by Simon Fraser. + + WebGL demos show bad flicker + https://bugs.webkit.org/show_bug.cgi?id=38560 + + * platform/graphics/mac/GraphicsContext3DMac.mm: + (WebCore::GraphicsContext3D::prepareTexture): Move ensureContext() out of if-block so it's always executed. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PlatformStrategies and PluginStrategy classes. + https://bugs.webkit.org/show_bug.cgi?id=40850 + + * WebCore.xcodeproj/project.pbxproj: + * platform/PlatformStrategies.cpp: Added. + (WebCore::PlatformStrategies::~PlatformStrategies): + (WebCore::platformStrategies): + (WebCore::setPlatformStrategies): + * platform/PlatformStrategies.h: Added. + (WebCore::PlatformStrategies::pluginStrategy): + (WebCore::PlatformStrategies::PlatformStrategies): + * plugins/PluginData.cpp: + * plugins/PluginStrategy.h: Added. + (WebCore::PluginStrategy::~PluginStrategy): + +2010-06-18 Martin Robinson <mrobinson@igalia.com> + + Unreviewed. + + Fix the GTK+ build after r61413 and 61379. + + * bindings/scripts/CodeGeneratorGObject.pm: + Produce a g_value_set that uses getterExpressionPrefix instead of the raw getter. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_property): Update expected test results. + +2010-06-18 Leandro Pereira <leandro@profusion.mobi> + + [EFL] Unreviewed build fix. + + * CMakeLists.txt: Add inspector/ScriptBreakpoint.cpp. + +2010-06-18 Andy Estes <aestes@apple.com> + + Rubber-stamped by Sam Weinig. + + Update copyright header. + + * html/HTMLLinkElement.h: + +2010-06-17 Andy Estes <aestes@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/8091385> Prevent a crash in WebCore when removing a stylesheet link element in + in a listener to its beforeload event. + https://bugs.webkit.org/show_bug.cgi?id=40742 + + Postpone loading of link elements until after they have been inserted into the DOM and + attached. This prevents DOM mutations triggered by beforeload handlers from firing in the + midst of DOM insertion, which can lead to assertion failures and crashes. + + Test: fast/dom/beforeload/remove-link-in-beforeload-listener.html + + * html/HTMLLinkElement.cpp: + (WebCore::HTMLLinkElement::HTMLLinkElement): Initialize m_shouldProcessAfterAttach to false. + (WebCore::HTMLLinkElement::processCallback): Add a static callback function which calls + HTMLLinkElement::process(). + (WebCore::HTMLLinkElement::insertedIntoDocument): Instead of calling process() directly, set + m_shouldProcessAfterAttach to true to indicate that process() should be called after attach(). + (WebCore::HTMLLinkElement::removedFromDocument): Set m_shouldProcessAfterAttach to false. + (WebCore::HTMLLinkElement::attach): If m_shouldProcessAfterAttach is true, register + HTMLLinkElement::processCallback() as a post-attach callback. + * html/HTMLLinkElement.h: Add m_shouldProcessAfterAttach. + (WebCore::HTMLLinkElement::canLazyAttach): Override canLazyAttach() to return false to + indicate that a full attach should be performed. This ensures the post-attach callbacks are + fired. + +2010-06-18 Chris Fleizach <cfleizach@apple.com> + + Unreviewed. Windows build fix. + + AX: presentational role needs to be inherited by required elements + https://bugs.webkit.org/show_bug.cgi?id=40132 + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::inheritsPresentationalRole): + +2010-06-18 Chris Fleizach <cfleizach@apple.com> + + Reviewed by David Kilzer. + + AX: presentational role needs to be inherited by required elements + https://bugs.webkit.org/show_bug.cgi?id=40132 + + Test: platform/mac/accessibility/inherited-presentational-lists.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + (WebCore::AccessibilityRenderObject::inheritsPresentationalRole): + * accessibility/AccessibilityRenderObject.h: + (WebCore::AccessibilityRenderObject::node): + +2010-06-18 Darin Adler <darin@apple.com> + + Fix GTK build after reflection change. + + * bindings/scripts/CodeGeneratorGObject.pm: Changed code + that emits setters to convey the correct type of the attribute. + The GObject code generator takes a different approach to attributes + than the others, so it's hacked a bit to make it more like them. + We should find a way to share more code between the different generators. + + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + Updated to expect correct results. + +2010-06-18 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed: Qt build fix. + + * inspector/InspectorController.cpp: + +2010-06-18 Justin Garcia <justin.garcia@apple.com> + + Reviewed by Ojan Vafai. + + https://bugs.webkit.org/show_bug.cgi?id=39798 + No selection change notification for editing operation that doesn't change the selection's DOM position + + Some editing operations change the selection visually without affecting its position within + the DOM. This was previously known to occur for certain typing commands, but it can also + occur for some Pastes and changes to block style. + + * editing/Editor.cpp: + (WebCore::Editor::appliedEditing): + (WebCore::Editor::unappliedEditing): + (WebCore::Editor::reappliedEditing): + (WebCore::Editor::changeSelectionAfterCommand): + * editing/Editor.h: + +2010-06-18 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed build fix. + + [EFL] Build break on Debug build. + https://bugs.webkit.org/show_bug.cgi?id=40810 + + * CMakeLists.txt: Add CSSPreloadScanner.cpp + +2010-06-18 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: persist breakpoints in inspector settings. + https://bugs.webkit.org/show_bug.cgi?id=14190 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::setSessionSettings): + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::setBreakpoint): + (WebCore::InspectorController::removeBreakpoint): + (WebCore::InspectorController::didParseSource): + (WebCore::InspectorController::breakpointsSettingKey): + (WebCore::InspectorController::loadBreakpoints): + (WebCore::InspectorController::saveBreakpoints): + * inspector/InspectorController.h: + * inspector/InspectorValues.cpp: + (WebCore::InspectorValue::parseJSON): + * inspector/InspectorValues.h: + * inspector/ScriptBreakpoint.cpp: Added. + (WebCore::ScriptBreakpoint::sourceBreakpointsFromInspectorObject): + (WebCore::ScriptBreakpoint::inspectorObjectFromSourceBreakpoints): + * inspector/ScriptBreakpoint.h: + * inspector/front-end/BreakpointManager.js: + (WebInspector.BreakpointManager.prototype.addBreakpoint): + (WebInspector.BreakpointManager.prototype.restoredBreakpoint): + (WebInspector.BreakpointManager.prototype.breakpointsForSourceID): + (WebInspector.BreakpointManager.prototype.breakpointsForURL): + (WebInspector.BreakpointManager.prototype._addBreakpoint): + * inspector/front-end/inspector.js: + (WebInspector.restoredBreakpoint): + +2010-06-18 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Implement additional DOM attribute reflection for bindings + https://bugs.webkit.org/show_bug.cgi?id=39936 + + - Added support for [Reflect] for long, unsigned long, and boolean + attributes. + - Fixed code that set attributes like this: <video controls="controls"> + to instead set them like this: <video controls>. + - Added lots more uses of [Reflect]. + - Removed now-unneeded [ConvertFromString]. + - Made [Reflect] imply [ConvertNullToNullString] so we can get rid + of most uses of the latter. + - Made [Reflect] automatically lowercase the name of the reflected + content attribute to minimize the need to specify a custom content + attribute name. + + One thing this patch does *not* do is remove the unneeded functions + in the various DOM classes that are no longer used by the bindings. + We should do that in a followup. + + * bindings/scripts/CodeGenerator.pm: Added new functions so code + can be shared across bindings, GetterExpressionPrefix and + SetterExpressionPrefix. We can do a lot more refactoring like + this in the future. + + * bindings/scripts/CodeGeneratorCPP.pm: Removed unneeded + ConvertFromString handling, changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + to better handle reflected DOM attributes. + + * bindings/scripts/CodeGeneratorGObject.pm: Removed unneeded + ConvertFromString handling, changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + to better handle reflected DOM attributes. Fixed a few things + in the output so the .cpp file will have more WebKit style. + The .h file should be GTK style, but the .cpp file can be the + standard WebKit style eventually. + + * bindings/scripts/CodeGeneratorJS.pm: Changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + and removed a now-unneeded IsSVGAnimatedType special case since + the new functions take care of it. Made reflected attributes + automatically convert null to the null string without a + separate ConvertNullToNullString attribute. + + * bindings/scripts/CodeGeneratorObjC.pm: Changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + and removed a now-unneeded IsSVGAnimatedType special case since + the new functions take care of it. Redid the special cases for + ownerDocument and for operator to fit better with the new code + paths. Removed unneeded ConvertFromString handling. + + * bindings/scripts/CodeGeneratorV8.pm: Changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + and removed a now-unneeded IsSVGAnimatedType special case since + the new functions take care of it. Made reflected attributes + automatically convert null to the null string without a + separate ConvertNullToNullString attribute. + + * bindings/scripts/test/TestObj.idl: Added some test cases for + content attribute reflection and for exceptions in string-typed + attributes. + + * bindings/scripts/test/CPP/WebKitDOMTestObj.cpp: Updated. + * bindings/scripts/test/CPP/WebKitDOMTestObj.h: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Ditto. + * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. + * bindings/scripts/test/JS/JSTestObj.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestObj.mm: Ditto. + * bindings/scripts/test/V8/V8TestObj.cpp: Ditto. + + * dom/Element.cpp: + (WebCore::Element::getIntegralAttribute): Added. + (WebCore::Element::setIntegralAttribute): Added. + (WebCore::Element::getUnsignedIntegralAttribute): Added. + (WebCore::Element::setUnsignedIntegralAttribute): Added. + * dom/Element.h: Added new attribute get/set functions for bindings. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::isURLAttribute): Added. Returns true for + srcAttr. + * html/HTMLMediaElement.h: Added isURLAttribute. + + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::isURLAttribute): Changed to call + HTMLMediaElement::isURLAttribute before checking for posterAttr. + + * html/HTMLAnchorElement.idl: + * html/HTMLAppletElement.idl: + * html/HTMLAreaElement.idl: + * html/HTMLBRElement.idl: + * html/HTMLBaseElement.idl: + * html/HTMLBaseFontElement.idl: + * html/HTMLBlockquoteElement.idl: + * html/HTMLBodyElement.idl: + * html/HTMLButtonElement.idl: + * html/HTMLDListElement.idl: + * html/HTMLDirectoryElement.idl: + * html/HTMLDivElement.idl: + * html/HTMLElement.idl: + * html/HTMLEmbedElement.idl: + * html/HTMLFontElement.idl: + * html/HTMLFormElement.idl: + * html/HTMLFrameElement.idl: + * html/HTMLFrameSetElement.idl: + * html/HTMLHRElement.idl: + * html/HTMLHeadElement.idl: + * html/HTMLHeadingElement.idl: + * html/HTMLHtmlElement.idl: + * html/HTMLIFrameElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLIsIndexElement.idl: + * html/HTMLLIElement.idl: + * html/HTMLLabelElement.idl: + * html/HTMLLegendElement.idl: + * html/HTMLLinkElement.idl: + * html/HTMLMapElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLMenuElement.idl: + * html/HTMLMetaElement.idl: + * html/HTMLModElement.idl: + * html/HTMLOListElement.idl: + * html/HTMLObjectElement.idl: + * html/HTMLOptGroupElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLParagraphElement.idl: + * html/HTMLParamElement.idl: + * html/HTMLPreElement.idl: + * html/HTMLQuoteElement.idl: + * html/HTMLScriptElement.idl: + * html/HTMLStyleElement.idl: + * html/HTMLTableCaptionElement.idl: + * html/HTMLTableCellElement.idl: + * html/HTMLTableColElement.idl: + * html/HTMLTableElement.idl: + * html/HTMLTableRowElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLTextAreaElement.idl: + * html/HTMLUListElement.idl: + * html/HTMLVideoElement.idl: + * svg/SVGElement.idl: + Added more uses of [Reflect]. Got rid of uses of [ConvertNullToNullString] that + are now unneeded since [Reflect] now implies that. Changed formatting to be + simpler and consistent without all the lining up and multiple lines. + +2010-06-17 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Remove some unnecessary checks that cause compiler warnings. + https://bugs.webkit.org/show_bug.cgi?id=40772 + + * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp: + (WebCore::V8SQLResultSetRowList::itemCallback): + * bindings/v8/npruntime.cpp: + +2010-06-18 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Implement 'takeHeapSnapshot' in InspectorController. + + https://bugs.webkit.org/show_bug.cgi?id=40834 + + * bindings/js/ScriptProfiler.h: + (WebCore::ScriptProfiler::takeHeapSnapshot): + * bindings/v8/ScriptProfiler.cpp: + (WebCore::ScriptProfiler::takeHeapSnapshot): + * bindings/v8/ScriptProfiler.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::takeHeapSnapshot): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::takeHeapSnapshot): + * inspector/InspectorController.h: + +2010-06-18 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + REGRESSION (r61379?): Assertion failure in Element::getURLAttribute() when accessing the src attribute of a script element + https://bugs.webkit.org/show_bug.cgi?id=40831 + + Test: fast/dom/HTMLScriptElement/isURLAttribute.html + + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::isURLAttribute): Check for the 'src' attribute. + +2010-06-18 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61405. + http://trac.webkit.org/changeset/61405 + https://bugs.webkit.org/show_bug.cgi?id=40838 + + broke chromium mac compile (Requested by tonyg-cr1 on + #webkit). + + * bindings/v8/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::compileScript): + (WebCore::V8Proxy::evaluate): + * bindings/v8/V8Proxy.h: + +2010-06-18 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Fix WebGLRenderingContext helper functions find{Texture/Renderbuffer/Buffer} + https://bugs.webkit.org/show_bug.cgi?id=40176 + + * html/canvas/WebGLBuffer.cpp: Remove constructor with existing name. + * html/canvas/WebGLBuffer.h: Ditto. + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getVertexAttrib): Use findBuffer instead of creating a new WebGLBuffer. + (WebCore::WebGLRenderingContext::findTexture): Deal with name == 0 case and return raw pointer. + (WebCore::WebGLRenderingContext::findRenderbuffer): Ditto. + (WebCore::WebGLRenderingContext::findBuffer): Find WebGLBuffer object using given name. + * html/canvas/WebGLRenderingContext.h: Add findBuffer function declaration, change return type to raw pointer. + +2010-06-18 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by David Levin. + + Persist V8's ScriptData to the memory cache. + https://bugs.webkit.org/show_bug.cgi?id=38661 + + This stores V8's ScriptData in the memory cache and also causes the + network platform layer to be notified of the available cacheable + metadata. + + Chromium's morejs benchmark showed a ~7% improvement when this was + originally submitted (before it had to be rolled back). + + Test: fast/js/parser-high-byte-character.html + + * bindings/v8/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + (WebCore::ScriptSourceCode::cachedScript): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::compileScript): + (WebCore::V8Proxy::precompileScript): + (WebCore::V8Proxy::evaluate): + * bindings/v8/V8Proxy.h: + +2010-06-18 Anton Muhin <antonm@chromium.org> + + Reviewed by Dimitri Glazkov. + + [v8] Finish migration to new named property query API + https://bugs.webkit.org/show_bug.cgi?id=40771 + Remove definition which allowed gradual transition to new API. + See https://bugs.webkit.org/show_bug.cgi?id=40303 for first phase. + + * config.h: + +2010-06-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: bring XHR console records back. + - adds "Enable XHR Monitor" / "Disable XHR Monitor" actions to the console's context menu + - make the chosen option persist in the settings. + + https://bugs.webkit.org/show_bug.cgi?id=40799 + + * English.lproj/localizedStrings.js: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::disableSearchingForNode): + (WebCore::InspectorBackend::enableMonitoringXHR): + (WebCore::InspectorBackend::disableMonitoringXHR): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::setMonitoringXHR): + (WebCore::InspectorController::didLoadResourceFromMemoryCache): + (WebCore::InspectorController::identifierForInitialRequest): + (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest): + (WebCore::InspectorController::ensureSettingsLoaded): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::monitoringXHRWasEnabled): + (WebCore::InspectorFrontend::monitoringXHRWasDisabled): + * inspector/InspectorFrontend.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype._handleContextMenuEvent): + (WebInspector.ConsoleView.prototype._registerShortcuts): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor.): + * inspector/front-end/InspectorBackendStub.js: + (.WebInspector.InspectorBackendStub): + (.WebInspector.InspectorBackendStub.prototype.enableMonitoringXHR): + (.WebInspector.InspectorBackendStub.prototype.disableMonitoringXHR): + * inspector/front-end/inspector.js: + (WebInspector.monitoringXHRWasEnabled): + (WebInspector.monitoringXHRWasDisabled): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::didFinishLoading): + +2010-06-18 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Modernize SVG Text code, following the HTML design + https://bugs.webkit.org/show_bug.cgi?id=40663 + + SVG Text does not support subpixel positioning + https://bugs.webkit.org/show_bug.cgi?id=12172 + + RenderSVGText can't do partial repaints + https://bugs.webkit.org/show_bug.cgi?id=15386 + + HTML and SVG need to share more text painting code + https://bugs.webkit.org/show_bug.cgi?id=15644 + + Rewrite SVG Text rendering, only keeping the layout of the actual characters/chunks as it was. + We're now drawing SVG Text very similar to HTML Text, utilizing the SVGInlineFlowBox/SVGInlineTextBox structure, + instead of painting all text content of a <text> element from the SVGRootInlineBox, as it was the last years. + + Rough overview of the changes: + - Partial repainting support for text selections (startPos/endPos are respected), no more redrawing of the whole <text> content while selecting + - Subpixel positioning (near pixel-perfect rendering for all W3C tests that contain text, finally!) + -> much better textPath results, characters now align as expected, as all rounding hacks are disabled for SVG text runs, and subpixel precision is used while painting + - No more custom handling of selection, the standard methods offsetFromPosition() / selectionRectForText() are used instead. + - Selection works as expected on stretched/squeezed text (lengthAdjust="spacingAndGlyphs"), takes 'includePartialGlyphs' into account - just like HTML text + - Correct text decoration drawing (proper with and positions and rendering-order, underline/overline before text, strike-through afterwards) + - Proper sizing of all InlineBoxes, starting from the SVGRootInlineBox, down to every single flow & text box + -> correct DRT results, no more weird negative offsets of text runs, etc. Looks exactly like the HTML text test results. + - Rewritten SVGTextContentElement API to take per-character / per-chunk transformations into account. + - Speeeeeed! Drawing is much faster now. + + Add 24 new testcases covering basic selection features and the SVGTextContentElement API. Each test draws a half-opaque red rectangle, calculated using + SVGTextContentElement API to highlight the area that is supposed to be selected. Then eventSender API is utilized to move the mouse to the calculated + start origin, holding it down and moving it to the end position. + + A detailed list of tests that show progression, can be found in the corresponding LayoutTests/ChangeLog. + Note that this requires a rebaselining of all SVG tests containing text elements. + + Tests: svg/hixie/text/001.xml (moved from svg/hixie/text/001-broken.xml) + svg/text/lengthAdjust-text-metrics.html + svg/text/select-textLength-spacing-squeeze-1.svg + svg/text/select-textLength-spacing-squeeze-2.svg + svg/text/select-textLength-spacing-squeeze-3.svg + svg/text/select-textLength-spacing-squeeze-4.svg + svg/text/select-textLength-spacing-stretch-1.svg + svg/text/select-textLength-spacing-stretch-2.svg + svg/text/select-textLength-spacing-stretch-3.svg + svg/text/select-textLength-spacing-stretch-4.svg + svg/text/select-textLength-spacingAndGlyphs-squeeze-1.svg + svg/text/select-textLength-spacingAndGlyphs-squeeze-2.svg + svg/text/select-textLength-spacingAndGlyphs-squeeze-3.svg + svg/text/select-textLength-spacingAndGlyphs-squeeze-4.svg + svg/text/select-textLength-spacingAndGlyphs-stretch-1.svg + svg/text/select-textLength-spacingAndGlyphs-stretch-2.svg + svg/text/select-textLength-spacingAndGlyphs-stretch-3.svg + svg/text/select-textLength-spacingAndGlyphs-stretch-4.svg + svg/text/select-x-list-1.svg + svg/text/select-x-list-2.svg + svg/text/select-x-list-3.svg + svg/text/select-x-list-4.svg + svg/text/select-x-list-with-tspans-1.svg + svg/text/select-x-list-with-tspans-2.svg + svg/text/select-x-list-with-tspans-3.svg + svg/text/select-x-list-with-tspans-4.svg + + * rendering/InlineBox.h: Remove not needed isInlineBox() method. + (WebCore::InlineBox::isInlineTextBox): Constify this method. + (WebCore::InlineBox::isSVGInlineTextBox): Added, with ENABLE(SVG) guards, just like the existing isSVGRootInlineBox(). + (WebCore::InlineBox::isSVGRootInlineBox): Constify this method. + (WebCore::InlineBox::calculateBoundaries): Added, with ENABLE(SVG) guards, used to calculate the whole boundaries of a InlineText/FlowBox, only used in SVG text. + * rendering/InlineFlowBox.h: Devirtualize placeBoxesHorizontally(), SVG no more overrides it. + * rendering/InlineTextBox.h: Virtualize selectionStartEnd() - SVGInlineTextBox needs to change start/endPositions based on the current text chunk part that it's rendering. + SVGTextChunkLayoutInfo.h contains a detailed documentation what a SVGTextChunk/SVGTextChunkPart is, and why they are necessary. + (WebCore::InlineTextBox::isInlineTextBox): Constify this method. + * rendering/RenderBlock.h: + (WebCore::RenderBlock::forceLayoutInlineChildren): Add helper method, used only by RenderSVGText, to use a simplified layout strategy, which is a big speed win. + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::computeHorizontalPositionsForLine): Remove all isSVGText() special cases, as this function is not called anymore for SVG text. + (WebCore::RenderBlock::layoutInlineChildren): Don't call computeHorizontalPositionsForLine() for SVG text. computePerCharacterLayoutInformation() overrides it anyway. + * rendering/RenderSVGInline.cpp: Remove custom absoluteRects/absoluteQuads code, all shared with RenderInline now. + (WebCore::RenderSVGInline::clippedOverflowRectForRepaint): Added, forward to SVGRenderBase, just like all other non-text SVG renderers do. + (WebCore::RenderSVGInline::computeRectForRepaint): Ditto. + (WebCore::RenderSVGInline::mapLocalToContainer): Ditto + * rendering/RenderSVGInline.h: + * rendering/RenderSVGInlineText.cpp: Remove destroy() hack, which called setNeedsLayoutAndPrefWidthsRecalc/repaint on destruction. + As repaint rects work properly now, this hack is no longer necessary, it was only hiding the real problem. + (WebCore::RenderSVGInlineText::styleDidChange): Don't skip RenderText::styleDidChange() anymore, which automatically schedules layout changes for us. + (WebCore::RenderSVGInlineText::localCaretRect): Remove outdated comment, localCaretRect() is not yet needed in SVG text code. + * rendering/RenderSVGInlineText.h: Remove custom absoluteRects/absoluteQuads/selectionRectForRepaint/positionForPoint/destroy/computeRectForRepaint* code, all shared with RenderText now. + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::mapLocalToContainer): Take x/y translation into account, but do NOT include in localToParentTransform(), as that would affect rendering. + (WebCore::RenderSVGText::layout): Use super-simplified layout strategy, removing a lot of uncessary stuff done by RenderBlock, that SVG does not need. + (WebCore::RenderSVGText::absoluteRects): Remove dead-code, retreving the RenderSVGRoot* object, not necessary since a longer time. + (WebCore::RenderSVGText::absoluteQuads): Ditto. + (WebCore::RenderSVGText::paint): Early exit if we're not in PaintPhaseForeground/PaintPhaseSelfOutline. We're not interessted in other phases. + (WebCore::RenderSVGText::strokeBoundingBox): Fix stroke width calculation, no need to special case SVGFonts. + * rendering/RenderSVGText.h: Remove updateFirstLineBlock/updateFirstLetter overrides, the new RenderSVGText::layout() code, doesn't use these methods at all. + We asked RenderBlock to layout before, which was calling updateFirstLetter & co, this is gone now, as it was all not needed. + (WebCore::RenderSVGText::objectBoundingBox): Directly return the frameRect here, inlined for speed. + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::verticallyAlignBoxes): Early-exit if we're a SVGRootInlineBox. SVG handles this on its own. + * rendering/RootInlineBox.h: Devirtualize verticallyAlignBoxes(), SVG no longer overrides it. Remove virtual computePerCharacterLayoutInformation() method, only lives in SVGRootInlineBox now. + * rendering/SVGCharacterData.h: Remove no longer needed SVGTextDecorationInfo. + * rendering/SVGCharacterLayoutInfo.cpp: Don't pass a reference to a Vector<SVGChar> to SVGCharacterLayoutInfo, let it create it. + (WebCore::SVGCharacterLayoutInfo::SVGCharacterLayoutInfo): + * rendering/SVGCharacterLayoutInfo.h: + * rendering/SVGInlineFlowBox.cpp: + (WebCore::SVGInlineFlowBox::paint): Ask children to paint. + (WebCore::SVGInlineFlowBox::calculateBoundaries): Calculate boundaries by uniting all direct children boundaries. + * rendering/SVGInlineFlowBox.h: Remove placeBoxesHorizontally, which does not get called anymore, and does not need to be overriden. + * rendering/SVGInlineTextBox.cpp: + (WebCore::SVGInlineTextBox::SVGInlineTextBox): Don't use abbrevations for variable names, initialize new member variables. + (WebCore::SVGInlineTextBox::measureCharacter): New helper function extracted from buildLayoutInformation, replacing calculateGlyphWidth/Height. + (WebCore::SVGInlineTextBox::offsetForPosition): Implement this method by utilizing Font::offsetForPosition(), but respecting the text chunk parts. + (WebCore::SVGInlineTextBox::positionForOffset): No change here, still not used. + (WebCore::SVGInlineTextBox::selectionRect): Rewritten, utilizing Font::selectionRectForText(), taking text chunk parts into account, and the supplied startPos/endPos. + (WebCore::SVGInlineTextBox::paint): Rewritten, to handle paint servers much more elegant, than the old solution. See code for details, too much to explain here. + (WebCore::SVGInlineTextBox::acquirePaintingResource): Helper function, used from paint(). + (WebCore::SVGInlineTextBox::releasePaintingResource): Ditto. + (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting): Ditto. + (WebCore::SVGInlineTextBox::restoreGraphicsContextAfterTextPainting): Ditto. + (WebCore::SVGInlineTextBox::constructTextRun): Helper function centralizing the creation of a TextRun object, used to draw/measure SVG text. + (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoChunkPartCoordinates): Important helper function, mapping a startPos/endPos from InlineTextBox + coordinate space to the SVGInlineTextBox, respecting the current text chunk part. + (WebCore::SVGInlineTextBox::selectionStartEnd): Call InlineTextBox::selectionStartEnd(), and apply post fixes when m_currentChunkPart is set. (called when painting a selected chunk part) + (WebCore::positionOffsetForDecoration): Refactored from old paintDecoration() code. + (WebCore::thicknessForDecoration): Ditto. + (WebCore::findRenderObjectDefininingTextDecoration): Ditto. + (WebCore::SVGInlineTextBox::paintDecoration): Ditto. (Can not share the code with HTML, as we need floating point precision, and directly call fillRect, instead of drawHighlightForText.) + (WebCore::SVGInlineTextBox::paintDecorationWithStyle): Ditto. + (WebCore::SVGInlineTextBox::paintSelection): New method, painting text selections with floating-point precision. + (WebCore::SVGInlineTextBox::paintText): New method, painting text with floating-point precision, correctly handling selected text, removing the need for special SVG text sub-paint phases. + (GlyphFill/StrokeSelectionPhase, GlyphFill/StrokePhase) + (WebCore::SVGInlineTextBox::buildLayoutInformation): Use new measureCharacter() helper function, renamed some variables, to avoid abbrevations. + (WebCore::SVGInlineTextBox::calculateGlyphBoundaries): Rewritten to use new measureCharacter() helper function. + (WebCore::SVGInlineTextBox::calculateBoundaries): Rewritten to take text chunk parts into account, serves as central method used to layout InlineBoxes (see SVGRootInlineBox.) + * rendering/SVGInlineTextBox.h: + (WebCore::SVGInlineTextBox::isSVGInlineTextBox): Added. + (WebCore::SVGInlineTextBox::setHeight): Rename variable, to avoid abbrevations. + (WebCore::SVGInlineTextBox::chunkTransformation): New helper function, returning the transformation, that gets applied to the complete text chunk, if any. + (WebCore::SVGInlineTextBox::setChunkTransformation): New helper function used by SVGRrootInlineBox, to set the chunk transformation, during text chunk part propagation phase. + (WebCore::SVGInlineTextBox::addChunkPartInformation): Ditto. + (WebCore::SVGInlineTextBox::svgTextChunkParts): Ditto. + * rendering/SVGRootInlineBox.cpp: Virtually rewritten, to be designed more like HTMLs RootInlineBox, diving into children for painting. + (WebCore::SVGRootInlineBox::paint): Ask children to paint, nothing more. No more traversing through the SVGTextChunks, figuring out which part to render, this is done in layout phase now. + (WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation): Completly redesigned, see SVGTextChunkLayoutInfo.h for a high-level overview. + (WebCore::SVGRootInlineBox::buildLayoutInformation): Just small cleanups, nothing changed here. + (WebCore::SVGRootInlineBox::layoutChildBoxes): New helper function, extracted from old layoutInlineBoxes(). + (WebCore::SVGRootInlineBox::layoutRootBox): Ditto. + (WebCore::SVGRootInlineBox::propagateTextChunkPartInformation): Key-concept of the new design, builds "text chunk parts" and propagates that knownledge to all child SVGInlineTextBoxes. + * rendering/SVGRootInlineBox.h: + (WebCore::SVGRootInlineBox::isSVGRootInlineBox): Constified method. + (WebCore::SVGRootInlineBox::setHeight): Change variable name, to avoid abbrevations. + * rendering/SVGTextChunkLayoutInfo.cpp: Remove if 0, enable compilation. + * rendering/SVGTextChunkLayoutInfo.h: Add large comment explaining text chunk parts, the key concept of the new design. Remove SVGTextChunkWalker & friends, no longer used. + (WebCore::SVGTextChunkPart::SVGTextChunkPart): + (WebCore::SVGTextChunkPart::isValid): + (WebCore::SVGTextChunk::SVGTextChunk): + (WebCore::SVGTextChunkLayoutInfo::SVGTextChunkLayoutInfo): + (WebCore::SVGTextChunkLayoutInfo::textChunks): + * rendering/SVGTextLayoutUtilities.cpp: + (WebCore::cummulatedWidthOfInlineBoxCharacterRange): + (WebCore::cummulatedHeightOfInlineBoxCharacterRange): + (WebCore::svgTextRunForInlineTextBox): Disable rounding hacks, explain parameters with comments, why they have which values. + * rendering/SVGTextLayoutUtilities.h: Remove SVGTextPaintSubphase and SVGTextPaintInfo. + * rendering/SVGTextQuery.cpp: Remove if 0, enable compilation. + * rendering/SVGTextQuery.h: Ditto. + * svg/SVGStyledElement.cpp: Very important change! Do not treat CSS attributes as recognized attributes, that would lead to setNeedsLayout() calls, reducing performance! + This hack existed, as we were not dealing with text updates correctly, now that RenderSVGInlineText::styleDidChange is fixed, it's no longer necessary. + (WebCore::SVGStyledElement::isKnownAttribute): + * svg/SVGTextContentElement.cpp: Completely remove the SVGTextContentElement API, that manually traversed all text chunks, instead use the new SVGTextQuery API. + (WebCore::SVGTextContentElement::getNumberOfChars): + (WebCore::SVGTextContentElement::getComputedTextLength): + (WebCore::SVGTextContentElement::getSubStringLength): + (WebCore::SVGTextContentElement::getStartPositionOfChar): + (WebCore::SVGTextContentElement::getEndPositionOfChar): + (WebCore::SVGTextContentElement::getExtentOfChar): + (WebCore::SVGTextContentElement::getRotationOfChar): + (WebCore::SVGTextContentElement::getCharNumAtPosition): + * svg/SVGTextElement.cpp: Very important change! Do not calls setNeedsLayout() on RenderSVGText, if childrenChanged() has been called. + * svg/SVGTextElement.h: Completly remove childrenChanged() - no longer necessary, updates work as expected without it now. + +2010-06-18 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by David Levin. + + Fix compilation when filters are disabled. Revision r60689 + changed the signature of SVGRenderBase::prepareToRenderSVGContent() + but didn't change the unsused parameters when filters are disabled. + https://bugs.webkit.org/show_bug.cgi?id=40625 + + No new tests. Compilation fix. + + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::prepareToRenderSVGContent): + +2010-06-18 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + noAccess url schemes block access to inline stylesheets + https://bugs.webkit.org/show_bug.cgi?id=32309 + + Instead of using baseURL() to grab the security context we should just + use finalURL directly. When I wrote the original patch that added this + security check, finalURL didn't exist yet. + + If finalURL is an empty URL, that means we generated the style sheet + from text that didn't have a URL. It would be slightly safer to store + a bit on CSSStyleSheet indicating whether it came from an inline style + sheet, but I think this check is fairly accurate. + + Test: http/tests/security/data-url-inline.css.html + + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::cssRules): + +2010-06-18 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Remove unneeded custom code for WebSocket.send + https://bugs.webkit.org/show_bug.cgi?id=38180 + + We don't appear to require a custom binding here. The old function was + wacky in two ways: + + 1) It required all of its arguments. + + 2) If the toString of its argument threw, it would catch the exception + and re-throw a different exception. + + I've kept the first behavior but changed the second (and documented it + with a test). + + Test: websocket/tests/send-throw.html + + * bindings/js/JSWebSocketCustom.cpp: + * bindings/v8/custom/V8WebSocketCustom.cpp: + * websockets/WebSocket.idl: + +2010-06-15 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Move isAvailable()/setIsAvailable() from Database/DatabaseSync to AbstractDatabase. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * WebCore.base.exp + * bindings/generic/RuntimeEnabledFeatures.cpp: + (WebCore::RuntimeEnabledFeatures::openDatabaseEnabled): + (WebCore::RuntimeEnabledFeatures::openDatabaseSyncEnabled): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::openDatabase): + * storage/AbstractDatabase.cpp: + (WebCore::AbstractDatabase::isAvailable): + (WebCore::AbstractDatabase::setIsAvailable): + * storage/AbstractDatabase.h: + * storage/Database.cpp: + * storage/Database.h: + * storage/DatabaseSync.cpp: + * storage/DatabaseSync.h: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::openDatabase): + (WebCore::WorkerContext::openDatabaseSync): + * workers/WorkerContext.h: + +2010-06-18 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Fix the namespace indent for HTML5Lexer. This patch changes + white-space only. + + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::): + (WebCore::HTML5Lexer::lineNumber): + (WebCore::HTML5Lexer::columnNumber): + (WebCore::HTML5Lexer::state): + (WebCore::HTML5Lexer::setState): + (WebCore::HTML5Lexer::skipLeadingNewLineForListing): + (WebCore::HTML5Lexer::InputStreamPreprocessor::InputStreamPreprocessor): + (WebCore::HTML5Lexer::InputStreamPreprocessor::nextInputCharacter): + (WebCore::HTML5Lexer::InputStreamPreprocessor::peek): + (WebCore::HTML5Lexer::InputStreamPreprocessor::advance): + +2010-06-18 Fumitoshi Ukai <ukai@chromium.org> + + Unreviewed test breakage fix. + + WebSocket: resume should not process buffer if already processing. + https://bugs.webkit.org/show_bug.cgi?id=39340 + + MessageLoop runs in main thread, so we don't need to use timer in worker thread. + Also, we should not use Timer in worker thread. + + * websockets/ThreadableWebSocketChannelClientWrapper.h: + (WebCore::ThreadableWebSocketChannelClientWrapper::resume): + (WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper): + +2010-06-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r61379. + http://trac.webkit.org/changeset/61379 + https://bugs.webkit.org/show_bug.cgi?id=40813 + + Broke multiple tests on all platforms (Requested by tkent on + #webkit). + + * bindings/scripts/CodeGenerator.pm: + * bindings/scripts/CodeGeneratorCPP.pm: + * bindings/scripts/CodeGeneratorGObject.pm: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorObjC.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::attrWithException): + (WebDOMTestObj::setAttrWithException): + (WebDOMTestObj::attrWithSetterException): + (WebDOMTestObj::attrWithGetterException): + (WebDOMTestObj::setAttrWithGetterException): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp: + (webkit_dom_test_callback_callback_with_class1param): + (webkit_dom_test_callback_callback_with_class2param): + (webkit_dom_test_callback_callback_with_non_bool_return_type): + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_void_method): + (webkit_dom_test_obj_void_method_with_args): + (webkit_dom_test_obj_int_method): + (webkit_dom_test_obj_int_method_with_args): + (webkit_dom_test_obj_obj_method): + (webkit_dom_test_obj_obj_method_with_args): + (webkit_dom_test_obj_method_that_requires_all_args): + (webkit_dom_test_obj_method_that_requires_all_args_and_throws): + (webkit_dom_test_obj_serialized_value): + (webkit_dom_test_obj_method_with_exception): + (webkit_dom_test_obj_with_dynamic_frame): + (webkit_dom_test_obj_with_dynamic_frame_and_arg): + (webkit_dom_test_obj_with_dynamic_frame_and_optional_arg): + (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture): + (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad): + (webkit_dom_test_obj_with_script_state_void): + (webkit_dom_test_obj_with_script_state_obj): + (webkit_dom_test_obj_with_script_state_void_exception): + (webkit_dom_test_obj_with_script_state_obj_exception): + (webkit_dom_test_obj_with_script_execution_context): + (webkit_dom_test_obj_method_with_optional_arg): + (webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg): + (webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args): + (webkit_dom_test_obj_get_read_only_int_attr): + (webkit_dom_test_obj_get_read_only_string_attr): + (webkit_dom_test_obj_get_read_only_test_obj_attr): + (webkit_dom_test_obj_get_int_attr): + (webkit_dom_test_obj_set_int_attr): + (webkit_dom_test_obj_get_long_long_attr): + (webkit_dom_test_obj_set_long_long_attr): + (webkit_dom_test_obj_get_unsigned_long_long_attr): + (webkit_dom_test_obj_set_unsigned_long_long_attr): + (webkit_dom_test_obj_get_string_attr): + (webkit_dom_test_obj_set_string_attr): + (webkit_dom_test_obj_get_test_obj_attr): + (webkit_dom_test_obj_set_test_obj_attr): + (webkit_dom_test_obj_get_attr_with_exception): + (webkit_dom_test_obj_set_attr_with_exception): + (webkit_dom_test_obj_get_attr_with_setter_exception): + (webkit_dom_test_obj_set_attr_with_setter_exception): + (webkit_dom_test_obj_get_attr_with_getter_exception): + (webkit_dom_test_obj_set_attr_with_getter_exception): + (webkit_dom_test_obj_get_script_string_attr): + (webkit_dom_test_obj_get_conditional_attr1): + (webkit_dom_test_obj_set_conditional_attr1): + (webkit_dom_test_obj_get_conditional_attr2): + (webkit_dom_test_obj_set_conditional_attr2): + (webkit_dom_test_obj_get_conditional_attr3): + (webkit_dom_test_obj_set_conditional_attr3): + (webkit_dom_test_obj_get_description): + (webkit_dom_test_obj_get_id): + (webkit_dom_test_obj_set_id): + (webkit_dom_test_obj_get_hash): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjAttrWithException): + (WebCore::jsTestObjAttrWithSetterException): + (WebCore::jsTestObjAttrWithGetterException): + (WebCore::setJSTestObjAttrWithException): + (WebCore::setJSTestObjAttrWithGetterException): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj attrWithException]): + (-[DOMTestObj setAttrWithException:]): + (-[DOMTestObj attrWithSetterException]): + (-[DOMTestObj attrWithGetterException]): + (-[DOMTestObj setAttrWithGetterException:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::attrWithExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithExceptionAttrSetter): + (WebCore::TestObjInternal::attrWithSetterExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithGetterExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithGetterExceptionAttrSetter): + (WebCore::TestObjInternal::overloadedMethodCallback): + (WebCore::): + * dom/Element.cpp: + * dom/Element.h: + * html/HTMLAnchorElement.idl: + * html/HTMLAppletElement.idl: + * html/HTMLAreaElement.idl: + * html/HTMLBRElement.idl: + * html/HTMLBaseElement.idl: + * html/HTMLBaseFontElement.idl: + * html/HTMLBlockquoteElement.idl: + * html/HTMLBodyElement.idl: + * html/HTMLButtonElement.idl: + * html/HTMLDListElement.idl: + * html/HTMLDirectoryElement.idl: + * html/HTMLDivElement.idl: + * html/HTMLElement.idl: + * html/HTMLEmbedElement.idl: + * html/HTMLFontElement.idl: + * html/HTMLFormElement.idl: + * html/HTMLFrameElement.idl: + * html/HTMLFrameSetElement.idl: + * html/HTMLHRElement.idl: + * html/HTMLHeadElement.idl: + * html/HTMLHeadingElement.idl: + * html/HTMLHtmlElement.idl: + * html/HTMLIFrameElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLIsIndexElement.idl: + * html/HTMLLIElement.idl: + * html/HTMLLabelElement.idl: + * html/HTMLLegendElement.idl: + * html/HTMLLinkElement.idl: + * html/HTMLMapElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLMenuElement.idl: + * html/HTMLMetaElement.idl: + * html/HTMLModElement.idl: + * html/HTMLOListElement.idl: + * html/HTMLObjectElement.idl: + * html/HTMLOptGroupElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLParagraphElement.idl: + * html/HTMLParamElement.idl: + * html/HTMLPreElement.idl: + * html/HTMLQuoteElement.idl: + * html/HTMLScriptElement.idl: + * html/HTMLStyleElement.idl: + * html/HTMLTableCaptionElement.idl: + * html/HTMLTableCellElement.idl: + * html/HTMLTableColElement.idl: + * html/HTMLTableElement.idl: + * html/HTMLTableRowElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLTextAreaElement.idl: + * html/HTMLUListElement.idl: + * html/HTMLVideoElement.idl: + * svg/SVGElement.idl: + +2010-06-17 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Dave Hyatt. + + CSS3 "Property is declared twice in rule" test fails + https://bugs.webkit.org/show_bug.cgi?id=36282 + + Filter out duplicate properties in style declaration. + + Test: fast/css/duplicate-property-in-rule.html + + * css/CSSMutableStyleDeclaration.cpp: Filter out duplicate properties + (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): Discard negative padding values + * css/CSSStyleSelector.cpp: Remove negative padding check + (WebCore::CSSStyleSelector::applyProperty): + +2010-06-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Implement additional DOM attribute reflection for bindings + https://bugs.webkit.org/show_bug.cgi?id=39936 + + - Added support for [Reflect] for long, unsigned long, and boolean + attributes. + - Fixed code that set attributes like this: <video controls="controls"> + to instead set them like this: <video controls>. + - Added lots more uses of [Reflect]. + - Removed now-unneeded [ConvertFromString]. + - Made [Reflect] imply [ConvertNullToNullString] so we can get rid + of most uses of the latter. + - Made [Reflect] automatically lowercase the name of the reflected + content attribute to minimize the need to specify a custom content + attribute name. + + One thing this patch does *not* do is remove the unneeded functions + in the various DOM classes that are no longer used by the bindings. + We should do that in a followup. + + * bindings/scripts/CodeGenerator.pm: Added new functions so code + can be shared across bindings, GetterExpressionPrefix and + SetterExpressionPrefix. We can do a lot more refactoring like + this in the future. + + * bindings/scripts/CodeGeneratorCPP.pm: Removed unneeded + ConvertFromString handling, changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + to better handle reflected DOM attributes. + + * bindings/scripts/CodeGeneratorGObject.pm: Removed unneeded + ConvertFromString handling, changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + to better handle reflected DOM attributes. Fixed a few things + in the output so the .cpp file will have more WebKit style. + The .h file should be GTK style, but the .cpp file can be the + standard WebKit style eventually. + + * bindings/scripts/CodeGeneratorJS.pm: Changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + and removed a now-unneeded IsSVGAnimatedType special case since + the new functions take care of it. Made reflected attributes + automatically convert null to the null string without a + separate ConvertNullToNullString attribute. + + * bindings/scripts/CodeGeneratorObjC.pm: Changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + and removed a now-unneeded IsSVGAnimatedType special case since + the new functions take care of it. Redid the special cases for + ownerDocument and for operator to fit better with the new code + paths. Removed unneeded ConvertFromString handling. + + * bindings/scripts/CodeGeneratorV8.pm: Changed to use the new + GetterExpressionPrefix and SetterExpressionPrefix functions + and removed a now-unneeded IsSVGAnimatedType special case since + the new functions take care of it. Made reflected attributes + automatically convert null to the null string without a + separate ConvertNullToNullString attribute. + + * bindings/scripts/test/TestObj.idl: Added some test cases for + content attribute reflection and for exceptions in string-typed + attributes. + + * bindings/scripts/test/CPP/WebKitDOMTestObj.cpp: Updated. + * bindings/scripts/test/CPP/WebKitDOMTestObj.h: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Ditto. + * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. + * bindings/scripts/test/JS/JSTestObj.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestObj.mm: Ditto. + * bindings/scripts/test/V8/V8TestObj.cpp: Ditto. + + * dom/Element.cpp: + (WebCore::Element::getIntegralAttribute): Added. + (WebCore::Element::setIntegralAttribute): Added. + (WebCore::Element::getUnsignedIntegralAttribute): Added. + (WebCore::Element::setUnsignedIntegralAttribute): Added. + * dom/Element.h: Added new attribute get/set functions for bindings. + + * html/HTMLAnchorElement.idl: + * html/HTMLAppletElement.idl: + * html/HTMLAreaElement.idl: + * html/HTMLBRElement.idl: + * html/HTMLBaseElement.idl: + * html/HTMLBaseFontElement.idl: + * html/HTMLBlockquoteElement.idl: + * html/HTMLBodyElement.idl: + * html/HTMLButtonElement.idl: + * html/HTMLDListElement.idl: + * html/HTMLDirectoryElement.idl: + * html/HTMLDivElement.idl: + * html/HTMLElement.idl: + * html/HTMLEmbedElement.idl: + * html/HTMLFontElement.idl: + * html/HTMLFormElement.idl: + * html/HTMLFrameElement.idl: + * html/HTMLFrameSetElement.idl: + * html/HTMLHRElement.idl: + * html/HTMLHeadElement.idl: + * html/HTMLHeadingElement.idl: + * html/HTMLHtmlElement.idl: + * html/HTMLIFrameElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLIsIndexElement.idl: + * html/HTMLLIElement.idl: + * html/HTMLLabelElement.idl: + * html/HTMLLegendElement.idl: + * html/HTMLLinkElement.idl: + * html/HTMLMapElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLMenuElement.idl: + * html/HTMLMetaElement.idl: + * html/HTMLModElement.idl: + * html/HTMLOListElement.idl: + * html/HTMLObjectElement.idl: + * html/HTMLOptGroupElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLParagraphElement.idl: + * html/HTMLParamElement.idl: + * html/HTMLPreElement.idl: + * html/HTMLQuoteElement.idl: + * html/HTMLScriptElement.idl: + * html/HTMLStyleElement.idl: + * html/HTMLTableCaptionElement.idl: + * html/HTMLTableCellElement.idl: + * html/HTMLTableColElement.idl: + * html/HTMLTableElement.idl: + * html/HTMLTableRowElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLTextAreaElement.idl: + * html/HTMLUListElement.idl: + * html/HTMLVideoElement.idl: + * svg/SVGElement.idl: + Added more uses of [Reflect]. Got rid of uses of [ConvertNullToNullString] that + are now unneeded since [Reflect] now implies that. Changed formatting to be + simpler and consistent without all the lining up and multiple lines. + +2010-06-17 MORITA Hajime <morrita@google.com> + + Unreviewd, fixed a build break. + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::pseudoId): + +2010-06-16 MORITA Hajime <morrita@google.com> + + Reviewed by Kent Tamura. + + <meter> should allow styling for each gauge-level and component + https://bugs.webkit.org/show_bug.cgi?id=40280 + + - Introduced following new pseudo classes for <meter> element. + + - -webkit-meter-horizontal-bar + - -webkit-meter-vertical-bar + - -webkit-meter-horizontal-optimum-value + - -webkit-meter-vertical-optimum-value + - -webkit-meter-horizontal-suboptimal-value + - -webkit-meter-vertical-suboptimal-value + - -webkit-meter-horizontal-even-less-good-value + - -webkit-meter-vertical-even-less-good-value + + - Introduced 2 shadow nodes for RenderMeter to handle CSS styling. + one for bar part and another for value part. + - Removed RenderTheme::paintMeter() implementation because it can be + handled by styled painting without RenderTheme. + - Pulled RenderIndicator up to super class from RenderProgress, + then make RenderMeter a subclass of it. + - Moved shadow related methods from RenderProgress to ShadowBlockElement + to share it with RenderMeter. + - Added rules for html.css for new pseudo classes. + + Tests: fast/dom/HTMLMeterElement/meter-styles-changing-pseudo.html + fast/dom/HTMLMeterElement/meter-styles.html + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/CSSSelector.cpp: + (WebCore::CSSSelector::pseudoId): + (WebCore::nameToPseudoTypeMap): + (WebCore::CSSSelector::extractPseudoType): + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/html.css: + (meter::-webkit-meter-horizontal-bar): + (meter::-webkit-meter-vertical-bar): + (meter::-webkit-meter-horizontal-optimum-value): + (meter::-webkit-meter-horizontal-suboptimal-value): + (meter::-webkit-meter-horizontal-even-less-good-value): + (meter::-webkit-meter-vertical-optimum-value): + (meter::-webkit-meter-vertical-suboptimal-value): + (meter::-webkit-meter-vertical-even-less-good-value): + * rendering/RenderIndicator.cpp: Added. + (WebCore::RenderIndicator::RenderIndicator): + (WebCore::RenderIndicator::~RenderIndicator): + (WebCore::RenderIndicator::layout): + (WebCore::RenderIndicator::styleDidChange): + (WebCore::RenderIndicator::updateFromElement): + (WebCore::RenderIndicator::hasParts): + (WebCore::RenderIndicator::requestLayoutForParts): + * rendering/RenderIndicator.h: Added. + (WebCore::RenderIndicator::requiresForcedStyleRecalcPropagation): + * rendering/RenderMeter.cpp: + (WebCore::RenderMeter::RenderMeter): + (WebCore::RenderMeter::~RenderMeter): + (WebCore::RenderMeter::layoutParts): Added. + (WebCore::RenderMeter::shouldHaveParts): Added. + (WebCore::RenderMeter::valueRatio): Added. + (WebCore::RenderMeter::barPartRect): Added. + (WebCore::RenderMeter::valuePartRect): Added. + (WebCore::RenderMeter::isHorizontal): Added. + (WebCore::RenderMeter::valuePseudoId): Added. + (WebCore::RenderMeter::barPseudoId): Added. + (WebCore::RenderMeter::updatePartsState): Added. + * rendering/RenderMeter.h: + * rendering/RenderProgress.cpp: + (WebCore::RenderProgress::RenderProgress): + (WebCore::RenderProgress::updateFromElement): + (WebCore::RenderProgress::paint): + (WebCore::RenderProgress::layoutParts): Added. + (WebCore::RenderProgress::shouldHaveParts): Added. + (WebCore::RenderProgress::updatePartsState): + (WebCore::RenderProgress::valuePartRect): + * rendering/RenderProgress.h: + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::isControlStyled): + (WebCore::RenderTheme::paintMeter): + * rendering/RenderTheme.h: + (WebCore::RenderTheme::supportsMeter): Added. + * rendering/RenderThemeMac.h: + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::supportsMeter): Added. + * rendering/ShadowElement.cpp: + (WebCore::ShadowBlockElement::layoutAsPart): Added. + (WebCore::ShadowBlockElement::updateStyleForPart): Added. + (WebCore::ShadowBlockElement::createForPart): Added. + (WebCore::ShadowBlockElement::createStyleForPart): Added. + (WebCore::ShadowBlockElement::partShouldHaveStyle): Added. + * rendering/ShadowElement.h: + * rendering/style/RenderStyleConstants.h: + (WebCore::): + +2010-06-17 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + WebSocket: resume should not process buffer if already processing. + https://bugs.webkit.org/show_bug.cgi?id=39340 + + Test: websocket/tests/alert-in-event-handler.html + + While running an event handler of WebSocket object, it may be suspended + and resumed in various reason. e.g. alert() will suspend/resume + ActiveDOM objects. In chromium, sending IPC message would also + suspend/resume ActiveDOM objects. + If resume process pending buffer in this case, another event might + be fired while running the initial event handler. + Thus, resume should not process pending buffer immediately. + Pending buffer would be processed after the current task has been + finished. + + * websockets/ThreadableWebSocketChannelClientWrapper.h: + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::WebSocketChannel): + (WebCore::WebSocketChannel::resume): + Just set one shot timer for resumeTimerFired() if not yet set. + (WebCore::WebSocketChannel::resumeTimerFired): + Process pending event after resume was called. + * websockets/WebSocketChannel.h: + +2010-06-17 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + REGRESSION(HTML5 parser): editing/selection/leave-requested-block.html can fail or crash + https://bugs.webkit.org/show_bug.cgi?id=40764 + + HTML5ScriptRunner was careful to only call CachedResource::addClient + for cases where the resource was not already loaded. This was to + avoid getting synchronous notifyFinished callbacks from inside + addClient. (The old HTMLDocumentParser also has hacks to work around + addClient's synchronous notifyFinished behavior for already-loaded + resources as well.) + + It turns out that CachedResource will mark itself as purgeable if it + has no clients, thus it could have its data cleared (but itself not + deleted) in the case where we yield back to the runloop to wait for + CSS to load before executing the loaded script. + + The fix is to act more like the old parser and always call addClient + on every CachedScript we load. But unlike the old parser, we're + careful not to re-enter from addClient -> notifyFinished + using guards in HTML5DocumentParser::watchForLoad. + + I do not know how to make a CachedResource purge itself + from a LayoutTest, so this is not currently testable. + If anyone knows how I'm happy to make a test. + + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::watchForLoad): + - It is now expected to call watchForLoad with a loaded script. + (WebCore::HTML5DocumentParser::notifyFinished): + - Now that watchForLoad is called with loaded scripts, notifyFinished + may be be called from addClient, thus we may be in the middle of + script execution when it's called. It's OK. We pass the call + along to HTML5ScriptRunner::executeScriptsWaitingForLoad + and it knows how to ignore the call in that case. + * html/HTML5DocumentParser.h: + - Document these member variables more. + * html/HTML5ScriptRunner.cpp: + (WebCore::HTML5ScriptRunner::~HTML5ScriptRunner): + (WebCore::HTML5ScriptRunner::executePendingScript): + (WebCore::HTML5ScriptRunner::hasScriptsWaitingForLoad): + (WebCore::HTML5ScriptRunner::watchForLoad): + - Set the pending script to RegisteringForWatch state before + watching and WatchingForLoad after. + (WebCore::HTML5ScriptRunner::stopWatchingForLoad): + - Set the pending script to NotWatchingForLoad. + (WebCore::HTML5ScriptRunner::executeScriptsWaitingForLoad): + - Assert that callers checked hasScriptsWaitingForLoad() + (WebCore::HTML5ScriptRunner::requestScript): + * html/HTML5ScriptRunner.h: + (WebCore::HTML5ScriptRunner::PendingScript::): + (WebCore::HTML5ScriptRunner::PendingScript::PendingScript): + (WebCore::HTML5ScriptRunner::PendingScript::watchingForLoad): + * html/HTML5ScriptRunnerHost.h: + - Document the new expectations of watchForLoad + +2010-06-17 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Eric Seidel. + + Prevent HTML5PreloadScanner from loading resources in <noscript> tags. + https://bugs.webkit.org/show_bug.cgi?id=40779 + + No new tests. Will create a layout test in a subsequent patch. + + * html/HTML5PreloadScanner.cpp: + (WebCore::HTML5PreloadScanner::processToken): + * html/HTML5TreeBuilder.cpp: + (WebCore::HTML5TreeBuilder::adjustedLexerState): + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + (WebCore::HTML5TreeBuilder::isScriptingFlagEnabled): + * html/HTML5TreeBuilder.h: + +2010-06-17 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + HTML5PreloadScanner parses <script> in DataState + https://bugs.webkit.org/show_bug.cgi?id=40804 + + The ScriptDataState is handled separately from the rest of the lexer + state changes because it's more complicted in the tree builder. The + easiest thing is to just handle it separately in the preloader too. + + * html/HTML5PreloadScanner.cpp: + (WebCore::HTML5PreloadScanner::processToken): + +2010-06-17 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add CSS scanning to HTML5PreloadScanner + https://bugs.webkit.org/show_bug.cgi?id=40802 + + This patch just cribs the CSS preload scanning algorithm from the old + preload scanner. We also invented a way of testing the preload + scanner. + + Tests: fast/preloader/image.html + fast/preloader/link.html + fast/preloader/script.html + fast/preloader/style.html + + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/CSSPreloadScanner.cpp: Added. + (WebCore::isWhitespace): + (WebCore::CSSPreloadScanner::CSSPreloadScanner): + (WebCore::CSSPreloadScanner::reset): + (WebCore::CSSPreloadScanner::scan): + (WebCore::CSSPreloadScanner::tokenize): + (WebCore::CSSPreloadScanner::emitRule): + * html/CSSPreloadScanner.h: Added. + (WebCore::CSSPreloadScanner::): + * html/HTML5PreloadScanner.cpp: + (WebCore::HTML5PreloadScanner::HTML5PreloadScanner): + (WebCore::HTML5PreloadScanner::processToken): + (WebCore::HTML5PreloadScanner::scanningBody): + * html/HTML5PreloadScanner.h: + +2010-06-17 Abhishek Arya <inferno@chromium.org> + + Reviewed by David Kilzer. + + (Landed by Dirk Pranke). + + Check for a null frame before setting drag selection. + https://bugs.webkit.org/show_bug.cgi?id=38893 + Same Layout test as https://bugs.webkit.org/show_bug.cgi?id=37168. + + Test: editing/pasteboard/drag-drop-iframe-refresh-crash.html + + Note that you need to run the test manually 20-30 times for the crash + to reproduce. + + * editing/SelectionController.cpp: + (WebCore::SelectionController::setSelection): + +2010-06-17 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Get rid of the the unused imageSize of ImageDecoderQt::internalHandleCurrentImage() + https://bugs.webkit.org/show_bug.cgi?id=40620 + + Remove an unused variable. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::internalHandleCurrentImage): + +2010-06-17 Jeremy Moskovich <jeremy@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium API] Implement WebSandboxSupport on OS X and add stubs to allow + OOP loading of fonts. + + https://bugs.webkit.org/show_bug.cgi?id=40544 + + * platform/chromium/ChromiumBridge.h: Add prototype for loadFont() + +2010-06-17 Nicolas Weber <thakis@chromium.org> + + Reviewed by Eric Seidel. + + Fix various warnings that are reported when building with clang + https://bugs.webkit.org/show_bug.cgi?id=40503 + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::labelElementContainer): + * accessibility/AccessibilityTableCell.cpp: + (WebCore::AccessibilityTableCell::parentTable): + * bindings/v8/NPV8Object.cpp: + (WebCore::npObjectTypeInfo): + * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp: + (WebCore::): + * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: + (WebCore::): + * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp: + (WebCore::): + * css/CSSStyleSheet.h: + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::getNamedElements): + * inspector/InspectorValues.cpp: + (WebCore::InspectorObject::getObject): + (WebCore::InspectorObject::getArray): + * page/animation/AnimationBase.h: + * platform/graphics/BitmapImage.h: + (WTF::): + * platform/graphics/mac/FontPlatformData.h: + * rendering/RenderBlock.h: + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::ellipsisBox): + * storage/StorageNamespaceImpl.cpp: + (WebCore::StorageNamespaceImpl::storageArea): + +2010-06-17 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Pavel Feldman. + + Add ENABLE(INSPECTOR) guard for m_sessionSettings + https://bugs.webkit.org/show_bug.cgi?id=40611 + + Build fix. + + * inspector/InspectorController.h: + +2010-06-17 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Add FIXME to explain HTMLDocumentParser's forceSynchronous bool + https://bugs.webkit.org/show_bug.cgi?id=40609 + + No functional change, just adding comment. + + * dom/Document.cpp: + (WebCore::Document::write): + +2010-06-13 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + WebCore EventHandler needs to take account of onLoad events + fired before layout() complete + + https://bugs.webkit.org/show_bug.cgi?id=40102 + + WebCore 'cheats' by firing onLoad events before the frame's layout + has been performed. This can result in event listeners performing + operations that depend on the document's final layout, such as + scrolling operations. + + When scrolling a frameview in eventhandler ensure the layout is complete. + + * page/EventHandler.cpp: + (WebCore::EventHandler::scrollRecursively): + +2010-06-16 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add the error codes defined in the async DB spec to SQLError.idl and SQLError.h. + https://bugs.webkit.org/show_bug.cgi?id=40748 + + Test: storage/sql-error-codes.html + + * storage/SQLError.h: + (WebCore::SQLError::): + * storage/SQLError.idl: + * storage/SQLStatement.cpp: + (WebCore::SQLStatement::execute): + (WebCore::SQLStatement::setDatabaseDeletedError): + (WebCore::SQLStatement::setVersionMismatchedError): + (WebCore::SQLStatement::setFailureDueToQuota): + (WebCore::SQLStatement::lastExecutionFailedDueToQuota): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::openTransactionAndPreflight): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::handleCurrentStatementError): + (WebCore::SQLTransaction::deliverStatementCallback): + (WebCore::SQLTransaction::postflightAndCommit): + +2010-06-17 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + Fix CRLF ending conversion in StringBlobItem. + https://bugs.webkit.org/show_bug.cgi?id=40736 + Also: fix referencing uninitialized member bug and slice length bug + in hybrid blob case. + + Tests will be added when we add BlobBuilder jsc bindings. + + * platform/BlobItem.cpp: + (WebCore::StringBlobItem::convertToCString): + (WebCore::DataRangeBlobItem::DataRangeBlobItem): + +2010-06-17 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, rolling out r61340. + http://trac.webkit.org/changeset/61340 + https://bugs.webkit.org/show_bug.cgi?id=36282 + + Broke several editing tests. + + * css/CSSMutableStyleDeclaration.cpp: + (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + +2010-06-17 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Add optional contentType parameter to Blob.slice per latest File API spec. + https://bugs.webkit.org/show_bug.cgi?id=40647 + + Tested by http/tests/local/resources/send-sliced-dragged-file.html. + + * html/Blob.cpp: + (WebCore::Blob::slice): + * html/Blob.h: + * html/Blob.idl: + +2010-06-17 Jesus Sanchez-Palencia <jesus@webkit.org>, Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] QtWebKit does not support viewport meta tag + https://bugs.webkit.org/show_bug.cgi?id=39902 + + Add windowRect() to page client. + + * platform/qt/QWebPageClient.h: + +2010-06-17 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Fix for slow multiple animated resize issue. + https://bugs.webkit.org/show_bug.cgi?id=38233 + + The timer-based resize quality approach implemented in + http://trac.webkit.org/changeset/34210 is a good idea, but doesn't + scale to multiple images with animated resizes. This fix unifies all + outstanding resize timers into a single timer, and removes the "use + last quality" check (which doesn't work when images are overlapping). + It also refactors the copy of this code implemented in + RenderBoxModelObject in http://trac.webkit.org/changeset/53949. + + This improves Safari performance for the following IE9 platform demos on my C2D MacPro (10.5): + http://ie.microsoft.com/testdrive/Performance/01FlyingImages/Default.html (4->60fps) + http://ie.microsoft.com/testdrive/Performance/10FlickrExplorer/Default.html (3->16fps) + http://ie.microsoft.com/testdrive/Performance/11BrowserFlip/Default.html (9->60fps) + + * rendering/RenderBoxModelObject.cpp: + (WebCore::ImageQualityController::ImageQualityController): + Unify all timers into a single timer, rename RenderBoxModelScaleObserver + to ImageQualityController, and remove the resize quality "stickness", + since it doesn't work with multiple outstanding resizes. + (WebCore::ImageQualityController::objectDestroyed): + gImages global is now m_lastPaintTimeMap member. + (WebCore::ImageQualityController::highQualityRepaintTimerFired): + Function made non-static; repaint all pending resizes (not just one). + (WebCore::ImageQualityController::restartTimer): + Added function to restart timer at 1.05x threshold. + (WebCore::imageQualityController): + Static function to return singleton. + (WebCore::ImageQualityController::shouldPaintAtLowQuality): + Use m_lastPaintTimeMap, not gImages global. Implement new timer + algorithm. Remove resize "stickiness". + (WebCore::RenderBoxModelObject::shouldPaintAtLowQuality): + Implement shouldPaintAtLowQuality, which pulls out "this" and passes + the call to the ImageQualityController. + (WebCore::RenderBoxModelObject::~RenderBoxModelObject): + Call ImageQualityController singleton's objectDestroyed() instead of + old static function. + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + Modify shouldPaintAtLowQuality() call to match new class name and + function signature. + * rendering/RenderBoxModelObject.h: + Expose shouldPaintAtLowQuality as a member function. + * rendering/RenderImage.cpp: + (WebCore::RenderImage::~RenderImage): + No need to call objectDestroyed() here anymore, since the + RenderBoxModelObject destructor will do this for us. + (WebCore::RenderImage::paintIntoRect): + Rip out RenderImageScaleObserver, and call + RenderBoxModelObject::shouldPaintAtLowQuality() instead. + +2010-06-17 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Dave Hyatt. + + CSS3 "Property is declared twice in rule" test fails + https://bugs.webkit.org/show_bug.cgi?id=36282 + + Filter out duplicate properties in style declaration. + + Test: fast/css/duplicate-property-in-rule.html + + * css/CSSMutableStyleDeclaration.cpp: Filter out duplicate properties + (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): Discard negative padding values + * css/CSSStyleSelector.cpp: Remove negative padding check + (WebCore::CSSStyleSelector::applyProperty): + +2010-06-17 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Clean up error conditions for Typed Arrays + https://bugs.webkit.org/show_bug.cgi?id=40755 + + * bindings/js/JSArrayBufferCustom.cpp: + (WebCore::JSArrayBufferConstructor::constructJSArrayBuffer): + - Fixed handling of NaN/+inf/-inf lengths. Throw RangeError for too-large or negative lengths. + * bindings/js/JSArrayBufferViewHelper.h: + (WebCore::constructArrayBufferView): + - Changed all error code paths to throw exceptions. Clarified exception types. + * bindings/js/JSFloat32ArrayCustom.cpp: + (WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/js/JSInt16ArrayCustom.cpp: + (WebCore::JSInt16ArrayConstructor::constructJSInt16Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/js/JSInt32ArrayCustom.cpp: + (WebCore::JSInt32ArrayConstructor::constructJSInt32Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/js/JSInt8ArrayCustom.cpp: + (WebCore::JSInt8ArrayConstructor::constructJSInt8Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/js/JSUint16ArrayCustom.cpp: + (WebCore::JSUint16ArrayConstructor::constructJSUint16Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/js/JSUint32ArrayCustom.cpp: + (WebCore::JSUint32ArrayConstructor::constructJSUint32Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/js/JSUint8ArrayCustom.cpp: + (WebCore::JSUint8ArrayConstructor::constructJSUint8Array): + - Removed throwing of INDEX_SIZE_ERROR, delegating responsibility to constructArrayBufferView. + * bindings/v8/custom/V8ArrayBufferCustom.cpp: + (WebCore::V8ArrayBuffer::constructorCallback): + - Fixed handling of NaN/+inf/-inf lengths. Throw RangeError for too-large or negative lengths. + Clarified exception types. + * bindings/v8/custom/V8ArrayBufferViewCustom.h: + (WebCore::constructWebGLArray): + - Clarified exception types and throwing of exceptions along all error code paths. + * html/canvas/TypedArrayBase.h: + (WebCore::TypedArrayBase::create): + - Added necessary null checks during allocation. + +2010-06-17 Shu Chang <chang.shu@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix the link error on symbian with ENABLE_JIT=0. + 1. Add "#if ENABLE(JIT)" in the header file; + 2. Put feature enable/disable logic to a common.pri so + that both JavaScriptCore.pri and WebCore.pri can share. + + https://bugs.webkit.org/show_bug.cgi?id=40780 + + * WebCore.pri: + +2010-06-17 Kenneth Russell <kbr@google.com> + + Reviewed by Oliver Hunt. + + Differences in error reporting for overloaded methods causing fast/canvas/webgl/texImageTest.html to fail + https://bugs.webkit.org/show_bug.cgi?id=40750 + + Added V8Proxy::throwTypeError() and throwSyntaxError for parity + with JSC::throwTypeError() and throwSyntaxError. Changed + CodeGeneratorV8.pm to use throwTypeError for overload resolution + failures. Revised CodeGeneratorJS.pm to use throwVMTypeError + instead of manual call to JSValue::encode. Deleted now-unnecessary + Chromium expectations for fast/canvas/webgl/texImageTest.html. + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::throwTypeError): + (WebCore::V8Proxy::throwSyntaxError): + * bindings/v8/V8Proxy.h: + +2010-06-17 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + If Page::goToItem is passed a HistoryItem that is the current item, + then the page should be loaded again. + + https://bugs.webkit.org/show_bug.cgi?id=40660 + + * loader/HistoryController.cpp: + (WebCore::HistoryController::recursiveGoToItem): Add a check to + recursiveGoToItem that matches the one in FrameLoader::loadItem. + +2010-06-17 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Kent Tamura. + + [BREWMP] Build fix for DragDataBrew + https://bugs.webkit.org/show_bug.cgi?id=40610 + + http://trac.webkit.org/changeset/60957 was not applied to DragDataBrew.cpp. + Add FilenameConversionPolicy argument to DragData::containsURL and DragData::asURL. + + * platform/brew/DragDataBrew.cpp: + (WebCore::DragData::containsURL): + (WebCore::DragData::asURL): + +2010-06-17 Zhenyao Mo <zmo@google.com> + + Reviewed by David Levin. + + Rename internalformat to internalFormat + https://bugs.webkit.org/show_bug.cgi?id=40149 + + * html/canvas/WebGLFramebuffer.cpp: Rename internalformat to internalFormat. + (WebCore::WebGLFramebuffer::getColorBufferFormat): + * html/canvas/WebGLRenderbuffer.cpp: Ditto. + (WebCore::WebGLRenderbuffer::WebGLRenderbuffer): + * html/canvas/WebGLRenderbuffer.h: Ditto. + (WebCore::WebGLRenderbuffer::setInternalFormat): + (WebCore::WebGLRenderbuffer::getInternalFormat): + * html/canvas/WebGLRenderingContext.cpp: Ditto. + (WebCore::WebGLRenderingContext::copyTexImage2D): + (WebCore::WebGLRenderingContext::copyTexSubImage2D): + (WebCore::WebGLRenderingContext::framebufferRenderbuffer): + (WebCore::WebGLRenderingContext::getRenderbufferParameter): + (WebCore::WebGLRenderingContext::renderbufferStorage): + (WebCore::WebGLRenderingContext::texImage2DBase): + (WebCore::WebGLRenderingContext::isTexInternalFormatColorBufferCombinationValid): + * html/canvas/WebGLRenderingContext.h: Ditto. + * html/canvas/WebGLTexture.cpp: Ditto. + (WebCore::WebGLTexture::WebGLTexture): + * html/canvas/WebGLTexture.h: Ditto. + (WebCore::WebGLTexture::setInternalFormat): + (WebCore::WebGLTexture::getInternalFormat): + +2010-06-17 Zhenyao Mo <zmo@google.com> + + Reviewed by David Levin. + + Remove input parameter validation for "level" upper limit in *tex* functions + https://bugs.webkit.org/show_bug.cgi?id=40603 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::validateTexFuncParameters): Don't check for "level" upper limit. + +2010-06-17 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Eric Seidel. + + Clean EFL header files in order to diminish the compilation time with + EFL from subversion. We remove the EFL includes from header files and use + forward declarations, including the headers in correspondent source + files when needed. This causes only the needed source files to be + recompiled in case a new version of EFL is installed instead of + triggering a recompilation of almost all WebCore/WebKit. + https://bugs.webkit.org/show_bug.cgi?id=40575 + + No new functionalities, so no new tests. + + * CMakeListsEfl.txt: + * platform/PlatformKeyboardEvent.h: forward declaration. + * platform/PlatformMouseEvent.h: forward declaration and change method + signature to not require enum. + * platform/PlatformWheelEvent.h: forward declaration. + * platform/Widget.h: forward declaration. + * platform/efl/PlatformKeyboardEventEfl.cpp: include needed header. + * platform/efl/PlatformMouseEventEfl.cpp: + (WebCore::PlatformMouseEvent::setClickCount): change method signature + as mentioned above. + * platform/efl/PlatformWheelEventEfl.cpp: include needed header. + * platform/efl/RenderThemeEfl.cpp: include needed header + * platform/efl/RenderThemeEfl.h: forward declaration. + * platform/efl/ScrollbarEfl.cpp: include needed header. + * platform/efl/ScrollbarEfl.h: forward declaration. + * platform/efl/WidgetEfl.cpp: include needed header. + * platform/graphics/FloatRect.h: remove unused method. + * platform/graphics/Icon.h: forward declaration. + * platform/graphics/IntRect.h: remove unused method. + * platform/graphics/efl/FloatRectEfl.cpp: Removed. This file was + implementing an unused method. + * platform/graphics/efl/IntRectEfl.cpp: Removed. This file was + implementing an unused method. + +2010-06-17 Alex Milowski <alex@milowski.com> + + Reviewed by Darin Adler. + + Fixed a compile error in the paint() methods by making them use the + new visitedDependentColor() method. + https://bugs.webkit.org/show_bug.cgi?id=40327 + + * mathml/RenderMathMLRoot.cpp: + (WebCore::RenderMathMLRoot::paint): + (WebCore::RenderMathMLRoot::layout): Fixed a crash where every child + was assumed to be a RenderMathMLBlock instance when that isn't the + case. Also, layout() needed to mark the index for layout before + calling layout() on the index. + * mathml/RenderMathMLSquareRoot.cpp: + (WebCore::RenderMathMLSquareRoot::paint): + +2010-06-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Use adoptRef and create functions in more code paths + https://bugs.webkit.org/show_bug.cgi?id=40760 + + This helps prepare for an assertion that fires if you ref or destroy an + object before calling adoptRef on it. That will help us catch mistakes + that can lead to storage leaks. + + * WebCore.base.exp: Updated export now that Frame::create is not an + inline function. + + * css/CSSInitialValue.h: + (WebCore::CSSInitialValue::createExplicit): Use create. + (WebCore::CSSInitialValue::createImplicit): Ditto. + (WebCore::CSSInitialValue::create): Added. + + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::createUncachedIdentifier): Added. + (WebCore::CSSPrimitiveValue::createUncachedColor): Added. + (WebCore::CSSPrimitiveValue::createUncached): Added. + (WebCore::CSSPrimitiveValue::createIdentifier): Use createUncachedIdentifier + instead of using new directly. + (WebCore::CSSPrimitiveValue::createColor): Use createUncachedColor instead + of using new directly. + (WebCore::CSSPrimitiveValue::create): Use createdUncached instead of using + new directly. + * css/CSSPrimitiveValue.h: Declare the new functions above. + + * css/CSSStyleSelector.cpp: + (WebCore::loadFullDefaultStyle): Deref simpleDefaultStyleSheet instead of + explicitly deleting it. + + * loader/SubresourceLoader.cpp: + (WebCore::SubresourceLoader::SubresourceLoader): Move the call to + addSubresourceLoader out of here. + (WebCore::SubresourceLoader::create): Move it in here. This makes it so + we don't ref the loader before finishing its creation and calling adoptRef. + + * page/Frame.cpp: + (WebCore::Frame::Frame): Move the call to setMainFrame out of here. + Also refactor the code so an assertion is easier to read. + (WebCore::Frame::create): Move the call to setMainFrame in here. + This makes it so we don't ref the frame before finishing its creation + and calling adoptRef. + * page/Frame.h: Made the create function non-inline. + + * platform/text/BidiContext.cpp: + (WebCore::BidiContext::createUncached): Added. + (WebCore::BidiContext::create): Call createUncached instead of callling + new directly. + * platform/text/BidiContext.h: Declare createUncached. + + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::buildPrimitives): Use PassRefPtr and + RefPtr instead of OwnPtr. And use the create function instead of new. + * rendering/RenderSVGResourceFilter.h: Ditto. + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeSVGResourceContainer): Ditto. + + * storage/StorageAreaImpl.cpp: + (WebCore::StorageAreaImpl::StorageAreaImpl): Move the code that calls + StorageAreaSync::create out of here. + (WebCore::StorageAreaImpl::create): Move it in here. This makes it so we + don't ref the storage area before finishing its creation and calling adoptRef. + + * svg/SVGPaint.cpp: + (WebCore::SVGPaint::defaultFill): Use create instead of new. + (WebCore::SVGPaint::defaultStroke): Ditto. + + * svg/graphics/filters/SVGFilterBuilder.h: Made the constructor private + and added a create function since this is a reference counted object and + should not be constructed directly. + +2010-06-17 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Gustavo Noronha. + + Update CMake build system to use new script for generating source files + with gperf (r61091). + This updates also the build system to cope with recent changes to + source files list. + https://bugs.webkit.org/show_bug.cgi?id=40628 + + No new tests since it's just compilation fixes. + + * CMakeLists.txt: + +2010-06-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Fix boolean reflected attributes to use empty string consistently for the content attribute value + https://bugs.webkit.org/show_bug.cgi?id=40758 + + Test: fast/dom/boolean-attribute-reflection.html + + The HTML5 specification and other browsers are all consistent: + When setting a boolean IDL attribute to true, the attribute value + gets set to the empty string. The guidelines for authors allow either + the empty string or the name of the attribute, but for implementers + of the DOM, the reflected attribute gets empty string. + + * dom/Element.cpp: + (WebCore::Element::setBooleanAttribute): Use emptyAtom to set the + attribute to the empty string. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::setAutofocus): Use the empty string, + not "autofocus". + (WebCore::HTMLFormControlElement::setRequired): Use the empty string, + not "required". + +2010-06-17 Pavel Feldman <pfeldman@chromium.org> + + Unreviewed: chromium tests fix. Added InspectorBackend delegates for new inspector methods. + + * inspector/front-end/InspectorBackendStub.js: + (.WebInspector.InspectorBackendStub.prototype.clearConsoleMessages): + (.WebInspector.InspectorBackendStub.prototype.getOuterHTML): + (.WebInspector.InspectorBackendStub.prototype.setOuterHTML): + (.WebInspector.InspectorBackendStub.prototype.addInspectedNode): + +2010-06-17 Mark Brand <mabrand@mabrand.nl> + + Reviewed by Simon Hausmann. + + [Qt] use "win32-g++*" scope to match all MinGW makespecs + + The scope "win32-g++" comes from the name of the makespec. However, it + is frequently used to check for MinGW. This works fine as long as + win32-g++ is the only makespec for MinGW. Now we need the wildcard + to cover "win32-g++-cross" as well. + + * WebCore.pro: + +2010-06-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joe Pecoraro. + + Web Inspector: move get/setOuterHTML, addInspectedNode and + clearConsole to native InspectorDOMAgent. This is done to allow + inspected nodes array to store nodes from different domains, + also moves outerhtml manipulation closer to the rest of the DOM + operations. In addition to that, we are slowly getting rid of + InjectedScriptAccess in favor of IDL-defined InspectorBackend + interface for clearer remote debugging API. + + https://bugs.webkit.org/show_bug.cgi?id=40733 + + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::inspectedNode): + * inspector/InjectedScriptHost.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::changeTagName): + (WebCore::InspectorBackend::getOuterHTML): + (WebCore::InspectorBackend::setOuterHTML): + (WebCore::InspectorBackend::addInspectedNode): + (WebCore::InspectorBackend::clearConsoleMessages): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::inspectedNode): + (WebCore::InspectorDOMAgent::changeTagName): + (WebCore::InspectorDOMAgent::getOuterHTML): + (WebCore::InspectorDOMAgent::setOuterHTML): + (WebCore::InspectorDOMAgent::addInspectedNode): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::didGetOuterHTML): + (WebCore::InspectorFrontend::didSetOuterHTML): + * inspector/InspectorFrontend.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.requestClearMessages): + * inspector/front-end/DOMAgent.js: + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + (WebInspector.ElementsPanel): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback): + (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted): + (): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/InjectedScriptAccess.js: + +2010-06-17 John Gregg <johnnyg@google.com> + + Reviewed by David Levin. + + Move the call to the notification presenter that a Notification is being + destroyed from the destructor (not safe) to the ActiveDOMObject::contextDestroyed + method. + + Also fix up an incorrect reference loss in the V8 bindings code for Notifications. + https://bugs.webkit.org/show_bug.cgi?id=40097 + + No new tests; code paths are well-covered by existing tests. + + * bindings/v8/custom/V8NotificationCenterCustom.cpp: + (WebCore::V8NotificationCenter::createHTMLNotificationCallback): + (WebCore::V8NotificationCenter::createNotificationCallback): + * notifications/Notification.cpp: + (WebCore::Notification::~Notification): + (WebCore::Notification::contextDestroyed): + * notifications/Notification.h: + +2010-06-17 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed rollout r61311, because it made 2 tests fail on Qt bot. + + [Qt] NPP_SetWindow seems to not be called when TestNetscapePlugin is moved + https://bugs.webkit.org/show_bug.cgi?id=36702 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + +2010-05-28 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> + + Reviewed by Simon Hausmann, Antti Koivisto + + Make repaint throttling parameters runtime configurable. + https://bugs.webkit.org/show_bug.cgi?id=38401 + + REPAINT_THROTTLING now chooses default values for throttling parameters. + Should be removed when applications start using runtime configuration. + + * page/FrameView.cpp: + (WebCore::FrameView::reset): + (WebCore::FrameView::updateDeferredRepaintDelay): + (WebCore::FrameView::setRepaintThrottlingDeferredRepaintDelay): + (WebCore::FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading): + (WebCore::FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading): + (WebCore::FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading): + * page/FrameView.h: + +2010-06-17 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] NPP_SetWindow seems to not be called when TestNetscapePlugin is moved + + https://bugs.webkit.org/show_bug.cgi?id=36702 + + setNPWindowIfNeeded() is called on paint() in PluginViewQt, which doesn't + work for DRT. So call it if we are in DRT mode and the window geometry + has changed. + + Unskips plugins/reentrant-update-widget-positions.html + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + +2010-06-17 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Christiansen. + + [Qt] Avoid unnecessary calls to save() and restore() when drawing images + + Avoid calling the expensive save() and restore() on the GraphicsContext just + for changing the composition mode. Instead save and restore it manually + on QPainter. + + Change fac227f609e544f8f55aca8447b4328d6534407a in Qt makes sure that the + call to QPainter::setCompositionMode doesn't do anything if the mode hasn't + changed. + + * platform/graphics/GraphicsContext.h: + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::toQtCompositionMode): + * platform/graphics/qt/ImageQt.cpp: + (WebCore::BitmapImage::draw): + +2010-06-16 Dawit Alemayehu <adawit@kde.org> + + Reviewed by Simon Hausmann. + + [Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64. + https://bugs.webkit.org/show_bug.cgi?id=40567 + + Avoid preventable crashes by ensuring gtk_init() is called in the + flash viewer plugins before calling NP_Initialize. + + * plugins/qt/PluginPackageQt.cpp: + (WebCore::PluginPackage::load): + +2010-06-16 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by David Levin. + + Guarantee that references are held for CachedScripts in HTMLDocumentParser. + https://bugs.webkit.org/show_bug.cgi?id=40177 + + No new tests because no new functionality. + + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::reset): + (WebCore::HTMLDocumentParser::executeExternalScriptsIfReady): + +2010-06-16 Qi Zhang <qi.2.zhang@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] Repeat pattern should start from origin + https://bugs.webkit.org/show_bug.cgi?id=39225 + + Patterns must be painted so that the top left of the first image + is anchored at the origin of the coordinate space. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::drawRepeatPattern): + (WebCore::GraphicsContext::fillRect): + +2010-06-16 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] WebGL viewport does not show up on N900 + https://bugs.webkit.org/show_bug.cgi?id=38528 + + With OGLES2 add default precision to the shader code. + Use GLsizeiptr and GLintptr with OGLES2. + Call paint() in beginPaint() so that drawTexture() is used + whenever possible. + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::beginPaint): + (WebCore::GraphicsContext3D::paint): + (WebCore::GraphicsContext3D::shaderSource): + +2010-06-16 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Fraser. + + Spatial Navigation: refactor scrollInDirection to work with scrollable content + https://bugs.webkit.org/show_bug.cgi?id=39195 + + scrollInDirection now receives as parameter the node that the Spatial Navigation + found as the more appropriated to move focus to. If it is in a scrollable container + (e.g. <div> with clipped overflow content), it scrolls recursively starting from + the container, not the current focused node. + + Test: fast/events/spatial-navigation/snav-only-clipped-overflow-content.html + + * page/FocusController.cpp: + (WebCore::FocusController::advanceFocusDirectionally): + * page/SpatialNavigation.cpp: + (WebCore::scrollInDirection): + * page/SpatialNavigation.h: + +2010-06-16 Brady Eidson <beidson@apple.com> + + Reviewed by Eric Carlson + + <rdar://problem/7249553> and https://bugs.webkit.org/show_bug.cgi?id=40749 + ResourceLoader::willCacheResponse() needs to null-check Frame::Settings() + + No new tests. (Discovered via crash reports, no reproducible cases noted) + + * loader/ResourceLoader.cpp: + (WebCore::ResourceLoader::willCacheResponse): Null check m_frame->settings(), + but also add an ASSERT so debug-build developers can learn more about why + this might be happening. + +2010-06-16 Darin Adler <darin@apple.com> + + Try to fix the MathML build. + + * mathml/MathMLMathElement.h: Added missing return type. + +2010-06-16 Darin Adler <darin@apple.com> + + Reviewed by David Levin. + + Deploy adoptRef in more places, including all HTML and MathML elements + https://bugs.webkit.org/show_bug.cgi?id=39941 + + * dom/Element.cpp: + (WebCore::Element::dispatchAttrRemovalEvent): Use create instead of new + in commented-out code. + (WebCore::Element::dispatchAttrAdditionEvent): Ditto. + + * dom/Node.h: Removed now-unused CreateElementZeroRefCount and + CreateHTMLElementZeroRefCount. + + * editing/InsertListCommand.cpp: + (WebCore::InsertListCommand::insertList): Use create instead of new, fixing + a storage leak. + + * editing/ModifySelectionListLevel.cpp: + (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel): + Removed "WithType" from function name. Use create instead of new, fixing a + storage leak. + (WebCore::DecreaseSelectionListLevelCommand::decreaseSelectionListLevel): Use + create instead of new, fixing a storage leak. + + * storage/IndexedDatabaseImpl.cpp: + (WebCore::IndexedDatabaseImpl::create): Use adoptRef, fixing a storage leak. + + * editing/ModifySelectionListLevel.h: Added create functions. + + * html/HTMLAnchorElement.cpp: + (WebCore::HTMLAnchorElement::HTMLAnchorElement): + * html/HTMLFrameOwnerElement.cpp: + (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement): + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::HTMLMeterElement): + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::HTMLProgressElement): + Removed code to explicitly pass CreateHTMLElement construction type since that's + now the type used for all HTML elements. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::HTMLFormControlElement): + * html/HTMLFormControlElement.h: + Removed construction type argument, since CreateHTMLElement is now the type used + for all HTML elements. + + * mathml/MathMLElement.cpp: + (WebCore::MathMLElement::MathMLElement): Removed construction type of + CreateStyledElementZeroRefCount so we'll use the default construction + type, CreateStyledElement. + (WebCore::MathMLElement::create): Use adoptRef. + + * mathml/MathMLElement.h: Made isMathMLElement function private and + removed unneeded override of createRenderer, because it did the + same thing as the base class's createRenderer function. + + * mathml/MathMLInlineContainerElement.cpp: + (WebCore::MathMLInlineContainerElement::create): Use adoptRef. + (WebCore::MathMLInlineContainerElement::createRenderer): + Removed unnecessarily initialization of local variable and removed the + case for mathTag, since that uses a different derived class. + + * mathml/MathMLInlineContainerElement.h: Made createRenderrer override + private. + + * mathml/MathMLMathElement.cpp: + (WebCore::MathMLMathElement::MathMLMathElement): Marked inline since + it is called in only one place. + (WebCore::MathMLMathElement::create): Use adoptRef. + (WebCore::MathMLMathElement::createRenderer): Added. Creates a + RenderMathMLMath object. + + * mathml/MathMLMathElement.h: Made constructor private and added a + private override of createRenderer. + + * mathml/MathMLTextElement.cpp: + (WebCore::MathMLTextElement::MathMLTextElement): Marked inline since + it is called in only one place. + (WebCore::MathMLTextElement::create): Use adoptRef. + (WebCore::MathMLTextElement::createRenderer): Changed to call through + to the base class instead of calling RenderObject::createObject directly. + + * mathml/MathMLTextElement.h: Made the constructor and createRenderer + function private. + + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::RenderFileUploadControl): + Removed an unneeded initializer. + + * rendering/RenderProgress.cpp: Tweaked includes. + + * rendering/ShadowElement.cpp: Added a "using namespace" directive. + * rendering/ShadowElement.h: Tweaked formatting. Made more functions + private. + + * editing/DeleteButton.cpp: + (WebCore::DeleteButton::create): + * html/HTMLAudioElement.cpp: + (WebCore::HTMLAudioElement::create): + (WebCore::HTMLAudioElement::createForJSConstructor): + * html/HTMLBRElement.cpp: + (WebCore::HTMLBRElement::create): + * html/HTMLBaseElement.cpp: + (WebCore::HTMLBaseElement::create): + * html/HTMLBaseFontElement.cpp: + (WebCore::HTMLBaseFontElement::create): + * html/HTMLBlockquoteElement.cpp: + (WebCore::HTMLBlockquoteElement::create): + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::create): + * html/HTMLButtonElement.cpp: + (WebCore::HTMLButtonElement::create): + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::create): + * html/HTMLDListElement.cpp: + (WebCore::HTMLDListElement::create): + * html/HTMLDataGridCellElement.cpp: + (WebCore::HTMLDataGridCellElement::create): + * html/HTMLDataGridColElement.cpp: + (WebCore::HTMLDataGridColElement::create): + * html/HTMLDataGridElement.cpp: + (WebCore::HTMLDataGridElement::create): + * html/HTMLDataGridRowElement.cpp: + (WebCore::HTMLDataGridRowElement::create): + * html/HTMLDataListElement.cpp: + (WebCore::HTMLDataListElement::create): + * html/HTMLDivElement.cpp: + (WebCore::HTMLDivElement::create): + * html/HTMLElement.cpp: + (WebCore::HTMLElement::create): + * html/HTMLElement.h: + (WebCore::HTMLElement::HTMLElement): + * html/HTMLFieldSetElement.cpp: + (WebCore::HTMLFieldSetElement::create): + * html/HTMLFontElement.cpp: + (WebCore::HTMLFontElement::create): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::create): + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::create): + * html/HTMLHRElement.cpp: + (WebCore::HTMLHRElement::create): + * html/HTMLHeadElement.cpp: + (WebCore::HTMLHeadElement::create): + * html/HTMLHeadingElement.cpp: + (WebCore::HTMLHeadingElement::create): + * html/HTMLHtmlElement.cpp: + (WebCore::HTMLHtmlElement::create): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::create): + (WebCore::HTMLImageElement::createForJSConstructor): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::create): + * html/HTMLIsIndexElement.cpp: + (WebCore::HTMLIsIndexElement::create): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::create): + * html/HTMLLIElement.cpp: + (WebCore::HTMLLIElement::create): + * html/HTMLLabelElement.cpp: + (WebCore::HTMLLabelElement::create): + * html/HTMLLegendElement.cpp: + (WebCore::HTMLLegendElement::create): + * html/HTMLLinkElement.cpp: + (WebCore::HTMLLinkElement::create): + * html/HTMLMapElement.cpp: + (WebCore::HTMLMapElement::create): + * html/HTMLMarqueeElement.cpp: + (WebCore::HTMLMarqueeElement::create): + * html/HTMLMenuElement.cpp: + (WebCore::HTMLMenuElement::create): + * html/HTMLMetaElement.cpp: + (WebCore::HTMLMetaElement::create): + * html/HTMLModElement.cpp: + (WebCore::HTMLModElement::create): + * html/HTMLNoScriptElement.cpp: + (WebCore::HTMLNoScriptElement::create): + * html/HTMLOListElement.cpp: + (WebCore::HTMLOListElement::create): + * html/HTMLOptGroupElement.cpp: + (WebCore::HTMLOptGroupElement::create): + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::create): + (WebCore::HTMLOptionElement::createForJSConstructor): + * html/HTMLParagraphElement.cpp: + (WebCore::HTMLParagraphElement::create): + * html/HTMLParamElement.cpp: + (WebCore::HTMLParamElement::create): + * html/HTMLPreElement.cpp: + (WebCore::HTMLPreElement::create): + * html/HTMLQuoteElement.cpp: + (WebCore::HTMLQuoteElement::create): + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::create): + * html/HTMLSelectElement.cpp: + (WebCore::HTMLSelectElement::create): + * html/HTMLSourceElement.cpp: + (WebCore::HTMLSourceElement::create): + * html/HTMLStyleElement.cpp: + (WebCore::HTMLStyleElement::create): + * html/HTMLTableCaptionElement.cpp: + (WebCore::HTMLTableCaptionElement::create): + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::create): + * html/HTMLTableColElement.cpp: + (WebCore::HTMLTableColElement::create): + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::create): + * html/HTMLTableRowElement.cpp: + (WebCore::HTMLTableRowElement::create): + * html/HTMLTableSectionElement.cpp: + (WebCore::HTMLTableSectionElement::create): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::create): + * html/HTMLTitleElement.cpp: + (WebCore::HTMLTitleElement::create): + * html/HTMLUListElement.cpp: + (WebCore::HTMLUListElement::create): + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::create): + * loader/ImageDocument.cpp: + (WebCore::ImageDocumentElement::create): + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlShadowRootElement::create): + (WebCore::MediaControlElement::create): + (WebCore::MediaControlTimelineContainerElement::create): + (WebCore::MediaControlVolumeSliderContainerElement::create): + (WebCore::MediaControlStatusDisplayElement::create): + (WebCore::MediaControlMuteButtonElement::create): + (WebCore::MediaControlPlayButtonElement::create): + (WebCore::MediaControlSeekButtonElement::create): + (WebCore::MediaControlRewindButtonElement::create): + (WebCore::MediaControlReturnToRealtimeButtonElement::create): + (WebCore::MediaControlToggleClosedCaptionsButtonElement::create): + (WebCore::MediaControlTimelineElement::create): + (WebCore::MediaControlVolumeSliderElement::create): + (WebCore::MediaControlFullscreenButtonElement::create): + (WebCore::MediaControlTimeDisplayElement::create): + * rendering/RenderSlider.cpp: + (WebCore::SliderThumbElement::create): + * rendering/TextControlInnerElements.cpp: + (WebCore::TextControlInnerElement::create): + (WebCore::TextControlInnerTextElement::create): + (WebCore::SearchFieldResultsButtonElement::create): + (WebCore::SearchFieldCancelButtonElement::create): + (WebCore::SpinButtonElement::create): + Use adoptRef. + +2010-06-16 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + HTML5 parser crash when setTimeout document.write after slow script + https://bugs.webkit.org/show_bug.cgi?id=40726 + + According to the HTML5 spec, we're supposed to open() a new document if + we receive a document.write() after we've received EOF for the network. + The old parser just dumped those bytes onto the end of the network + stream. After this patch, our behavior matches Minefield. + + Test: http/tests/misc/write-while-waiting.html + + * WebCore.xcodeproj/project.pbxproj: + * dom/Document.cpp: + (WebCore::Document::write): + * dom/DocumentParser.h: + * dom/XMLDocumentParser.cpp: + (WebCore::XMLDocumentParser::finishWasCalled): + * dom/XMLDocumentParser.h: + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::finishWasCalled): + * html/HTML5DocumentParser.h: + (WebCore::HTML5DocumentParser::InputStream::isClosed): + * html/HTMLDocumentParser.cpp: + (WebCore::HTMLDocumentParser::finishWasCalled): + * html/HTMLDocumentParser.h: + * loader/ImageDocument.cpp: + (WebCore::ImageTokenizer::finishWasCalled): + * loader/MediaDocument.cpp: + (WebCore::MediaDocumentParser::finishWasCalled): + * loader/PluginDocument.cpp: + (WebCore::PluginDocumentParser::finishWasCalled): + * loader/SinkDocument.cpp: + (WebCore::SinkDocumentParser::finishWasCalled): + * loader/TextDocument.cpp: + (WebCore::TextDocumentParser::finishWasCalled): + +2010-06-16 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] ClipboardGtk::setURL does not match the behavior of other platforms + https://bugs.webkit.org/show_bug.cgi?id=40640 + + Instead of writing URL labels to the text portion of the clipboard or + drag-and-drop data, write the URL itself. Also escape the label text + of URLs. Abstracts logic into DataObjectGtk, so ClipboardGtk and + PasteboardGtk can share it. + + Tests for this issue will be activated when dropping support has been + added to the GTK+ EventSender. + + * platform/gtk/ClipboardGtk.cpp: + (WebCore::ClipboardGtk::writeURL): Use DataObjectGtk::setURL. + * platform/gtk/DataObjectGtk.cpp: + (WebCore::DataObjectGtk::setURL): + Added. Write URL to the text portion and remember to escape the + label when creating the markup portion. + * platform/gtk/DataObjectGtk.h: Add declaration of new method. + * platform/gtk/PasteboardGtk.cpp: + (WebCore::Pasteboard::writeURL): Use DataObjectGtk::setURL. + +2010-06-16 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Hit assertion in WebCore::HTML5Token::appendToSystemIdentifier + https://bugs.webkit.org/show_bug.cgi?id=40729 + + This was a copy/paste error. Yay for ASSERTs. + + * html/HTML5Lexer.cpp: + (WebCore::HTML5Lexer::nextToken): + +2010-06-16 Stuart Morgan <stuartmorgan@chromium.org> + + Reviewed by Anders Carlsson. + + Bring npapi.h more in line with upstream npapi-headers version: + - Remove obsolete XP_MAC sections. + - Remove Metrowerks defines. + - Add OS/2 defines. + - Add Maemo defines. + - Add new version of the custom Carbon event definitions. + - Sync platform define style/details + + https://bugs.webkit.org/show_bug.cgi?id=38666 + + * bridge/npapi.h: + +2010-06-16 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Allow transitions and animations of clip: rect + https://bugs.webkit.org/show_bug.cgi?id=38130 + + Make the CSS clip property animatable. + + Test: transitions/clip-transition.html + + * page/animation/AnimationBase.cpp: + (WebCore::blendFunc): New blend function for LengthBox + (WebCore::AnimationBase::ensurePropertyMap): Create a PropertyWrapper for LengthBoxes. + + * platform/LengthBox.h: + (WebCore::LengthBox::LengthBox): New ctor that takes 4 length values. + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::setClip): New method that takes a LengthBox. + +2010-06-16 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Fix clipping via CSS clip: with composited descendants + https://bugs.webkit.org/show_bug.cgi?id=40579 + + Consult the 'clip' style, as well as overflow, when creating clipping + compositing layers. + + Tests: compositing/geometry/clip.html + compositing/overflow/clip-descendents.html + + * rendering/RenderLayerBacking.cpp: + (WebCore::clipBox): Utility function that returns the union of the clip and overflow + boxes. + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Use clipBox() to + get the correct clipping rectangle. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer): Look for + clip as well as overflow. + (WebCore::RenderLayerCompositor::clipsCompositingDescendants): Ditto. + +2010-06-16 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + REGRESSION: Undocked inspector toolbar is white + https://bugs.webkit.org/show_bug.cgi?id=40644 + + Make the html element 100% height so that we don't erase the background to white, after r61215. + + * inspector/front-end/inspector.css: + (html): + +2010-06-16 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Darin Adler. + + User scripts injected on start are not run on image documents. + https://bugs.webkit.org/show_bug.cgi?id=40722 + <rdar://8087394> + + User scripts that are injected on start are run from FrameLoader::dispatchDocumentElementAvailable, + but this is never called from ImageDocument, so call it when we create a document element for + our image document. + + * loader/ImageDocument.cpp: + (WebCore::ImageDocument::createDocumentStructure): Call FrameLoader::dispatchDocumentElementAvailable + after creating our document element. + +2010-06-16 Brady Eidson <beidson@apple.com> + + Reviewed by NOBODY (Build fix for Mac) + + * WebCore.xcodeproj/project.pbxproj: Make paths relative to the project root. + +2010-06-16 Chris Marrin <cmarrin@apple.com> + + Reviewed by Eric Carlson. + + https://bugs.webkit.org/show_bug.cgi?id=40643 + + Second of three steps - rename Canvas3DLayer to WebGLLayer + + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/mac/Canvas3DLayer.h: Removed. + * platform/graphics/mac/Canvas3DLayer.mm: Removed. + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayerCA::setContentsToGraphicsContext3D): + * platform/graphics/mac/WebGLLayer.h: Copied from WebCore/platform/graphics/mac/Canvas3DLayer.h. + * platform/graphics/mac/WebGLLayer.mm: Copied from WebCore/platform/graphics/mac/Canvas3DLayer.mm. + +2010-06-16 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=40643 + + Rename GraphicsContext3DMac.cpp so it can interact with CALayer + + * platform/graphics/mac/GraphicsContext3DMac.cpp: Removed. + * platform/graphics/mac/GraphicsContext3DMac.mm: Copied from WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp. + * WebCore.xcodeproj/project.pbxproj + +2010-06-16 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Add new files, needed in SVG Text rewrite + https://bugs.webkit.org/show_bug.cgi?id=40676 + + Land SVGTextChunkLayoutInfo.cpp and SVGTextQuery.(cpp|h), both with an "#if 0" on top, as they will be needed + in a later patch, completing the SVG Text rewrite, that will enable them. + + Doesn't affect any code for now, it should just reduce the review amount. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * rendering/SVGTextChunkLayoutInfo.cpp: Added. + (WebCore::cummulatedWidthOrHeightOfTextChunk): + (WebCore::cummulatedWidthOfTextChunk): + (WebCore::cummulatedHeightOfTextChunk): + (WebCore::calculateTextAnchorShiftForTextChunk): + (WebCore::applyTextAnchorToTextChunk): + (WebCore::calculateTextLengthCorrectionForTextChunk): + (WebCore::applyTextLengthCorrectionToTextChunk): + (WebCore::SVGTextChunkLayoutInfo::startTextChunk): + (WebCore::SVGTextChunkLayoutInfo::closeTextChunk): + (WebCore::SVGTextChunkLayoutInfo::buildTextChunks): + (WebCore::SVGTextChunkLayoutInfo::recursiveBuildTextChunks): + (WebCore::SVGTextChunkLayoutInfo::layoutTextChunks): + * rendering/SVGTextChunkLayoutInfo.h: Add missing include, otherwhise compiling SVGTextChunkLayoutInfo.cpp will fail. + * rendering/SVGTextQuery.cpp: Added. + (WebCore::SVGTextQuery::Data::Data): + (WebCore::flowBoxForRenderer): + (WebCore::mapLengthThroughChunkTransformation): + (WebCore::SVGTextQuery::SVGTextQuery): + (WebCore::SVGTextQuery::collectTextBoxesInFlowBox): + (WebCore::SVGTextQuery::executeQuery): + (WebCore::SVGTextQuery::mapStartAndLengthIntoChunkPartCoordinates): + (WebCore::SVGTextQuery::measureCharacterRange): + (WebCore::NumberOfCharactersData::NumberOfCharactersData): + (WebCore::SVGTextQuery::numberOfCharactersCallback): + (WebCore::SVGTextQuery::numberOfCharacters): + (WebCore::TextLengthData::TextLengthData): + (WebCore::SVGTextQuery::textLengthCallback): + (WebCore::SVGTextQuery::textLength): + (WebCore::SubStringLengthData::SubStringLengthData): + (WebCore::SVGTextQuery::subStringLengthCallback): + (WebCore::SVGTextQuery::subStringLength): + (WebCore::StartPositionOfCharacterData::StartPositionOfCharacterData): + (WebCore::SVGTextQuery::startPositionOfCharacterCallback): + (WebCore::SVGTextQuery::startPositionOfCharacter): + (WebCore::EndPositionOfCharacterData::EndPositionOfCharacterData): + (WebCore::SVGTextQuery::endPositionOfCharacterCallback): + (WebCore::SVGTextQuery::endPositionOfCharacter): + (WebCore::RotationOfCharacterData::RotationOfCharacterData): + (WebCore::SVGTextQuery::rotationOfCharacterCallback): + (WebCore::SVGTextQuery::rotationOfCharacter): + (WebCore::ExtentOfCharacterData::ExtentOfCharacterData): + (WebCore::SVGTextQuery::extentOfCharacterCallback): + (WebCore::SVGTextQuery::extentOfCharacter): + (WebCore::CharacterNumberAtPositionData::CharacterNumberAtPositionData): + (WebCore::SVGTextQuery::characterNumberAtPositionCallback): + (WebCore::SVGTextQuery::characterNumberAtPosition): + * rendering/SVGTextQuery.h: Added. + +2010-06-16 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Provide floating-point support for text selection framework + https://bugs.webkit.org/show_bug.cgi?id=40665 + + This is the first chunk of the SVG Text rewrite patches. + offsetForPosition() / selectionRectForText() should accept float/FloatPoint arguments instead + of int/IntPoint. offsetForPosition() already worked with floats internally in Qt and Mac. + selectionRectForText() was already returning a FloatRect, but the passed in origin was an integer. + Fixing these problems in order to support sub-pixel positioning in the upcoming SVG Text rewrite patch. + + Add a glyphScale parameter to TextRun, that will be used to support text selection + in lengthAdjust/textLength scenarios in SVG text, soon. + + Doesn't affect any testcases so far. HTML is not affected in any way, + as it only ever passes integers to these functions. + + * platform/graphics/Font.cpp: + (WebCore::Font::selectionRectForText): + (WebCore::Font::offsetForPosition): + * platform/graphics/Font.h: + * platform/graphics/FontFastPath.cpp: + (WebCore::Font::selectionRectForSimpleText): + (WebCore::Font::offsetForPositionForSimpleText): + * platform/graphics/TextRun.h: + (WebCore::TextRun::TextRun): + (WebCore::TextRun::glyphScale): + (WebCore::TextRun::setGlyphScale): + (WebCore::TextRun::applyGlyphScaling): + * platform/graphics/WidthIterator.cpp: + (WebCore::WidthIterator::advance): + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/efl/FontEfl.cpp: + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/gtk/FontGtk.cpp: + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/haiku/FontHaiku.cpp: + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::offsetForPosition): + * platform/graphics/mac/ComplexTextController.h: + * platform/graphics/mac/FontComplexTextMac.cpp: + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/qt/FontQt.cpp: + (WebCore::Font::offsetForPositionForSimpleText): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForSimpleText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/win/FontWin.cpp: + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/wince/FontWince.cpp: + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/wx/FontWx.cpp: + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * svg/SVGFont.cpp: + (WebCore::Font::selectionRectForTextUsingSVGFont): + (WebCore::Font::offsetForPositionForTextUsingSVGFont): + +2010-06-16 Anton Muhin <antonm@chromium.org> + + Reviewed by Nate Chapin. + + [v8] Introduce single element caches for WebCore::String to v8::String conversions + https://bugs.webkit.org/show_bug.cgi?id=40435 + Measurements show that for some web apps (GMail, Wave) and some scenarios + (intensive reading and/or keeping a tab open for a long time), + hit rate lies in 30--50% interval. + Inlining fast case gives another minor performance win. + + * bindings/v8/V8Binding.cpp: + (WebCore::getStringCache): + (WebCore::v8ExternalStringSlow): + * bindings/v8/V8Binding.h: + (WebCore::v8ExternalString): + +2010-06-16 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Kenneth Christiansen. + + Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position + https://bugs.webkit.org/show_bug.cgi?id=39439 + + As pointed out by Darin Adler in https://bugs.webkit.org/show_bug.cgi?id=18662#c20, + "It's not correct to use the offsetLeft and offsetTop of the frame owner element's renderer because + that's just the distance from the offsetParent, not the absolute position". + + Patch fixes that behavior by now considering the offsetTop and offsetLeft the offsetParent recursively, + starting from the HtmlFrameOwnerElement. Previously, only calling offsetTop and offsetLeft works + because all tests were done in htmls where the {i}frame element was a directly a child of the body, + e.g. <html>...<body><iframe src=xxx>....<body></html>. + + Test: fast/events/spatial-navigation/snav-iframe-recursive-offset-parent.html + + * page/SpatialNavigation.cpp: + (WebCore::renderRectRelativeToRootDocument): + +2010-06-16 Dan Bernstein <mitz@apple.com> + + Try to fix the Tiger build + + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformBoundsForGlyph): + +2010-06-16 Dan Bernstein <mitz@apple.com> + + Try to fix the Tiger build + + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformBoundsForGlyph): + +2010-06-16 Dan Bernstein <mitz@apple.com> + + Reviewed by Alexey Proskuryakov. + + <rdar://problem/8077119> REGRESSION (r60247): Google Reader contains the tops of pieces of unidentifiable text under feed headlines. + https://bugs.webkit.org/show_bug.cgi?id=40386 + + Test: platform/mac/fast/text/x-height.html + + The result of platformBoundsForGlyph() is in flipped coordinates, whereas the result of + -[NSFont boundingRectForGlyph:] was not. r60247 failed to account for this. + + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformInit): Measure the height of the x glyph above the baseline + correctly. + (WebCore::SimpleFontData::platformBoundsForGlyph): Return a rect in flipped coordinates on Tiger + as well. + +2010-06-16 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Don't crash when a document ends with an entity + https://bugs.webkit.org/show_bug.cgi?id=40658 + + When we SWITCH_TO a state, we're expecting our caller to have advanced + the source. Rather than have all the callers check for empty, we do + that ourselves. + + * html/HTML5Lexer.cpp: + +2010-06-15 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Enable HTML5 lexer + https://bugs.webkit.org/show_bug.cgi?id=40650 + + * page/Settings.cpp: + (WebCore::Settings::Settings): + +2010-06-15 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by David Harrison. + + sqlite3_prepare16_v2 is not documented as always setting "tail" during error cases. + Explicitly initialize it to null, just to be safe. + + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): + +2010-06-15 Mark Rowe <mrowe@apple.com> + + Reviewed by Brady Eidson. + + <rdar://problem/8091103> URLs not added to history when initial load happens via back/forward navigation + + Back/forward navigation currently does not create or update items in the global history. This is usually + desirable, except for in the event where the back/forward list was created programmatically and attached + to the WebView and the initial load in that WebView is being performed as a result of a back/forward + navigation. In that situation it is preferable to ensure that global history item is created or updated. + + No test case is added because DumpRenderTree is not able to test the scenario where the initial + load in a WebView occurs via a back/forward navigation. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::transitionToCommitted): If we're committing the first load in this frame as a + back/forward navigation then we should update the history as if it were a standard load, with the + exception of updating the back/forward list. + * loader/HistoryController.cpp: + (WebCore::HistoryController::updateForStandardLoad): Add a parameter to allow callers to skip updating + the back/forward list. + * loader/HistoryController.h: + (WebCore::HistoryController::): + +2010-06-15 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by David Levin. + + Fix compilation errors in BlobBuilder with FILE_WRITER enabled + https://bugs.webkit.org/show_bug.cgi?id=40606 + + No functionality change so no new tests. + + * html/BlobBuilder.cpp: + * html/BlobBuilder.h: + +2010-06-15 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Move type attribute from File.idl to Blob.idl per latest File API spec. + https://bugs.webkit.org/show_bug.cgi?id=40642 + + * html/Blob.idl: + * html/File.idl: + +2010-06-15 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions out of Frame class that were marked "move to Chrome" + https://bugs.webkit.org/show_bug.cgi?id=39636 + + Refactoring that does not require new tests. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::didOpenURL): Call setStatus and setDefaultStatus + on DOMWindow rather than going through Frame. + (WebCore::FrameLoader::open): Ditto. + (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Call + shouldClose on this object instead of going through Frame. + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents): Call + shouldClose on FrameLoader instead of going through Frame. + (WebCore::DOMWindow::focus): Moved the code from Frame::focusWindow + in here. + (WebCore::DOMWindow::blur): Moved the code from Frame::unfocusWindow + in here. + (WebCore::DOMWindow::close): Moved the code from Frame::scheduleClose + in here. + (WebCore::DOMWindow::setStatus): Moved the code from + Frame::setJSStatusBarText in here. + (WebCore::DOMWindow::setDefaultStatus): Moved the code from + Frame::setJSDefaultStatusBarText in here. + + * page/DOMWindow.h: Added m_status and m_defaultStatus members to + store the status messages being set by the DOM. + + * page/Frame.cpp: Removed all the functions that were marked + "to be moved into Chrome". + * page/Frame.h: Ditto. + +2010-06-15 Simon Fraser <simon.fraser@apple.com> + + Fix crashing tests; need to check for null documentElement(). + + * rendering/RenderView.cpp: + (WebCore::RenderView::paintBoxDecorations): + +2010-06-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Garbage shown outside HTML if HTML is absolutely positioned + https://bugs.webkit.org/show_bug.cgi?id=36163 + + Add a check that the root renderer (the document element's renderer) covers + the entire viewport before deciding that we don't need the RenderView + to paint its background. Fixes lack of painting with positioned, floated, and + display: table html elements. + + Test: fast/repaint/positioned-document-element.html + + * rendering/RenderView.cpp: + (WebCore::RenderView::paintBoxDecorations): + +2010-06-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Safari 5 does not clear background with transformed html element + https://bugs.webkit.org/show_bug.cgi?id=40498 + + When the document element is composited, ensure that the FrameView + paints the background, because the composited layer may be transparent, + or might get moved via animation. + + Test: compositing/repaint/composited-document-element.html + + * rendering/RenderView.cpp: + (WebCore::isComposited): + (WebCore::rendererObscuresBackground): + +2010-06-15 Xan Lopez <xlopez@igalia.com> + + Try to fix GTK+ build. + + * platform/gtk/GtkVersioning.h: + +2010-06-15 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + Introduce HistoryItem::itemSequenceNumber and use it to identify + HistoryItems that are clones of one another. + + Changes HistoryController::recursiveGoToItem to use itemSequenceNumber + equality instead of isTargetItem as the pre-requisite for not calling + FrameLoader::loadItem. + + Changes FrameLoader::loadItem to require equivalent + documentSequenceNumber before initiating a same document navigation. + This alone would appear to fix the bug, but it does not go far enough + since without the itemSequenceNumber equality check, we'd re-load more + often than we should. + + Moves documentSequenceNumber assignment into createItemTree as cleanup + and to ensure that it gets called properly whenever we create a cloned + HistoryItem. (createItemTree's mission is to create clones up until + or including the target frame depending on the value of the doClip + parameter.) + + Removes the now unused HistoryController::urlsMatchItem. + + https://bugs.webkit.org/show_bug.cgi?id=40451 + + Test: fast/history/history-back-within-subframe.html + http/tests/navigation/history-back-across-form-submission-to-fragment.html + + * history/HistoryItem.cpp: + (WebCore::generateSequenceNumber): + (WebCore::HistoryItem::HistoryItem): + * history/HistoryItem.h: + (WebCore::HistoryItem::setItemSequenceNumber): + (WebCore::HistoryItem::itemSequenceNumber): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::loadItem): + * loader/HistoryController.cpp: + (WebCore::HistoryController::updateBackForwardListForFragmentScroll): + (WebCore::HistoryController::createItemTree): + (WebCore::HistoryController::recursiveGoToItem): + (WebCore::HistoryController::pushState): + * loader/HistoryController.h: + +2010-06-15 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Does not compile with -DGSEAL_ENABLE + https://bugs.webkit.org/show_bug.cgi?id=37851 + + Fix compilation with GSEAL_ENABLE. + + * platform/gtk/GtkVersioning.h: + * platform/gtk/PlatformScreenGtk.cpp: + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::show): + * platform/gtk/ScrollbarGtk.cpp: + (ScrollbarGtk::detachAdjustment): + (ScrollbarGtk::updateThumbPosition): + (ScrollbarGtk::updateThumbProportion): + * plugins/gtk/PluginViewGtk.cpp: + (WebCore::PluginView::paint): + (WebCore::PluginView::initXEvent): + (WebCore::PluginView::platformGetValue): + (WebCore::PluginView::platformStart): + * plugins/gtk/gtk2xtbin.c: + (gtk_xtbin_realize): + (gtk_xtbin_new): + (gtk_xtbin_set_position): + (gtk_xtbin_unrealize): + +2010-06-15 Xan Lopez <xlopez@igalia.com> + + Unreviewed build fix. + + Fix the build when WebSockets are disabled. + + * bindings/js/JSWorkerContextCustom.cpp: + +2010-06-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + YouTube thumbnail borders vanish during transition + https://bugs.webkit.org/show_bug.cgi?id=40551 + + Turn off the direct image optimization if the image has a clip style, so that is is + correctly rendered with the clip. + + Test: compositing/images/clip-on-directly-composited-image.html + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::isDirectlyCompositedImage): + +2010-06-15 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [v8] Web Inspector: make ui tests pass when ScriptDebugServer is used + https://bugs.webkit.org/show_bug.cgi?id=40623 + + * bindings/v8/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::functionName): return empty string for anonymous functions instead of [anonymous]. + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::handleV8DebugEvent): autocontinue on syntax errors since there is no stack trace and + not much to inspect. + +2010-06-15 Adam Roben <aroben@apple.com> + + Make WebCore's and JavaScriptCore's DerivedSources available for debugging in production builds + + Fixes <http://webkit.org/b/40626> <rdar://problem/8094205>. + + Reviewed by Sam Weinig. + + * WebCore.vcproj/WebCore.make: Copy the contents of WebCore's + DerivedSources directory to AppleInternal/Sources/WebCore. + +2010-06-15 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Bring framebuffer functions to GLES2 conformance + https://bugs.webkit.org/show_bug.cgi?id=40175 + + Test: fast/canvas/webgl/framebuffer-test.html + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::checkFramebufferStatus): Check input parameters and deal with default framebuffer situation. + (WebCore::WebGLRenderingContext::framebufferRenderbuffer): Check input parameters. + (WebCore::WebGLRenderingContext::framebufferTexture2D): Ditto. + (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Ditto. + (WebCore::WebGLRenderingContext::validateFramebufferFuncParameters): Check input parameters. + * html/canvas/WebGLRenderingContext.h: Add validateFramebufferFuncParameters. + +2010-06-15 Patrick Gansterer <paroga@paroga.com> + + Reviewed by David Levin. + + Buildfix for ResourceHandleWin after r24202 and r55542. + https://bugs.webkit.org/show_bug.cgi?id=32963 + + * platform/network/win/ResourceHandleWin.cpp: + (WebCore::ResourceHandle::onHandleCreated): + (WebCore::ResourceHandle::onRequestComplete): + (WebCore::transferJobStatusCallback): + (WebCore::ResourceHandle::start): + +2010-06-12 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joe Pecoraro. + + Web Inspector: Should not expose window.console._inspectorCommandLineAPI to the web. + + https://bugs.webkit.org/show_bug.cgi?id=40500 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + +2010-06-15 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] The qt_webkit_version.pri file gets overwritten on install + https://bugs.webkit.org/show_bug.cgi?id=40487 + + Don't install qt_webkit_version.pri when building WebKit inside of Qt. + The import of WebKit into Qt will take care of providing the file + in mkspecs/modules and it'll be installed through projects.pro. + + * WebCore.pro: + +2010-06-15 Tony Chang <tony@chromium.org> + + Reviewed by Ojan Vafai. + + resolve urls in text/html clipboard data + https://bugs.webkit.org/show_bug.cgi?id=40044 + + Allow text/html data copied from a page to contain full URLs when + dragging or copy/pasting. + + Tests: editing/pasteboard/copy-resolves-urls.html + http/tests/misc/copy-resolves-urls.html + + * WebCore.base.exp: + * editing/markup.cpp: + (WebCore::appendStartMarkup): + (WebCore::getStartMarkup): + (WebCore::MarkupAccumulator::appendMarkup): + (WebCore::createMarkup): + * editing/markup.h: + (WebCore::): + * platform/chromium/ClipboardChromium.cpp: + (WebCore::ClipboardChromium::writeRange): + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeSelection): + * platform/gtk/ClipboardGtk.cpp: + (WebCore::ClipboardGtk::writeRange): + * platform/gtk/DataObjectGtk.cpp: + (WebCore::DataObjectGtk::markup): + * platform/gtk/PasteboardGtk.cpp: + (WebCore::Pasteboard::writeSelection): + * platform/haiku/PasteboardHaiku.cpp: + (WebCore::Pasteboard::writeSelection): + * platform/qt/ClipboardQt.cpp: + (WebCore::ClipboardQt::writeRange): + * platform/qt/PasteboardQt.cpp: + (WebCore::Pasteboard::writeSelection): + +2010-06-14 Chris Fleizach <cfleizach@apple.com> + + No review. GTK build fix. + + AX: need ListItemRole and PresentationalRole + https://bugs.webkit.org/show_bug.cgi?id=40133 + + Mostly speculative fix to make GTK unit tests work. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (atkRole): + (webkit_accessible_get_role): + +2010-06-14 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/8090895> Update http streaming MIME types + + * platform/MIMETypeRegistry.cpp: + (WebCore::TypeExtensionPair::): Add http streaming MIME synonyms. + +2010-06-14 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Oliver Hunt. + + audio/x-mp3 MIME type not recognized + <rdar://problem/7875393> + https://bugs.webkit.org/show_bug.cgi?id=40594 + + Allow MIMETypeRegistry to have more than one MIME type for a + media file extension, and have the QTKit media engine register + all MIME types it can find for each file type QTKit supports. + + Test: media/media-can-play-mp3.html + + * platform/MIMETypeRegistry.cpp: + (WebCore::mediaMIMETypeMap): Update for new HashMap format. + (WebCore::TypeExtensionPair::): Store String+Vector<String> + (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Only consult + mediaMIMETypeMap(), it has the canonical answer. + (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): New, return + a Vector of all MIME types for an extension. + * platform/MIMETypeRegistry.h: + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::addFileTypesToCache): Add all MIME types returned in the + getMediaMIMETypesForExtension Vector. + +2010-06-14 Mark Rowe <mrowe@apple.com> + + Reviewed by Brady Eidson. + + <rdar://problem/8071866> REGRESSION: Crash on launch on Tiger and Leopard with network home folder + + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): Don't assume that tail is always non-null, since that may + not be the case with some versions of SQLite. Instead we must null-check before dereferencing. + +2010-06-14 Anders Carlsson <andersca@apple.com> + + Fix Tiger build. + + * plugins/mac/PluginDataMac.mm: + +2010-06-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Use an array for extensions in MimeClassInfo + https://bugs.webkit.org/show_bug.cgi?id=40602 + + Get rid of MimeClassInfo::suffixes and replace it with an array of extensions. + + * plugins/MimeType.cpp: + (WebCore::MimeType::suffixes): + Create a string of joined extensions. + + * plugins/MimeType.h: + * plugins/PluginData.h: + (WebCore::operator==): + * plugins/chromium/PluginDataChromium.cpp: + (WebCore::getPluginMimeTypeFromExtension): + * plugins/gtk/PluginDataGtk.cpp: + (WebCore::PluginData::initPlugins): + * plugins/mac/PluginDataMac.mm: + (WebCore::PluginData::initPlugins): + * plugins/qt/PluginDataQt.cpp: + (WebCore::PluginData::initPlugins): + * plugins/win/PluginDataWin.cpp: + (WebCore::PluginData::initPlugins): + * plugins/wx/PluginDataWx.cpp: + (WebCore::PluginData::initPlugins): + +2010-06-14 Adam Barth <abarth@webkit.org> + + Unreviewed. + + Add an include to try to fix Chromium build. + + * html/HTML5DocumentParser.cpp: + +2010-06-14 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Safari beach-balls loading large pages with HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40596 + + Implement parser yielding, similar to how the old + HTMLDocumentParser yields. + + This implementation re-uses the tokenizerTimeDelay and + tokenizerChunkSize settings even though they don't map exactly + to the token loop that the HTML5 parser uses. + + * dom/DocumentParser.h: + - Add a FIXME for processingData() and clarify how the + appendData flag is used by renaming it to isFromNetwork. + * html/HTML5DocumentParser.cpp: + (WebCore::parserTimeLimit): + - Defaults accessor, probably belongs on Page. + (WebCore::parserChunkSize): + - Defaults accessor, probably belongs on Page. + (WebCore::HTML5DocumentParser::HTML5DocumentParser): + (WebCore::HTML5DocumentParser::stopParsing): + - Stop the continue-parsing timer if active. + (WebCore::HTML5DocumentParser::processingData): + - Implement this poorly understood accessor to match + the old parser's behavior. It's unclear what this does + and it does not affect any layout tests to my knowledge + but likely affects the WebKit API in some way. + (WebCore::HTML5DocumentParser::pumpLexerIfPossible): + - Pass SynchronousMode. + - Do not ever pump if we've yielded to the timer. + (WebCore::HTML5DocumentParser::PumpSession::PumpSession): + - A struct for storing the yield counters. + (WebCore::HTML5DocumentParser::shouldContinueParsing): + - Mostly matches HTMLDocumentParser::shouldContinueParsing. + (WebCore::HTML5DocumentParser::pumpLexer): + - Respect SynchronousMode. + - ASSERT that a timer is not scheduled if we're pumping. + (WebCore::isLayoutTimerActive): + - This belongs on Document. + (WebCore::HTML5DocumentParser::continueNextChunkTimerFired): + (WebCore::HTML5DocumentParser::write): + (WebCore::HTML5DocumentParser::end): + - We should never end() if a timer is still outstanding. + (WebCore::HTML5DocumentParser::attemptToEnd): + (WebCore::HTML5DocumentParser::endIfDelayed): + (WebCore::HTML5DocumentParser::resumeParsingAfterScriptExecution): + * html/HTML5DocumentParser.h: + (WebCore::HTML5DocumentParser::): + * html/HTMLDocumentParser.cpp: + - Clarify the old TimeDelay and ChunkSize constants. + +2010-06-14 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add a preload scanner for the HTML5 parser + https://bugs.webkit.org/show_bug.cgi?id=40557 + + This patch adds a simple preload scanner for the HTML5 parser. This + preload scanner is not as awesome as the old one because it doesn't + scan CSS, but it's much simpler. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + - Build file torture. + * html/HTML5DocumentParser.cpp: + (WebCore::HTML5DocumentParser::write): + - Call into the preload scanner when waiting for a script. + * html/HTML5DocumentParser.h: + * html/HTML5PreloadScanner.cpp: Copied from WebCore/html/PreloadScanner.cpp. + (WebCore::HTML5PreloadScanner::HTML5PreloadScanner): + (WebCore::HTML5PreloadScanner::scan): + - A simple loop to pump the preload scanner's lexer. + (WebCore::HTML5PreloadScanner::processToken): + - Preload interesting resources. Stolen from the old preload + scanner. + (WebCore::HTML5PreloadScanner::scanningBody): + * html/HTML5PreloadScanner.h: Copied from WebCore/html/PreloadScanner.h. + +2010-06-14 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Constify some HTML5Token methods + https://bugs.webkit.org/show_bug.cgi?id=40592 + + I keep wanting these methods to be const. Eric wanted this in a + separate patch. + + * html/HTML5Lexer.h: + (WebCore::HTML5Lexer::state): + * html/HTML5Token.h: + (WebCore::HTML5Token::attributes): + (WebCore::HTML5Token::name): + (WebCore::HTML5Token::characters): + (WebCore::HTML5Token::comment): + (WebCore::HTML5Token::publicIdentifier): + (WebCore::HTML5Token::systemIdentifier): + * html/HTML5TreeBuilder.cpp: + (WebCore::convertToOldStyle): + (WebCore::HTML5TreeBuilder::adjustedLexerState): + - Technically, this might belong in the other patch, but I think + it's fine here. + (WebCore::HTML5TreeBuilder::passTokenToLegacyParser): + * html/HTML5TreeBuilder.h: + +2010-06-14 Dumitru Daniliuc <dumi@chromium.org> + + Unreviewed, build fix. + + * WebCore.xcodeproj/project.pbxproj: + +2010-06-14 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + Remove accidental specifying of the class name twice. + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::prepareFormData): Removed my ghastly typo. + +2010-06-14 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Get DatabaseTracker ready for sync DBs. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * storage/AbstractDatabase.cpp: + (WebCore::AbstractDatabase::~AbstractDatabase): + * storage/AbstractDatabase.h: + * storage/Database.cpp: + (WebCore::Database::closeImmediately): + * storage/Database.h: + (WebCore::Database::scriptExecutionContext): + * storage/DatabaseTracker.cpp: + (WebCore::DatabaseTracker::getMaxSizeForDatabase): + (WebCore::DatabaseTracker::databaseChanged): + (WebCore::DatabaseTracker::addOpenDatabase): + (WebCore::DatabaseTracker::removeOpenDatabase): + (WebCore::DatabaseTracker::getOpenDatabases): + (WebCore::DatabaseTracker::deleteDatabaseFile): + * storage/DatabaseTracker.h: + * storage/OriginQuotaManager.cpp: + (WebCore::OriginQuotaManager::markDatabase): + * storage/OriginQuotaManager.h: + * storage/chromium/DatabaseObserver.h: + * storage/chromium/DatabaseTrackerChromium.cpp: + (WebCore::DatabaseTracker::addOpenDatabase): + (WebCore::TrackerRemoveOpenDatabaseTask::create): + (WebCore::TrackerRemoveOpenDatabaseTask::TrackerRemoveOpenDatabaseTask): + (WebCore::DatabaseTracker::removeOpenDatabase): + (WebCore::DatabaseTracker::getOpenDatabases): + (WebCore::DatabaseTracker::getMaxSizeForDatabase): + +2010-06-14 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=40529 + eventSender.keyDown("delete") incorrectly sends a backspace on some platforms + + * platform/mac/KeyEventMac.mm: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): + Use virtual key code to force correct character code for clarity. Also, reworded comment, + since saying that "backspace needs to always be 8" misleadingly implied that it could + "sometimes" be such without this code. + +2010-06-14 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + Refactor form submission code in HTMLFormElement to add clarity. + https://bugs.webkit.org/show_bug.cgi?id=39430 + + Covered by existing tests in fast/forms/mailto. + + * html/HTMLFormElement.cpp: + (WebCore::appendMailtoPostFormDataToURL): Renamed from transferMailtoPostFormDataToUrl, + removed clearing out of the FormData and moved it to a new place (next to the call site). + (WebCore::HTMLFormElement::prepareFormData): Renamed from createFormData, moved the logic of + prepareing FormData here, including the use of appendMailtoPostFormDataToURL. + (WebCore::HTMLFormElement::submit): Consolidated multiple invocations of submitForm(). + * html/HTMLFormElement.h: Renamed createFormData to prepareFormData. + +2010-06-14 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + AX: need ListItemRole and PresentationalRole + https://bugs.webkit.org/show_bug.cgi?id=40133 + + * accessibility/AccessibilityObject.cpp: + (WebCore::createARIARoleMap): + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::isListItem): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + (WebCore::AccessibilityRenderObject::determineAccessibilityRole): + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper accessibilityAttributeNames]): + +2010-06-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove pluginIndex from MimeClassInfo + https://bugs.webkit.org/show_bug.cgi?id=40588 + + * plugins/PluginData.h: + * plugins/gtk/PluginDataGtk.cpp: + (WebCore::PluginData::initPlugins): + * plugins/mac/PluginDataMac.mm: + (WebCore::PluginData::initPlugins): + * plugins/qt/PluginDataQt.cpp: + (WebCore::PluginData::initPlugins): + * plugins/win/PluginDataWin.cpp: + (WebCore::PluginData::initPlugins): + * plugins/wx/PluginDataWx.cpp: + (WebCore::PluginData::initPlugins): + +2010-06-14 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + Implement BlobBuilder internal class for BlobBuilder support as defined in FileWriter + https://bugs.webkit.org/show_bug.cgi?id=36903 + + No new tests; they will be added when we add jsc bindings. + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/BlobBuilder.cpp: Added. + * html/BlobBuilder.h: Added. + (WebCore::BlobBuilder::create): + * platform/BlobItem.cpp: + (WebCore::StringBlobItem::convertToCString): Added EndingNative support. + * platform/BlobItem.h: Added EndingNative line-ending type. + (WebCore::): + +2010-06-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Stop using MimeClassInfo::pluginIndex + https://bugs.webkit.org/show_bug.cgi?id=40582 + + Add a pluginIndicies vector to PluginData and use it instead of MimeClassInfo::pluginIndex. + + * plugins/MimeType.cpp: + (WebCore::MimeType::enabledPlugin): + Get the plug-in index from the mimePluginIndices vector. + + * plugins/Plugin.cpp: + (WebCore::Plugin::item): + Compare the mime plugin index as well. + + * plugins/PluginData.cpp: + (WebCore::PluginData::PluginData): + Populate the m_mimePluginIndices vector. + + (WebCore::PluginData::pluginNameForMimeType): + Get the plug-in index from the m_mimePluginIndices vector. + + * plugins/PluginData.h: + (WebCore::operator==): + Don't check for pluginIndex. + + (WebCore::PluginData::mimePluginIndices): + Add getter for m_mimePluginIndices. + +2010-06-14 Sam Weinig <sam@webkit.org> + + Better build fix. + + * bindings/js/JSBindingsAllInOne.cpp: + +2010-06-14 Sam Weinig <sam@webkit.org> + + Another windows build fix. + + * bindings/js/JSBindingsAllInOne.cpp: + +2010-06-14 Sam Weinig <sam@webkit.org> + + Another build fix. + + * bindings/js/JSDOMWindowCustom.cpp: + +2010-06-14 Sam Weinig <sam@webkit.org> + + Add missing comma to fix GTK build. + + * xml/XSLTProcessor.idl: + +2010-06-14 Sam Weinig <sam@webkit.org> + + Reviewed by Alexey Proskuryakov. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=40581 + Auto-generate most of the JS constructors + + - Auto-generates all the JS constructors that don't have custom + names (eg, Not Image(), Audio() or Option()) + - Fixes two typos. + (new XSLTConstructor()).toString() [object XSLTProcessorConsructor] -> [object XSLTProcessorConstructor]) + (new EventSource()).toString() [object EventSourceContructor] -> [object EventSourceConstructor]) + + * Android.jscbindings.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSArrayBufferConstructor.cpp: Removed. + * bindings/js/JSArrayBufferConstructor.h: Removed. + * bindings/js/JSArrayBufferCustom.cpp: Copied from WebCore/bindings/js/JSArrayBufferConstructor.cpp. + (WebCore::JSArrayBufferConstructor::constructJSArrayBuffer): + * bindings/js/JSArrayBufferViewHelper.h: + (WebCore::constructArrayBufferView): + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSEventSourceConstructor.cpp: Removed. + * bindings/js/JSEventSourceConstructor.h: Removed. + * bindings/js/JSEventSourceCustom.cpp: Copied from WebCore/bindings/js/JSEventSourceConstructor.cpp. + (WebCore::JSEventSourceConstructor::constructJSEventSource): + * bindings/js/JSFloat32ArrayConstructor.cpp: Removed. + * bindings/js/JSFloat32ArrayConstructor.h: Removed. + * bindings/js/JSFloat32ArrayCustom.cpp: + (WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array): + * bindings/js/JSInt16ArrayConstructor.cpp: Removed. + * bindings/js/JSInt16ArrayConstructor.h: Removed. + * bindings/js/JSInt16ArrayCustom.cpp: + (WebCore::JSInt16ArrayConstructor::constructJSInt16Array): + * bindings/js/JSInt32ArrayConstructor.cpp: Removed. + * bindings/js/JSInt32ArrayConstructor.h: Removed. + * bindings/js/JSInt32ArrayCustom.cpp: + (WebCore::JSInt32ArrayConstructor::constructJSInt32Array): + * bindings/js/JSInt8ArrayConstructor.cpp: Removed. + * bindings/js/JSInt8ArrayConstructor.h: Removed. + * bindings/js/JSInt8ArrayCustom.cpp: + (WebCore::JSInt8ArrayConstructor::constructJSInt8Array): + * bindings/js/JSMessageChannelConstructor.cpp: Removed. + * bindings/js/JSMessageChannelConstructor.h: Removed. + * bindings/js/JSMessageChannelCustom.cpp: + (WebCore::JSMessageChannelConstructor::constructJSMessageChannel): + * bindings/js/JSSharedWorkerConstructor.cpp: Removed. + * bindings/js/JSSharedWorkerConstructor.h: Removed. + * bindings/js/JSSharedWorkerCustom.cpp: + (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): + * bindings/js/JSUint16ArrayConstructor.cpp: Removed. + * bindings/js/JSUint16ArrayConstructor.h: Removed. + * bindings/js/JSUint16ArrayCustom.cpp: + (WebCore::JSUint16ArrayConstructor::constructJSUint16Array): + * bindings/js/JSUint32ArrayConstructor.cpp: Removed. + * bindings/js/JSUint32ArrayConstructor.h: Removed. + * bindings/js/JSUint32ArrayCustom.cpp: + (WebCore::JSUint32ArrayConstructor::constructJSUint32Array): + * bindings/js/JSUint8ArrayConstructor.cpp: Removed. + * bindings/js/JSUint8ArrayConstructor.h: Removed. + * bindings/js/JSUint8ArrayCustom.cpp: + (WebCore::JSUint8ArrayConstructor::constructJSUint8Array): + * bindings/js/JSWebKitCSSMatrixConstructor.cpp: Removed. + * bindings/js/JSWebKitCSSMatrixConstructor.h: Removed. + * bindings/js/JSWebKitCSSMatrixCustom.cpp: Copied from WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp. + (WebCore::JSWebKitCSSMatrixConstructor::constructJSWebKitCSSMatrix): + * bindings/js/JSWebKitPointConstructor.cpp: Removed. + * bindings/js/JSWebKitPointConstructor.h: Removed. + * bindings/js/JSWebKitPointCustom.cpp: Copied from WebCore/bindings/js/JSWebKitPointConstructor.cpp. + (WebCore::JSWebKitPointConstructor::constructJSWebKitPoint): + * bindings/js/JSWebSocketConstructor.cpp: Removed. + * bindings/js/JSWebSocketConstructor.h: Removed. + * bindings/js/JSWebSocketCustom.cpp: + (WebCore::JSWebSocketConstructor::constructJSWebSocket): + * bindings/js/JSWorkerConstructor.cpp: Removed. + * bindings/js/JSWorkerConstructor.h: Removed. + * bindings/js/JSWorkerContextCustom.cpp: + * bindings/js/JSWorkerCustom.cpp: + (WebCore::JSWorkerConstructor::constructJSWorker): + * bindings/js/JSXSLTProcessorConstructor.cpp: Removed. + * bindings/js/JSXSLTProcessorConstructor.h: Removed. + * bindings/js/JSXSLTProcessorCustom.cpp: + (WebCore::JSXSLTProcessorConstructor::constructJSXSLTProcessor): + * bindings/scripts/CodeGeneratorJS.pm: + * css/WebKitCSSMatrix.idl: + * dom/MessageChannel.idl: + * html/canvas/ArrayBuffer.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * page/EventSource.idl: + * page/WebKitPoint.idl: + * websockets/WebSocket.idl: + * workers/SharedWorker.idl: + * workers/Worker.idl: + * xml/XSLTProcessor.idl: + +2010-05-16 Antonio Gomes <tonikitoo@webkit.org> + + Unreviewed naming fixes of local variables used in Spatial Navigation methods. + + Summary: + * "candidate" renamed to "node"; + * "currentFocusCandidate" renamed to "candidate" + * "closestFocusCandidate" renamed to "closest" + + That way naming is more consistent in the various Spatial Navigation methods. + + * page/FocusController.cpp: + (WebCore::FocusController::findFocusableNodeInDirection): + (WebCore::FocusController::deepFindFocusableNodeInDirection): + +2010-06-14 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Fraser and Kenneth Christiansen. + + Spatial Navigation: make it work with focusable elements in overflow content + https://bugs.webkit.org/show_bug.cgi?id=36463 + + This patch addresses the problem with Spatial Navigation. It currently does not + properly traverse scrollable contents, including scrollable div's. For this to work, + a new class member called scrollableEnclosingBox was introduced to FocusCandidate class which + keeps track of the current scrollable box Node wrapping a FocusCandidate. + + To make use of enclosingScrollableBox of FocusCandidate, the DOM traversal routine + (FocusController::findNextFocusableInDirection) was changed as follows: when it + encounters a scrollable Node, each focusable node which is 'inner' keeps track of + the container reference. By the time a sibling of the scrollable Node is encountered, + there is no need to track this reference any more and the traversal algorithm continues + normally. + + The common case is obviously that there is no scrollable container wrapping it. + + updateFocusCandiditeIfCloser logic was also adapted to fit the need of the + newly introduced enclosingScrollableBox class member, getting simpler and more + easily maintainable. + + Tests: fast/events/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html + fast/events/spatial-navigation/snav-clipped-overflow-content.html + + * page/FocusController.cpp: + (WebCore::updateFocusCandidateInSameContainer): + (WebCore::updateFocusCandidateIfCloser): + (WebCore::FocusController::findFocusableNodeInDirection): + (WebCore::FocusController::deepFindFocusableNodeInDirection): + * page/SpatialNavigation.cpp: + (WebCore::isScrollableContainerNode): + * page/SpatialNavigation.h: + (WebCore::FocusCandidate::FocusCandidate): + (WebCore::FocusCandidate::isInScrollableContainer): + +2010-06-14 Jian Li <jianli@chromium.org> + + Unreviewed. Fix build break in GTK. + + * bindings/scripts/CodeGeneratorGObject.pm: + * bindings/scripts/test/GObject/WebKitDOMTestCallback.h: + * bindings/scripts/test/GObject/WebKitDOMTestCallbackPrivate.h: + * bindings/scripts/test/GObject/WebKitDOMTestInterface.h: + * bindings/scripts/test/GObject/WebKitDOMTestInterfacePrivate.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + +2010-06-14 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + AX: AXUnknown objects are being returned + https://bugs.webkit.org/show_bug.cgi?id=40574 + + Test: platform/mac/accessibility/no-unknown-objects-when-title-attribute-present.html + + * accessibility/mac/AccessibilityObjectMac.mm: + (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): + +2010-06-14 Jian Li <jianli@chromium.org> + + Reviewed by Darin Adler. + + Fix code generators to better support Conditional attribute and add test + coverage for it. + https://bugs.webkit.org/show_bug.cgi?id=39512 + + * bindings/scripts/CodeGeneratorGObject.pm: + * bindings/scripts/CodeGeneratorObjC.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestCallback.h: + * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestInterface.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_conditional_attr1): + (webkit_dom_test_obj_set_conditional_attr1): + (webkit_dom_test_obj_get_conditional_attr2): + (webkit_dom_test_obj_set_conditional_attr2): + (webkit_dom_test_obj_get_conditional_attr3): + (webkit_dom_test_obj_set_conditional_attr3): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestInterface.cpp: + * bindings/scripts/test/JS/JSTestInterface.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjConditionalAttr1): + (WebCore::jsTestObjConditionalAttr2): + (WebCore::jsTestObjConditionalAttr3): + (WebCore::setJSTestObjConditionalAttr1): + (WebCore::setJSTestObjConditionalAttr2): + (WebCore::setJSTestObjConditionalAttr3): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestInterface.mm: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj conditionalAttr1]): + (-[DOMTestObj setConditionalAttr1:]): + (-[DOMTestObj conditionalAttr2]): + (-[DOMTestObj setConditionalAttr2:]): + (-[DOMTestObj conditionalAttr3]): + (-[DOMTestObj setConditionalAttr3:]): + * bindings/scripts/test/TestInterface.idl: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestInterface.cpp: + * bindings/scripts/test/V8/V8TestInterface.h: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::conditionalAttr1AttrGetter): + (WebCore::TestObjInternal::conditionalAttr1AttrSetter): + (WebCore::TestObjInternal::conditionalAttr2AttrGetter): + (WebCore::TestObjInternal::conditionalAttr2AttrSetter): + (WebCore::TestObjInternal::conditionalAttr3AttrGetter): + (WebCore::TestObjInternal::conditionalAttr3AttrSetter): + (WebCore::): + +2010-06-14 Chang Shu <chang.shu@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Change the type of ShadowSize from IntSize to FloatSize in GraphicsContext. + Using IntSize loses precision and fails the test. + Note: This code change fixes Qt port but Mac is still failing due to + platform issue. + + https://bugs.webkit.org/show_bug.cgi?id=40434 + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::applyShadow): + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::setShadow): + (WebCore::GraphicsContext::getShadow): + * platform/graphics/GraphicsContext.h: + * platform/graphics/GraphicsContextPrivate.h: + * platform/graphics/cairo/FontCairo.cpp: + (WebCore::Font::drawGlyphs): + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::calculateShadowBufferDimensions): + (WebCore::drawPathShadow): + (WebCore::drawBorderlessRectShadow): + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/cairo/ImageCairo.cpp: + (WebCore::BitmapImage::draw): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::drawGlyphs): + (WebCore::Font::drawComplexText): + * platform/graphics/gtk/FontGtk.cpp: + (WebCore::Font::drawComplexText): + * platform/graphics/haiku/GraphicsContextHaiku.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/mac/FontMac.mm: + (WebCore::Font::drawGlyphs): + * platform/graphics/openvg/GraphicsContextOpenVG.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/qt/FontQt.cpp: + (WebCore::drawTextCommon): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::drawFilledShadowPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::drawBorderlessRectShadow): + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/qt/ImageQt.cpp: + (WebCore::BitmapImage::draw): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + * platform/graphics/skia/SkiaFontWin.cpp: + (WebCore::windowsCanHandleDrawTextShadow): + * platform/graphics/win/FontCGWin.cpp: + (WebCore::drawGDIGlyphs): + (WebCore::Font::drawGlyphs): + * platform/graphics/wince/GraphicsContextWince.cpp: + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::drawText): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::GraphicsContext::setPlatformShadow): + +2010-06-14 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7752961> Unevenly distributed space in justified text + https://bugs.webkit.org/show_bug.cgi?id=36105 + + Test: fast/text/justify-padding-distribution.html + + * platform/graphics/WidthIterator.cpp: + (WebCore::WidthIterator::WidthIterator): Initialize m_padPerSpace to the quotient of the total + padding and the number of spaces rather than truncating it. + (WebCore::WidthIterator::advance): Subtract m_padPerSpace from m_padding and add the difference + between its old and new values, when rounded, to the advance. + * platform/graphics/mac/ComplexTextController.cpp: + (WebCore::ComplexTextController::ComplexTextController): + (WebCore::ComplexTextController::adjustGlyphsAndAdvances): + * platform/graphics/win/UniscribeController.cpp: + (WebCore::UniscribeController::UniscribeController): + (WebCore::UniscribeController::shapeAndPlaceItem): + * platform/graphics/win/UniscribeController.h: + +2010-06-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Stack overflow when converting navigator object to QVariant + https://bugs.webkit.org/show_bug.cgi?id=40572 + + Protect against infinite recursion in JSValue->QVariant conversion. + This fixes a crash when trying to convert MimeType objects (they + recurse infinitely and on-the-fly via the enabledPlugin property.) + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-06-14 Yong Li <yoli@rim.com> + + Test cases created by: Robin Cao <robin.cao@torchmobile.com.cn> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=38910 + + Suspend Document::m_executeScriptSoonTimer objects when the page is deferred. + There's no reason why we suspend all active DOM timers on the page but not suspend + this one. Document::m_executeScriptSoonTimer can run JS and schedule more DOM Timers. + + It can only be tested manually. + * manual-tests/load-deferrer-script-element.html: Added. + * manual-tests/resources/load-deferrer-script-element.js: Added. + + * dom/Document.cpp: + (WebCore::Document::executeScriptSoon): + (WebCore::Document::suspendExecuteScriptSoonTimer): Added. + (WebCore::Document::resumeExecuteScriptSoonTimer): Added. + * dom/Document.h: + * page/PageGroupLoadDeferrer.cpp: + (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): + (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer): + 2010-06-13 Yael Aharon <yael.aharon@nokia.com> Reviewed by Kenneth Rohde Christiansen. @@ -2403,6 +11013,43 @@ Reviewed by Shinichiro Hamaji. + Implement render style selection for pages to support CSS3 Paged Media. + https://bugs.webkit.org/show_bug.cgi?id=35961 + + Test: printing/page-rule-selection.html + + * WebCore.base.exp: + * css/CSSGrammar.y: + * css/CSSSelector.cpp: + (WebCore::CSSSelector::specificity): + (WebCore::CSSSelector::specificityForPage): + * css/CSSSelector.h: + (WebCore::CSSSelector::CSSSelector): + (WebCore::CSSSelector::isForPage): + (WebCore::CSSSelector::setForPage): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::styleForPage): + (WebCore::CSSStyleSelector::matchPageRules): + (WebCore::CSSStyleSelector::matchPageRulesForList): + (WebCore::CSSStyleSelector::isLeftPage): + (WebCore::CSSStyleSelector::isFirstPage): + (WebCore::CSSStyleSelector::pageName): + * css/CSSStyleSelector.h: + (WebCore::CSSStyleSelector::isRightPage): + * css/html.css: + (@page): + * dom/Document.cpp: + (WebCore::Document::styleForPage): + * dom/Document.h: + * page/PrintContext.cpp: + (WebCore::PrintContext::pageProperty): + * page/PrintContext.h: + + +2010-06-10 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + Fix Bug 40452: REGRESSION: printing is broken if stylesheet has @page https://bugs.webkit.org/show_bug.cgi?id=40452 @@ -3945,7 +12592,7 @@ 2010-06-08 Erik Arvidsson <arv@chromium.org> - Reviewed by ojan@chromium.org. + Reviewed by Ojan Vafai. REGRESSION: Weird focus behavior affects quoting on University of Washington message board system https://bugs.webkit.org/show_bug.cgi?id=38548 @@ -4424,9 +13071,9 @@ 2010-06-07 Eric Seidel <eric@webkit.org> - Unreviewed. Just commit an edit XCode keeps making automatically. + Unreviewed. Just commit an edit Xcode keeps making automatically. - It appears someone hand-edited the file, XCode no-like. + It appears someone hand-edited the file, Xcode no-like. * WebCore.xcodeproj/project.pbxproj: @@ -7042,7 +15689,7 @@ 2010-06-02 Erik Arvidsson <arv@chromium.org> - Reviewed by ojan@chromium.org. + Reviewed by Ojan Vafai. REGRESSION: Weird focus behavior affects quoting on University of Washington message board system https://bugs.webkit.org/show_bug.cgi?id=38548 diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig index 5b52793..08d9ef9 100644 --- a/WebCore/Configurations/FeatureDefines.xcconfig +++ b/WebCore/Configurations/FeatureDefines.xcconfig @@ -57,6 +57,7 @@ ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; +ENABLE_INPUT_SPEECH = ; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_MATHML = ; ENABLE_METER_TAG = ENABLE_METER_TAG; @@ -81,4 +82,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig index 6f999af..f775a54 100644 --- a/WebCore/Configurations/Version.xcconfig +++ b/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 1; +MINOR_VERSION = 2; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index 7ac3e51..904ea55 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -30,6 +30,7 @@ #include "JSBarInfo.cpp" #include "JSBeforeLoadEvent.cpp" #include "JSBlob.cpp" +#include "JSBlobBuilder.cpp" #include "JSCanvasGradient.cpp" #include "JSCanvasPattern.cpp" #include "JSCanvasRenderingContext.cpp" @@ -221,6 +222,7 @@ #include "JSSharedWorker.cpp" #include "JSSharedWorkerContext.cpp" #include "JSSQLError.cpp" +#include "JSSQLException.cpp" #include "JSSQLResultSet.cpp" #include "JSSQLResultSetRowList.cpp" #include "JSSQLStatementCallback.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 7ec915f..bf09a22 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -54,6 +54,7 @@ DOM_CLASSES = \ BarInfo \ BeforeLoadEvent \ Blob \ + BlobBuilder \ CDATASection \ CSSCharsetRule \ CSSFontFaceRule \ @@ -265,6 +266,7 @@ DOM_CLASSES = \ ScriptProfile \ ScriptProfileNode \ SQLError \ + SQLException \ SQLResultSet \ SQLResultSetRowList \ SQLStatementCallback \ diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js Binary files differindex 743296a..7ffafdf 100644 --- a/WebCore/English.lproj/localizedStrings.js +++ b/WebCore/English.lproj/localizedStrings.js diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 47f2057..8f9c245 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -180,6 +180,7 @@ IDL_BINDINGS += \ WebCore/dom/WebKitTransitionEvent.idl \ WebCore/dom/WheelEvent.idl \ WebCore/html/Blob.idl \ + WebCore/html/BlobBuilder.idl \ WebCore/html/canvas/ArrayBufferView.idl \ WebCore/html/canvas/ArrayBuffer.idl \ WebCore/html/canvas/Int8Array.idl \ @@ -435,8 +436,7 @@ webcore_sources += \ WebCore/bindings/js/JSEventCustom.cpp \ WebCore/bindings/js/JSEventListener.cpp \ WebCore/bindings/js/JSEventListener.h \ - WebCore/bindings/js/JSEventSourceConstructor.cpp \ - WebCore/bindings/js/JSEventSourceConstructor.h \ + WebCore/bindings/js/JSEventSourceCustom.cpp \ WebCore/bindings/js/JSEventTarget.cpp \ WebCore/bindings/js/JSEventTarget.h \ WebCore/bindings/js/JSExceptionBase.cpp \ @@ -477,8 +477,6 @@ webcore_sources += \ WebCore/bindings/js/JSLocationCustom.h \ WebCore/bindings/js/JSMainThreadExecState.cpp \ WebCore/bindings/js/JSMainThreadExecState.h \ - WebCore/bindings/js/JSMessageChannelConstructor.cpp \ - WebCore/bindings/js/JSMessageChannelConstructor.h \ WebCore/bindings/js/JSMessageChannelCustom.cpp \ WebCore/bindings/js/JSMessageEventCustom.cpp \ WebCore/bindings/js/JSMessagePortCustom.cpp \ @@ -506,16 +504,12 @@ webcore_sources += \ WebCore/bindings/js/JSStyleSheetListCustom.cpp \ WebCore/bindings/js/JSTextCustom.cpp \ WebCore/bindings/js/JSTreeWalkerCustom.cpp \ - WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp \ - WebCore/bindings/js/JSWebKitCSSMatrixConstructor.h \ - WebCore/bindings/js/JSWebKitPointConstructor.cpp \ - WebCore/bindings/js/JSWebKitPointConstructor.h \ + WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp \ + WebCore/bindings/js/JSWebKitPointCustom.cpp \ WebCore/bindings/js/JSWorkerContextErrorHandler.cpp \ WebCore/bindings/js/JSWorkerContextErrorHandler.h \ WebCore/bindings/js/JSXMLHttpRequestCustom.cpp \ WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp \ - WebCore/bindings/js/JSXSLTProcessorConstructor.cpp \ - WebCore/bindings/js/JSXSLTProcessorConstructor.h \ WebCore/bindings/js/JSXSLTProcessorCustom.cpp \ WebCore/bindings/js/JavaScriptCallFrame.cpp \ WebCore/bindings/js/JavaScriptCallFrame.h \ @@ -816,6 +810,7 @@ webcore_sources += \ WebCore/dom/ExceptionBase.h \ WebCore/dom/ExceptionCode.cpp \ WebCore/dom/ExceptionCode.h \ + WebCore/dom/FragmentScriptingPermission.h \ WebCore/dom/InputElement.cpp \ WebCore/dom/InputElement.h \ WebCore/dom/KeyboardEvent.cpp \ @@ -877,6 +872,7 @@ webcore_sources += \ WebCore/dom/Range.h \ WebCore/dom/RangeBoundaryPoint.h \ WebCore/dom/RangeException.h \ + WebCore/dom/RawDataDocumentParser.h \ WebCore/dom/RegisteredEventListener.cpp \ WebCore/dom/RegisteredEventListener.h \ WebCore/dom/ScriptElement.cpp \ @@ -889,6 +885,8 @@ webcore_sources += \ WebCore/dom/SelectorNodeList.h \ WebCore/dom/SpaceSplitString.cpp \ WebCore/dom/SpaceSplitString.h \ + WebCore/dom/StaticHashSetNodeList.cpp \ + WebCore/dom/StaticHashSetNodeList.h \ WebCore/dom/StaticNodeList.cpp \ WebCore/dom/StaticNodeList.h \ WebCore/dom/StyleElement.cpp \ @@ -1043,6 +1041,8 @@ webcore_sources += \ WebCore/html/AsyncImageResizer.h \ WebCore/html/Blob.cpp \ WebCore/html/Blob.h \ + WebCore/html/BlobBuilder.cpp \ + WebCore/html/BlobBuilder.h \ WebCore/html/canvas/CanvasContextAttributes.h \ WebCore/html/canvas/CanvasGradient.cpp \ WebCore/html/canvas/CanvasGradient.h \ @@ -1059,6 +1059,8 @@ webcore_sources += \ WebCore/html/CollectionCache.cpp \ WebCore/html/CollectionCache.h \ WebCore/html/CollectionType.h \ + WebCore/html/CSSPreloadScanner.cpp \ + WebCore/html/CSSPreloadScanner.h \ WebCore/html/DataGridColumn.cpp \ WebCore/html/DataGridColumn.h \ WebCore/html/DataGridColumnList.cpp \ @@ -1087,18 +1089,20 @@ webcore_sources += \ WebCore/html/FileThreadTask.h \ WebCore/html/FormDataList.cpp \ WebCore/html/FormDataList.h \ - WebCore/html/HTML5EntityParser.cpp \ - WebCore/html/HTML5EntityParser.h \ - WebCore/html/HTML5Lexer.cpp \ - WebCore/html/HTML5Lexer.h \ - WebCore/html/HTML5Token.h \ - WebCore/html/HTML5DocumentParser.cpp \ - WebCore/html/HTML5DocumentParser.h \ - WebCore/html/HTML5TreeBuilder.cpp \ - WebCore/html/HTML5TreeBuilder.h \ - WebCore/html/HTML5ScriptRunner.cpp \ - WebCore/html/HTML5ScriptRunner.h \ - WebCore/html/HTML5ScriptRunnerHost.h \ + WebCore/html/HTMLEntityParser.cpp \ + WebCore/html/HTMLEntityParser.h \ + WebCore/html/HTMLTokenizer.cpp \ + WebCore/html/HTMLTokenizer.h \ + WebCore/html/HTMLToken.h \ + WebCore/html/HTMLDocumentParser.cpp \ + WebCore/html/HTMLDocumentParser.h \ + WebCore/html/HTMLPreloadScanner.cpp \ + WebCore/html/HTMLPreloadScanner.h \ + WebCore/html/HTMLScriptRunner.cpp \ + WebCore/html/HTMLScriptRunner.h \ + WebCore/html/HTMLScriptRunnerHost.h \ + WebCore/html/HTMLTreeBuilder.cpp \ + WebCore/html/HTMLTreeBuilder.h \ WebCore/html/HTMLAllCollection.cpp \ WebCore/html/HTMLAllCollection.h \ WebCore/html/HTMLAnchorElement.cpp \ @@ -1179,6 +1183,7 @@ webcore_sources += \ WebCore/html/HTMLImageLoader.h \ WebCore/html/HTMLInputElement.cpp \ WebCore/html/HTMLInputElement.h \ + WebCore/html/HTMLInputStream.h \ WebCore/html/HTMLIsIndexElement.cpp \ WebCore/html/HTMLIsIndexElement.h \ WebCore/html/HTMLKeygenElement.cpp \ @@ -1219,11 +1224,13 @@ webcore_sources += \ WebCore/html/HTMLParagraphElement.h \ WebCore/html/HTMLParamElement.cpp \ WebCore/html/HTMLParamElement.h \ - WebCore/html/LegacyHTMLTreeConstructor.cpp \ - WebCore/html/LegacyHTMLTreeConstructor.h \ + WebCore/html/LegacyHTMLTreeBuilder.cpp \ + WebCore/html/LegacyHTMLTreeBuilder.h \ WebCore/html/HTMLParserErrorCodes.cpp \ WebCore/html/HTMLParserErrorCodes.h \ WebCore/html/HTMLParserQuirks.h \ + WebCore/html/HTMLParserScheduler.cpp \ + WebCore/html/HTMLParserScheduler.h \ WebCore/html/HTMLPlugInElement.cpp \ WebCore/html/HTMLPlugInElement.h \ WebCore/html/HTMLPlugInImageElement.cpp \ @@ -1260,8 +1267,8 @@ webcore_sources += \ WebCore/html/HTMLTextAreaElement.h \ WebCore/html/HTMLTitleElement.cpp \ WebCore/html/HTMLTitleElement.h \ - WebCore/html/HTMLDocumentParser.cpp \ - WebCore/html/HTMLDocumentParser.h \ + WebCore/html/LegacyHTMLDocumentParser.cpp \ + WebCore/html/LegacyHTMLDocumentParser.h \ WebCore/html/HTMLUListElement.cpp \ WebCore/html/HTMLUListElement.h \ WebCore/html/HTMLViewSourceDocument.cpp \ @@ -1273,8 +1280,8 @@ webcore_sources += \ WebCore/html/LabelsNodeList.cpp \ WebCore/html/LabelsNodeList.h \ WebCore/html/MediaError.h \ - WebCore/html/PreloadScanner.cpp \ - WebCore/html/PreloadScanner.h \ + WebCore/html/LegacyPreloadScanner.cpp \ + WebCore/html/LegacyPreloadScanner.h \ WebCore/html/StepRange.cpp \ WebCore/html/StepRange.h \ WebCore/html/TextMetrics.h \ @@ -1341,6 +1348,7 @@ webcore_sources += \ WebCore/inspector/InspectorValues.cpp \ WebCore/inspector/InspectorValues.h \ WebCore/inspector/InspectorWorkerResource.h \ + WebCore/inspector/ScriptBreakpoint.cpp \ WebCore/inspector/ScriptBreakpoint.h \ WebCore/inspector/ScriptDebugListener.h \ WebCore/inspector/ScriptGCEventListener.h \ @@ -1387,9 +1395,13 @@ webcore_sources += \ WebCore/loader/FTPDirectoryParser.h \ WebCore/loader/FormState.cpp \ WebCore/loader/FormState.h \ + WebCore/loader/FormSubmission.cpp \ + WebCore/loader/FormSubmission.h \ WebCore/loader/FrameLoader.cpp \ WebCore/loader/FrameLoader.h \ WebCore/loader/FrameLoaderClient.h \ + WebCore/loader/FrameLoaderStateMachine.cpp \ + WebCore/loader/FrameLoaderStateMachine.h \ WebCore/loader/FrameLoaderTypes.h \ WebCore/loader/HistoryController.cpp \ WebCore/loader/HistoryController.h \ @@ -1423,8 +1435,10 @@ webcore_sources += \ WebCore/loader/ResourceLoader.h \ WebCore/loader/ResourceLoadNotifier.cpp \ WebCore/loader/ResourceLoadNotifier.h \ - WebCore/loader/SinkDocument.cpp \ - WebCore/loader/SinkDocument.h \ + WebCore/loader/SinkDocument.cpp \ + WebCore/loader/SinkDocument.h \ + WebCore/loader/SubframeLoader.cpp \ + WebCore/loader/SubframeLoader.h \ WebCore/loader/SubresourceLoader.cpp \ WebCore/loader/SubresourceLoader.h \ WebCore/loader/SubresourceLoaderClient.h \ @@ -1805,6 +1819,8 @@ webcore_sources += \ WebCore/platform/text/BidiContext.h \ WebCore/platform/text/BidiResolver.h \ WebCore/platform/text/CharacterNames.h \ + WebCore/platform/text/Hyphenation.cpp \ + WebCore/platform/text/Hyphenation.h \ WebCore/platform/text/ParserUtilities.h \ WebCore/platform/text/PlatformString.h \ WebCore/platform/text/RegularExpression.cpp \ @@ -1934,6 +1950,8 @@ webcore_sources += \ WebCore/rendering/RenderImage.h \ WebCore/rendering/RenderImageGeneratedContent.cpp \ WebCore/rendering/RenderImageGeneratedContent.h \ + WebCore/rendering/RenderIndicator.cpp \ + WebCore/rendering/RenderIndicator.h \ WebCore/rendering/RenderInline.cpp \ WebCore/rendering/RenderInline.h \ WebCore/rendering/RenderLayer.cpp \ @@ -2381,6 +2399,7 @@ IDL_BINDINGS += \ WebCore/storage/DatabaseCallback.idl \ WebCore/storage/DatabaseSync.idl \ WebCore/storage/SQLError.idl \ + WebCore/storage/SQLException.idl \ WebCore/storage/SQLResultSet.idl \ WebCore/storage/SQLResultSetRowList.idl \ WebCore/storage/SQLStatementCallback.idl \ @@ -2436,6 +2455,7 @@ webcore_sources += \ WebCore/storage/OriginUsageRecord.cpp \ WebCore/storage/OriginUsageRecord.h \ WebCore/storage/SQLError.h \ + WebCore/storage/SQLException.h \ WebCore/storage/SQLResultSet.cpp \ WebCore/storage/SQLResultSet.h \ WebCore/storage/SQLResultSetRowList.cpp \ @@ -2589,6 +2609,20 @@ webcore_sources += \ endif # END ENABLE_DOM_STORAGE # ---- +# Speech Input API support +# ---- +if ENABLE_INPUT_SPEECH + +FEATURE_DEFINES += ENABLE_INPUT_SPEECH=1 +webcore_cppflags += -DENABLE_INPUT_SPEECH=1 + +else + +webcore_cppflags += -DENABLE_INPUT_SPEECH=0 + +endif # END ENABLE_INPUT_SPEECH + +# ---- # Icon Database Support # ---- if ENABLE_ICONDATABASE @@ -2834,8 +2868,6 @@ webcore_cppflags += \ webcore_sources += \ WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp \ - WebCore/bindings/js/JSWorkerConstructor.cpp \ - WebCore/bindings/js/JSWorkerConstructor.h \ WebCore/bindings/js/JSWorkerContextBase.cpp \ WebCore/bindings/js/JSWorkerContextBase.h \ WebCore/bindings/js/JSWorkerContextCustom.cpp \ @@ -2881,8 +2913,6 @@ webcore_cppflags += \ -DENABLE_SHARED_WORKERS=1 webcore_sources += \ - WebCore/bindings/js/JSSharedWorkerConstructor.cpp \ - WebCore/bindings/js/JSSharedWorkerConstructor.h \ WebCore/bindings/js/JSSharedWorkerCustom.cpp \ WebCore/workers/DefaultSharedWorkerRepository.cpp \ WebCore/workers/DefaultSharedWorkerRepository.h \ @@ -3338,9 +3368,12 @@ webcore_sources += \ WebCore/rendering/SVGRootInlineBox.h \ WebCore/rendering/SVGShadowTreeElements.cpp \ WebCore/rendering/SVGShadowTreeElements.h \ + WebCore/rendering/SVGTextChunkLayoutInfo.cpp \ WebCore/rendering/SVGTextChunkLayoutInfo.h \ WebCore/rendering/SVGTextLayoutUtilities.cpp \ WebCore/rendering/SVGTextLayoutUtilities.h \ + WebCore/rendering/SVGTextQuery.cpp \ + WebCore/rendering/SVGTextQuery.h \ WebCore/rendering/style/SVGRenderStyle.cpp \ WebCore/rendering/style/SVGRenderStyle.h \ WebCore/rendering/style/SVGRenderStyleDefs.cpp \ @@ -3733,8 +3766,6 @@ webcore_cppflags += \ -DENABLE_WEB_SOCKETS=1 webcore_sources += \ - WebCore/bindings/js/JSWebSocketConstructor.cpp \ - WebCore/bindings/js/JSWebSocketConstructor.h \ WebCore/bindings/js/JSWebSocketCustom.cpp \ WebCore/platform/network/SocketStreamErrorBase.cpp \ WebCore/platform/network/SocketStreamErrorBase.h \ @@ -3749,7 +3780,9 @@ webcore_sources += \ WebCore/websockets/WebSocketHandshake.cpp \ WebCore/websockets/WebSocketHandshake.h \ WebCore/websockets/WebSocketHandshakeRequest.cpp \ - WebCore/websockets/WebSocketHandshakeRequest.h + WebCore/websockets/WebSocketHandshakeRequest.h \ + WebCore/websockets/WebSocketHandshakeResponse.cpp \ + WebCore/websockets/WebSocketHandshakeResponse.h if ENABLE_WORKERS webcore_sources += \ diff --git a/WebCore/WebCore.Video.exp b/WebCore/WebCore.Video.exp index da79150..631a601 100644 --- a/WebCore/WebCore.Video.exp +++ b/WebCore/WebCore.Video.exp @@ -14,4 +14,5 @@ __ZNK7WebCore16HTMLMediaElement21processingUserGestureEv __ZNK7WebCore16HTMLMediaElement5mutedEv __ZNK7WebCore16HTMLMediaElement6volumeEv __ZNK7WebCore16HTMLMediaElement7canPlayEv +__ZNK7WebCore16HTMLMediaElement12playbackRateEv __ZNK7WebCore16HTMLMediaElement8durationEv diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp index 29704fb..b0b4d1b 100644 --- a/WebCore/WebCore.base.exp +++ b/WebCore/WebCore.base.exp @@ -248,8 +248,12 @@ __ZN7WebCore12IconDatabase4openERKNS_6StringE __ZN7WebCore12IconDatabase5closeEv __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE __ZN7WebCore12PluginWidget14invalidateRectERKNS_7IntRectE +__ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE +__ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi +__ZN7WebCore12PrintContext20pageAreaRectInPixelsEPNS_5FrameEi __ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE +__ZN7WebCore12PrintContext25preferredPageSizeInPixelsEPNS_5FrameEi __ZN7WebCore12PrintContext28computePageRectsWithPageSizeERKNS_9FloatSizeEb __ZN7WebCore12PrintContextC1EPNS_5FrameE __ZN7WebCore12PrintContextD1Ev @@ -267,8 +271,8 @@ __ZN7WebCore12TextIteratorC1EPKNS_5RangeENS_20TextIteratorBehaviorE __ZN7WebCore12WorkerThread17workerThreadCountEv __ZN7WebCore12applyCommandEN3WTF10PassRefPtrINS_11EditCommandEEE __ZN7WebCore12cacheStorageEv -__ZN7WebCore12createMarkupEPKNS_4NodeENS_13EChildrenOnlyEPN3WTF6VectorIPS0_Lm0EEE -__ZN7WebCore12createMarkupEPKNS_5RangeEPN3WTF6VectorIPNS_4NodeELm0EEENS_23EAnnotateForInterchangeEb +__ZN7WebCore12createMarkupEPKNS_4NodeENS_13EChildrenOnlyEPN3WTF6VectorIPS0_Lm0EEENS_13EAbsoluteURLsE +__ZN7WebCore12createMarkupEPKNS_5RangeEPN3WTF6VectorIPNS_4NodeELm0EEENS_23EAnnotateForInterchangeEbNS_13EAbsoluteURLsE __ZN7WebCore12gcControllerEv __ZN7WebCore12iconDatabaseEv __ZN7WebCore13AXObjectCache11getOrCreateEPNS_12RenderObjectE @@ -373,6 +377,7 @@ __ZN7WebCore15StringTruncator5widthERKNS_6StringERKNS_4FontEb __ZN7WebCore15VisiblePositionC1EPNS_4NodeEiNS_9EAffinityE __ZN7WebCore15VisiblePositionC1ERKNS_8PositionENS_9EAffinityE __ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE +__ZN7WebCore16AbstractDatabase14setIsAvailableEb __ZN7WebCore16FontFallbackList15releaseFontDataEv __ZN7WebCore16FontPlatformDataC1EP6NSFontbb __ZN7WebCore16FontPlatformDataD1Ev @@ -447,6 +452,7 @@ __ZN7WebCore21findEventWithKeyStateEPNS_5EventE __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE __ZN7WebCore21mainThreadNormalWorldEv __ZN7WebCore21reportThreadViolationEPKcNS_20ThreadViolationRoundE +__ZN7WebCore21setPlatformStrategiesEPNS_18PlatformStrategiesE __ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv __ZN7WebCore22applicationIsAppleMailEv __ZN7WebCore22counterValueForElementEPNS_7ElementE @@ -504,6 +510,7 @@ __ZN7WebCore4KURLC1ERKS0_RKNS_6StringE __ZN7WebCore4Node17stopIgnoringLeaksEv __ZN7WebCore4Node18startIgnoringLeaksEv __ZN7WebCore4Node19setNeedsStyleRecalcENS_15StyleChangeTypeE +__ZN7WebCore4Node10renderRectEPb __ZN7WebCore4Page12setGroupNameERKNS_6StringE __ZN7WebCore4Page13didStopPluginEPNS_14HaltablePluginE __ZN7WebCore4Page14didStartPluginEPNS_14HaltablePluginE @@ -544,8 +551,8 @@ __ZN7WebCore5Frame24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10Edit __ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE __ZN7WebCore5Frame28searchForLabelsBeforeElementEP7NSArrayPNS_7ElementEPmPb __ZN7WebCore5Frame34setMarkedTextMatchesAreHighlightedEb +__ZN7WebCore5Frame6createEPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE __ZN7WebCore5Frame7setViewEN3WTF10PassRefPtrINS_9FrameViewEEE -__ZN7WebCore5FrameC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE __ZN7WebCore5FrameD1Ev __ZN7WebCore5Image12supportsTypeERKNS_6StringE __ZN7WebCore5Image20loadPlatformResourceEPKc @@ -615,16 +622,18 @@ __ZN7WebCore7IntRectC1ERKNS_9FloatRectE __ZN7WebCore7IntSizeC1ERK7_NSSize __ZN7WebCore7cookiesEPKNS_8DocumentERKNS_4KURLE __ZN7WebCore7nsColorERKNS_5ColorE -__ZN7WebCore8Database14setIsAvailableEb __ZN7WebCore8Document11createRangeEv __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE __ZN7WebCore8Document13svgExtensionsEv __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE +__ZN7WebCore8Document16isPageBoxVisibleEi __ZN7WebCore8Document17getFocusableNodesERN3WTF6VectorINS1_6RefPtrINS_4NodeEEELm0EEE __ZN7WebCore8Document19accessSVGExtensionsEv +__ZN7WebCore8Document20pageAreaRectInPixelsEi __ZN7WebCore8Document22createDocumentFragmentEv __ZN7WebCore8Document23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE __ZN7WebCore8Document24setShouldCreateRenderersEb +__ZN7WebCore8Document25preferredPageSizeInPixelsEi __ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv __ZN7WebCore8Document4headEv __ZN7WebCore8FormDataD1Ev @@ -794,8 +803,6 @@ __ZNK7WebCore10ScrollView18visibleContentRectEb __ZNK7WebCore11CachedImage5imageEv __ZNK7WebCore11FrameLoader10isCompleteEv __ZNK7WebCore11FrameLoader14frameHasLoadedEv -__ZNK7WebCore11FrameLoader15containsPluginsEv -__ZNK7WebCore11FrameLoader15firstLayoutDoneEv __ZNK7WebCore11FrameLoader16outgoingReferrerEv __ZNK7WebCore11FrameLoader20activeDocumentLoaderEv __ZNK7WebCore11FrameLoader27numPendingOrLoadingRequestsEb @@ -894,6 +901,8 @@ __ZNK7WebCore20ResourceResponseBase16textEncodingNameEv __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv __ZNK7WebCore20ResourceResponseBase3urlEv __ZNK7WebCore20ResourceResponseBase8mimeTypeEv +__ZNK7WebCore23FrameLoaderStateMachine15firstLayoutDoneEv +__ZNK7WebCore23FrameLoaderStateMachine23committingFirstRealLoadEv __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv __ZNK7WebCore4Font10floatWidthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE __ZNK7WebCore4Font8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEii @@ -1019,6 +1028,7 @@ _wkGetFontInLanguageForCharacter _wkGetFontInLanguageForRange _wkGetGlyphTransformedAdvances _wkGetGlyphsForCharacters +_wkGetHyphenationLocationBeforeIndex _wkGetMIMETypeForExtension _wkGetNSURLResponseCalculatedExpiration _wkGetNSURLResponseLastModifiedDate @@ -1055,4 +1065,3 @@ _wkSetUpFontCache _wkSignalCFReadStreamEnd _wkSignalCFReadStreamError _wkSignalCFReadStreamHasBytes - diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index 16f19d9..4c193cc 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -726,7 +726,7 @@ '<@(webcore_files)', # For WebCoreSystemInterface, Mac-only. - '../../WebKit/mac/WebCoreSupport/WebSystemInterface.m', + '../../WebKit/mac/WebCoreSupport/WebSystemInterface.mm', ], 'sources/': [ # Exclude JSC custom bindings. @@ -896,6 +896,11 @@ ['exclude', 'rendering/SVG'], ], }], + ['use_accelerated_compositing==1', { + 'dependencies': [ + '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib', + ], + }], ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', @@ -1016,7 +1021,7 @@ # Use USE_NEW_THEME on Mac. ['include', 'platform/Theme\\.cpp$'], - ['include', 'WebKit/mac/WebCoreSupport/WebSystemInterface\\.m$'], + ['include', 'WebKit/mac/WebCoreSupport/WebSystemInterface\\.mm$'], ], 'sources!': [ # The Mac uses platform/mac/KillRingMac.mm instead of the dummy diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index f03613a..4887033 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -83,6 +83,7 @@ 'dom/WebKitTransitionEvent.idl', 'dom/WheelEvent.idl', 'html/Blob.idl', + 'html/BlobBuilder.idl', 'html/canvas/WebGLActiveInfo.idl', 'html/canvas/ArrayBufferView.idl', 'html/canvas/ArrayBuffer.idl', @@ -238,6 +239,7 @@ 'storage/IDBSuccessEvent.idl', 'storage/IndexedDatabaseRequest.idl', 'storage/SQLError.idl', + 'storage/SQLException.idl', 'storage/SQLResultSet.idl', 'storage/SQLResultSetRowList.idl', 'storage/SQLStatementCallback.idl', @@ -549,6 +551,7 @@ 'bindings/js/JSEventCustom.cpp', 'bindings/js/JSEventListener.cpp', 'bindings/js/JSEventListener.h', + 'bindings/js/JSEventSourceCustom.cpp', 'bindings/js/JSEventTarget.cpp', 'bindings/js/JSEventTarget.h', 'bindings/js/JSExceptionBase.cpp', @@ -589,8 +592,6 @@ 'bindings/js/JSLocationCustom.h', 'bindings/js/JSMainThreadExecState.cpp', 'bindings/js/JSMainThreadExecState.h', - 'bindings/js/JSMessageChannelConstructor.cpp', - 'bindings/js/JSMessageChannelConstructor.h', 'bindings/js/JSMessageChannelCustom.cpp', 'bindings/js/JSMessageEventCustom.cpp', 'bindings/js/JSMessagePortCustom.cpp', @@ -615,8 +616,6 @@ 'bindings/js/JSPluginElementFunctions.h', 'bindings/js/JSRGBColor.cpp', 'bindings/js/JSRGBColor.h', - 'bindings/js/JSSharedWorkerConstructor.cpp', - 'bindings/js/JSSharedWorkerConstructor.h', 'bindings/js/JSSharedWorkerCustom.cpp', 'bindings/js/JSScriptProfileNodeCustom.cpp', 'bindings/js/JSSQLResultSetRowListCustom.cpp', @@ -636,15 +635,9 @@ 'bindings/js/JSSVGPODTypeWrapper.h', 'bindings/js/JSTextCustom.cpp', 'bindings/js/JSTreeWalkerCustom.cpp', - 'bindings/js/JSWebKitCSSMatrixConstructor.cpp', - 'bindings/js/JSWebKitCSSMatrixConstructor.h', - 'bindings/js/JSWebKitPointConstructor.cpp', - 'bindings/js/JSWebKitPointConstructor.h', - 'bindings/js/JSWebSocketConstructor.cpp', - 'bindings/js/JSWebSocketConsuructor.h', + 'bindings/js/JSWebKitCSSMatrixCustom.cpp', + 'bindings/js/JSWebKitPointCustom.cpp', 'bindings/js/JSWebSocketCustom.cpp', - 'bindings/js/JSWorkerConstructor.cpp', - 'bindings/js/JSWorkerConstructor.h', 'bindings/js/JSWorkerContextBase.cpp', 'bindings/js/JSWorkerContextBase.h', 'bindings/js/JSWorkerContextCustom.cpp', @@ -653,8 +646,6 @@ 'bindings/js/JSWorkerCustom.cpp', 'bindings/js/JSXMLHttpRequestCustom.cpp', 'bindings/js/JSXMLHttpRequestUploadCustom.cpp', - 'bindings/js/JSXSLTProcessorConstructor.cpp', - 'bindings/js/JSXSLTProcessorConstructor.h', 'bindings/js/JSXSLTProcessorCustom.cpp', 'bindings/js/JavaScriptCallFrame.cpp', 'bindings/js/JavaScriptCallFrame.h', @@ -1146,6 +1137,7 @@ 'dom/ExceptionBase.h', 'dom/ExceptionCode.cpp', 'dom/ExceptionCode.h', + 'dom/FragmentScriptingPermission.h', 'dom/InputElement.cpp', 'dom/InputElement.h', 'dom/KeyboardEvent.cpp', @@ -1207,6 +1199,7 @@ 'dom/Range.h', 'dom/RangeBoundaryPoint.h', 'dom/RangeException.h', + 'dom/RawDataDocumentParser.h', 'dom/RegisteredEventListener.cpp', 'dom/RegisteredEventListener.h', 'dom/ScriptElement.cpp', @@ -1389,6 +1382,8 @@ 'html/AsyncImageResizer.h', 'html/Blob.cpp', 'html/Blob.h', + 'html/BlobBuilder.cpp', + 'html/BlobBuilder.h', 'html/canvas/ArrayBufferView.cpp', 'html/canvas/ArrayBufferView.h', 'html/canvas/ArrayBuffer.cpp', @@ -1448,6 +1443,8 @@ 'html/CollectionCache.cpp', 'html/CollectionCache.h', 'html/CollectionType.h', + 'html/CSSPreloadScanner.cpp', + 'html/CSSPreloadScanner.h', 'html/DataGridColumn.cpp', 'html/DataGridColumn.h', 'html/DOMDataGridDataSource.cpp', @@ -1475,16 +1472,18 @@ 'html/FileThreadTask.h', 'html/FormDataList.cpp', 'html/FormDataList.h', - 'html/HTML5EntityParser.cpp', - 'html/HTML5EntityParser.h', - 'html/HTML5Lexer.cpp', - 'html/HTML5Lexer.h', - 'html/HTML5DocumentParser.cpp', - 'html/HTML5DocumentParser.h', - 'html/HTML5TreeBuilder.cpp', - 'html/HTML5TreeBuilder.h', - 'html/HTML5ScriptRunner.cpp', - 'html/HTML5ScriptRunner.h', + 'html/HTMLEntityParser.cpp', + 'html/HTMLEntityParser.h', + 'html/HTMLTokenizer.cpp', + 'html/HTMLTokenizer.h', + 'html/HTMLDocumentParser.cpp', + 'html/HTMLDocumentParser.h', + 'html/HTMLPreloadScanner.cpp', + 'html/HTMLPreloadScanner.h', + 'html/HTMLScriptRunner.cpp', + 'html/HTMLScriptRunner.h', + 'html/HTMLTreeBuilder.cpp', + 'html/HTMLTreeBuilder.h', 'html/HTMLAllCollection.cpp', 'html/HTMLAllCollection.h', 'html/HTMLAnchorElement.cpp', @@ -1567,6 +1566,7 @@ 'html/HTMLImageLoader.h', 'html/HTMLInputElement.cpp', 'html/HTMLInputElement.h', + 'html/HTMLInputStream.h', 'html/HTMLIsIndexElement.cpp', 'html/HTMLIsIndexElement.h', 'html/HTMLKeygenElement.cpp', @@ -1609,10 +1609,12 @@ 'html/HTMLParagraphElement.h', 'html/HTMLParamElement.cpp', 'html/HTMLParamElement.h', - 'html/LegacyHTMLTreeConstructor.cpp', - 'html/LegacyHTMLTreeConstructor.h', + 'html/LegacyHTMLTreeBuilder.cpp', + 'html/LegacyHTMLTreeBuilder.h', 'html/HTMLParserErrorCodes.cpp', 'html/HTMLParserErrorCodes.h', + 'html/HTMLParserScheduler.cpp', + 'html/HTMLParserScheduler.h', 'html/HTMLPlugInElement.cpp', 'html/HTMLPlugInElement.h', 'html/HTMLPlugInImageElement.cpp', @@ -1651,8 +1653,8 @@ 'html/HTMLTextAreaElement.h', 'html/HTMLTitleElement.cpp', 'html/HTMLTitleElement.h', - 'html/HTMLDocumentParser.cpp', - 'html/HTMLDocumentParser.h', + 'html/LegacyHTMLDocumentParser.cpp', + 'html/LegacyHTMLDocumentParser.h', 'html/HTMLUListElement.cpp', 'html/HTMLUListElement.h', 'html/HTMLVideoElement.cpp', @@ -1666,8 +1668,8 @@ 'html/LabelsNodeList.cpp', 'html/LabelsNodeList.h', 'html/MediaError.h', - 'html/PreloadScanner.cpp', - 'html/PreloadScanner.h', + 'html/LegacyPreloadScanner.cpp', + 'html/LegacyPreloadScanner.h', 'html/StepRange.cpp', 'html/StepRange.h', 'html/TextMetrics.h', @@ -1707,6 +1709,7 @@ 'inspector/InspectorValues.cpp', 'inspector/InspectorValues.h', 'inspector/InspectorWorkerResource.h', + 'inspector/ScriptBreakpoint.cpp', 'inspector/ScriptBreakpoint.h', 'inspector/ScriptDebugListener.h', 'inspector/ScriptGCEventListener.h', @@ -1796,9 +1799,13 @@ 'loader/FTPDirectoryParser.h', 'loader/FormState.cpp', 'loader/FormState.h', + 'loader/FormSubmission.cpp', + 'loader/FormSubmission.h', 'loader/FrameLoader.cpp', 'loader/FrameLoader.h', 'loader/FrameLoaderClient.h', + 'loader/FrameLoaderStateMachine.cpp', + 'loader/FrameLoaderStateMachine.h', 'loader/FrameLoaderTypes.h', 'loader/HistoryController.cpp', 'loader/HistoryController.h', @@ -1834,6 +1841,8 @@ 'loader/ResourceLoadNotifier.h', 'loader/SinkDocument.cpp', 'loader/SinkDocument.h', + 'loader/SubframeLoader.cpp', + 'loader/SubframeLoader.h', 'loader/SubresourceLoader.cpp', 'loader/SubresourceLoader.h', 'loader/SubresourceLoaderClient.h', @@ -2127,6 +2136,8 @@ 'platform/graphics/chromium/IconChromiumWin.cpp', 'platform/graphics/chromium/ImageBufferData.h', 'platform/graphics/chromium/ImageChromiumMac.mm', + 'platform/graphics/chromium/ImageLayerChromium.cpp', + 'platform/graphics/chromium/ImageLayerChromium.h', 'platform/graphics/chromium/LayerChromium.cpp', 'platform/graphics/chromium/LayerChromium.h', 'platform/graphics/chromium/LayerRendererChromium.cpp', @@ -2135,12 +2146,16 @@ 'platform/graphics/chromium/PlatformIcon.h', 'platform/graphics/chromium/SimpleFontDataChromiumWin.cpp', 'platform/graphics/chromium/SimpleFontDataLinux.cpp', + 'platform/graphics/chromium/TransformLayerChromium.cpp', + 'platform/graphics/chromium/TransformLayerChromium.h', 'platform/graphics/chromium/TransparencyWin.cpp', 'platform/graphics/chromium/TransparencyWin.h', 'platform/graphics/chromium/UniscribeHelper.cpp', 'platform/graphics/chromium/UniscribeHelper.h', 'platform/graphics/chromium/UniscribeHelperTextRun.cpp', 'platform/graphics/chromium/UniscribeHelperTextRun.h', + 'platform/graphics/chromium/WebGLLayerChromium.cpp', + 'platform/graphics/chromium/WebGLLayerChromium.h', 'platform/graphics/filters/FEBlend.cpp', 'platform/graphics/filters/FEBlend.h', 'platform/graphics/filters/FEColorMatrix.cpp', @@ -2763,6 +2778,8 @@ 'platform/text/BidiContext.h', 'platform/text/BidiResolver.h', 'platform/text/CharacterNames.h', + 'platform/text/Hyphenation.cpp', + 'platform/text/Hyphenation.h', 'platform/text/ParserUtilities.h', 'platform/text/PlatformString.h', 'platform/text/RegularExpression.cpp', @@ -3159,6 +3176,8 @@ 'rendering/RenderImage.h', 'rendering/RenderImageGeneratedContent.cpp', 'rendering/RenderImageGeneratedContent.h', + 'rendering/RenderIndicator.cpp', + 'rendering/RenderIndicator.h', 'rendering/RenderInline.cpp', 'rendering/RenderInline.h', 'rendering/RenderLayer.cpp', @@ -3337,9 +3356,12 @@ 'rendering/SVGRootInlineBox.h', 'rendering/SVGShadowTreeElements.cpp', 'rendering/SVGShadowTreeElements.h', + 'rendering/SVGTextChunkLayoutInfo.cpp', 'rendering/SVGTextChunkLayoutInfo.h', 'rendering/SVGTextLayoutUtilities.cpp', 'rendering/SVGTextLayoutUtilities.h', + 'rendering/SVGTextQuery.cpp', + 'rendering/SVGTextQuery.h', 'rendering/TableLayout.h', 'rendering/TextControlInnerElements.cpp', 'rendering/TextControlInnerElements.h', @@ -3417,6 +3439,7 @@ 'storage/OriginUsageRecord.cpp', 'storage/OriginUsageRecord.h', 'storage/SQLError.h', + 'storage/SQLException.h', 'storage/SQLResultSet.cpp', 'storage/SQLResultSet.h', 'storage/SQLResultSetRowList.cpp', @@ -3789,6 +3812,8 @@ 'websockets/WebSocketHandshake.h', 'websockets/WebSocketHandshakeRequest.cpp', 'websockets/WebSocketHandshakeRequest.h', + 'websockets/WebSocketHandshakeResponse.cpp', + 'websockets/WebSocketHandshakeResponse.h', 'websockets/WorkerThreadableWebSocketChannel.cpp', 'websockets/WorkerThreadableWebSocketChannel.h', 'workers/AbstractWorker.cpp', @@ -3901,6 +3926,7 @@ 'inspector/front-end/ConsoleView.js', 'inspector/front-end/ContextMenu.js', 'inspector/front-end/CookieItemsView.js', + 'inspector/front-end/CSSCompletions.js', 'inspector/front-end/CSSStyleModel.js', 'inspector/front-end/Database.js', 'inspector/front-end/DatabaseQueryView.js', diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index f4abc27..66e77ca 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -1,3 +1,6 @@ + +include(../common.pri) + CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/generated } else { @@ -66,6 +69,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_BLOB_SLICE=.): DEFINES += ENABLE_BLOB_SLICE=0 !contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1 !contains(DEFINES, ENABLE_IMAGE_RESIZER=.): DEFINES += ENABLE_IMAGE_RESIZER=0 +!contains(DEFINES, ENABLE_INPUT_SPEECH=.): DEFINES += ENABLE_INPUT_SPEECH=0 greaterThan(QT_MINOR_VERSION, 5) { !contains(DEFINES, ENABLE_3D_RENDERING=.): DEFINES += ENABLE_3D_RENDERING=1 @@ -316,6 +320,7 @@ IDL_BINDINGS += \ dom/WebKitTransitionEvent.idl \ dom/WheelEvent.idl \ html/Blob.idl \ + html/BlobBuilder.idl \ html/canvas/ArrayBufferView.idl \ html/canvas/ArrayBuffer.idl \ html/canvas/Int8Array.idl \ @@ -471,6 +476,7 @@ IDL_BINDINGS += \ storage/Storage.idl \ storage/StorageEvent.idl \ storage/SQLError.idl \ + storage/SQLException.idl \ storage/SQLResultSet.idl \ storage/SQLResultSetRowList.idl \ storage/SQLStatementCallback.idl \ diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index eb77370..68a5527 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -25,6 +25,13 @@ symbian: { webkitbackup.sources = ../WebKit/qt/symbian/backup_registration.xml webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + contains(QT_CONFIG, declarative) { + declarativeImport.sources = qmlwebkitplugin$${QT_LIBINFIX}.dll + declarativeImport.sources += ../WebKit/qt/declarative/qmldir + declarativeImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit + DEPLOYMENT += declarativeImport + } + DEPLOYMENT += webkitlibs webkitbackup # Need to guarantee that these come before system includes of /epoc32/include @@ -100,7 +107,7 @@ win32-msvc2005|win32-msvc2008:{ } # Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC -win32-g++ { +win32-g++* { TMPPATH = $$quote($$(INCLUDE)) QMAKE_INCDIR_POST += $$split(TMPPATH,";") TMPPATH = $$quote($$(LIB)) @@ -298,7 +305,7 @@ SOURCES += \ bindings/js/JSDOMWrapper.cpp \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ - bindings/js/JSEventSourceConstructor.cpp \ + bindings/js/JSEventSourceCustom.cpp \ bindings/js/JSEventTarget.cpp \ bindings/js/JSExceptionBase.cpp \ bindings/js/JSGeolocationCustom.cpp \ @@ -337,13 +344,12 @@ SOURCES += \ bindings/js/JSStyleSheetListCustom.cpp \ bindings/js/JSTextCustom.cpp \ bindings/js/JSTreeWalkerCustom.cpp \ - bindings/js/JSWebKitCSSMatrixConstructor.cpp \ - bindings/js/JSWebKitPointConstructor.cpp \ + bindings/js/JSWebKitCSSMatrixCustom.cpp \ + bindings/js/JSWebKitPointCustom.cpp \ bindings/js/JSXMLHttpRequestCustom.cpp \ bindings/js/JSXMLHttpRequestUploadCustom.cpp \ bindings/js/JSPluginCustom.cpp \ bindings/js/JSPluginArrayCustom.cpp \ - bindings/js/JSMessageChannelConstructor.cpp \ bindings/js/JSMessageChannelCustom.cpp \ bindings/js/JSMessageEventCustom.cpp \ bindings/js/JSMessagePortCustom.cpp \ @@ -501,6 +507,7 @@ SOURCES += \ dom/Notation.cpp \ dom/OptionGroupElement.cpp \ dom/OptionElement.cpp \ + dom/StaticHashSetNodeList.cpp \ dom/OverflowEvent.cpp \ dom/PageTransitionEvent.cpp \ dom/PopStateEvent.cpp \ @@ -510,6 +517,7 @@ SOURCES += \ dom/ProgressEvent.cpp \ dom/QualifiedName.cpp \ dom/Range.cpp \ + dom/RawDataDocumentParser.h \ dom/RegisteredEventListener.cpp \ dom/ScriptElement.cpp \ dom/ScriptExecutionContext.cpp \ @@ -591,6 +599,7 @@ SOURCES += \ history/PageCache.cpp \ html/AsyncImageResizer.cpp \ html/Blob.cpp \ + html/BlobBuilder.cpp \ html/canvas/CanvasGradient.cpp \ html/canvas/CanvasPattern.cpp \ html/canvas/CanvasPixelArray.cpp \ @@ -598,6 +607,7 @@ SOURCES += \ html/canvas/CanvasRenderingContext2D.cpp \ html/canvas/CanvasStyle.cpp \ html/CollectionCache.cpp \ + html/CSSPreloadScanner.cpp \ html/DataGridColumn.cpp \ html/DataGridColumnList.cpp \ html/DateComponents.cpp \ @@ -610,11 +620,12 @@ SOURCES += \ html/FileStreamProxy.cpp \ html/FileThread.cpp \ html/FormDataList.cpp \ - html/HTML5EntityParser.cpp \ - html/HTML5Lexer.cpp \ - html/HTML5DocumentParser.cpp \ - html/HTML5TreeBuilder.cpp \ - html/HTML5ScriptRunner.cpp \ + html/HTMLEntityParser.cpp \ + html/HTMLTokenizer.cpp \ + html/HTMLDocumentParser.cpp \ + html/HTMLPreloadScanner.cpp \ + html/HTMLScriptRunner.cpp \ + html/HTMLTreeBuilder.cpp \ html/HTMLAllCollection.cpp \ html/HTMLAnchorElement.cpp \ html/HTMLAppletElement.cpp \ @@ -675,8 +686,9 @@ SOURCES += \ html/HTMLOptionsCollection.cpp \ html/HTMLParagraphElement.cpp \ html/HTMLParamElement.cpp \ - html/LegacyHTMLTreeConstructor.cpp \ + html/LegacyHTMLTreeBuilder.cpp \ html/HTMLParserErrorCodes.cpp \ + html/HTMLParserScheduler.cpp \ html/HTMLPlugInElement.cpp \ html/HTMLPlugInImageElement.cpp \ html/HTMLPreElement.cpp \ @@ -695,13 +707,13 @@ SOURCES += \ html/HTMLTableSectionElement.cpp \ html/HTMLTextAreaElement.cpp \ html/HTMLTitleElement.cpp \ - html/HTMLDocumentParser.cpp \ + html/LegacyHTMLDocumentParser.cpp \ html/HTMLUListElement.cpp \ html/HTMLViewSourceDocument.cpp \ html/ImageData.cpp \ html/ImageResizerThread.cpp \ html/LabelsNodeList.cpp \ - html/PreloadScanner.cpp \ + html/LegacyPreloadScanner.cpp \ html/StepRange.cpp \ html/ValidityState.cpp \ inspector/ConsoleMessage.cpp \ @@ -719,6 +731,7 @@ SOURCES += \ inspector/InspectorResource.cpp \ inspector/InspectorTimelineAgent.cpp \ inspector/InspectorValues.cpp \ + inspector/ScriptBreakpoint.cpp \ inspector/TimelineRecordFactory.cpp \ loader/archive/ArchiveFactory.cpp \ loader/archive/ArchiveResource.cpp \ @@ -739,7 +752,9 @@ SOURCES += \ loader/DocumentThreadableLoader.cpp \ loader/DocumentWriter.cpp \ loader/FormState.cpp \ + loader/FormSubmission.cpp \ loader/FrameLoader.cpp \ + loader/FrameLoaderStateMachine.cpp \ loader/HistoryController.cpp \ loader/FTPDirectoryDocument.cpp \ loader/FTPDirectoryParser.cpp \ @@ -761,6 +776,7 @@ SOURCES += \ loader/ResourceLoader.cpp \ loader/ResourceLoadNotifier.cpp \ loader/SinkDocument.cpp \ + loader/SubframeLoader.cpp \ loader/SubresourceLoader.cpp \ loader/TextDocument.cpp \ loader/TextResourceDecoder.cpp \ @@ -821,6 +837,7 @@ SOURCES += \ platform/BlobItem.cpp \ platform/text/Base64.cpp \ platform/text/BidiContext.cpp \ + platform/text/Hyphenation.cpp \ platform/ContentType.cpp \ platform/ContextMenu.cpp \ platform/CrossThreadCopier.cpp \ @@ -947,6 +964,7 @@ SOURCES += \ rendering/RenderIFrame.cpp \ rendering/RenderImage.cpp \ rendering/RenderImageGeneratedContent.cpp \ + rendering/RenderIndicator.cpp \ rendering/RenderInline.cpp \ rendering/RenderLayer.cpp \ rendering/RenderLineBoxList.cpp \ @@ -1059,7 +1077,6 @@ HEADERS += \ bindings/js/JSDOMWindowShell.h \ bindings/js/JSDOMWrapper.h \ bindings/js/JSEventListener.h \ - bindings/js/JSEventSourceConstructor.h \ bindings/js/JSEventTarget.h \ bindings/js/JSHistoryCustom.h \ bindings/js/JSHTMLAppletElementCustom.h \ @@ -1070,19 +1087,13 @@ HEADERS += \ bindings/js/JSImageConstructor.h \ bindings/js/JSLazyEventListener.h \ bindings/js/JSLocationCustom.h \ - bindings/js/JSMessageChannelConstructor.h \ bindings/js/JSNodeCustom.h \ bindings/js/JSNodeFilterCondition.h \ bindings/js/JSOptionConstructor.h \ bindings/js/JSPluginElementFunctions.h \ - bindings/js/JSSharedWorkerConstructor.h \ bindings/js/JSStorageCustom.h \ - bindings/js/JSWebKitCSSMatrixConstructor.h \ - bindings/js/JSWebKitPointConstructor.h \ - bindings/js/JSWorkerConstructor.h \ bindings/js/JSWorkerContextBase.h \ bindings/js/JSWorkerContextErrorHandler.h \ - bindings/js/JSXSLTProcessorConstructor.h \ bindings/js/JavaScriptCallFrame.h \ bindings/js/ScheduledAction.h \ bindings/js/ScriptArray.h \ @@ -1222,6 +1233,7 @@ HEADERS += \ dom/EventTarget.h \ dom/ExceptionBase.h \ dom/ExceptionCode.h \ + dom/FragmentScriptingPermission.h \ dom/InputElement.h \ dom/KeyboardEvent.h \ dom/MessageChannel.h \ @@ -1240,6 +1252,7 @@ HEADERS += \ dom/Notation.h \ dom/OptionElement.h \ dom/OptionGroupElement.h \ + dom/StaticHashSetNodeList.h \ dom/OverflowEvent.h \ dom/PageTransitionEvent.h \ dom/Position.h \ @@ -1328,6 +1341,7 @@ HEADERS += \ history/PageCache.h \ html/AsyncImageResizer.h \ html/Blob.h \ + html/BlobBuilder.h \ html/canvas/CanvasGradient.h \ html/canvas/CanvasPattern.h \ html/canvas/CanvasPixelArray.h \ @@ -1413,7 +1427,7 @@ HEADERS += \ html/HTMLParagraphElement.h \ html/HTMLParamElement.h \ html/HTMLParserErrorCodes.h \ - html/LegacyHTMLTreeConstructor.h \ + html/LegacyHTMLTreeBuilder.h \ html/HTMLPlugInElement.h \ html/HTMLPlugInImageElement.h \ html/HTMLPreElement.h \ @@ -1433,14 +1447,14 @@ HEADERS += \ html/HTMLTableSectionElement.h \ html/HTMLTextAreaElement.h \ html/HTMLTitleElement.h \ - html/HTMLDocumentParser.h \ + html/LegacyHTMLDocumentParser.h \ html/HTMLUListElement.h \ html/HTMLVideoElement.h \ html/HTMLViewSourceDocument.h \ html/ImageData.h \ html/ImageResizerThread.h \ html/LabelsNodeList.h \ - html/PreloadScanner.h \ + html/LegacyPreloadScanner.h \ html/StepRange.h \ html/TimeRanges.h \ html/ValidityState.h \ @@ -1485,6 +1499,7 @@ HEADERS += \ loader/DocumentThreadableLoader.h \ loader/FormState.h \ loader/FrameLoader.h \ + loader/FrameLoaderStateMachine.h \ loader/FTPDirectoryDocument.h \ loader/FTPDirectoryParser.h \ loader/icon/IconDatabase.h \ @@ -1673,6 +1688,7 @@ HEADERS += \ platform/text/AtomicString.h \ platform/text/Base64.h \ platform/text/BidiContext.h \ + platform/text/Hyphenation.h \ platform/text/qt/TextCodecQt.h \ platform/text/RegularExpression.h \ platform/text/SegmentedString.h \ @@ -1736,6 +1752,7 @@ HEADERS += \ rendering/RenderIFrame.h \ rendering/RenderImageGeneratedContent.h \ rendering/RenderImage.h \ + rendering/RenderIndicator.h \ rendering/RenderInline.h \ rendering/RenderLayer.h \ rendering/RenderLineBoxList.h \ @@ -1843,6 +1860,7 @@ HEADERS += \ rendering/SVGShadowTreeElements.h \ rendering/SVGTextChunkLayoutInfo.h \ rendering/SVGTextLayoutUtilities.h \ + rendering/SVGTextQuery.h \ rendering/TextControlInnerElements.h \ rendering/TransformState.h \ svg/animation/SMILTimeContainer.h \ @@ -2180,6 +2198,7 @@ SOURCES += \ ../WebKit/qt/Api/qwebplugindatabase.cpp \ ../WebKit/qt/Api/qwebpluginfactory.cpp \ ../WebKit/qt/Api/qwebsecurityorigin.cpp \ + ../WebKit/qt/Api/qwebscriptworld.cpp \ ../WebKit/qt/Api/qwebdatabase.cpp \ ../WebKit/qt/Api/qwebinspector.cpp \ ../WebKit/qt/Api/qwebkitversion.cpp @@ -2451,7 +2470,6 @@ contains(DEFINES, ENABLE_ICONDATABASE=1) { contains(DEFINES, ENABLE_WORKERS=1) { SOURCES += \ bindings/js/JSDedicatedWorkerContextCustom.cpp \ - bindings/js/JSWorkerConstructor.cpp \ bindings/js/JSWorkerContextBase.cpp \ bindings/js/JSWorkerContextCustom.cpp \ bindings/js/JSWorkerCustom.cpp \ @@ -2472,7 +2490,6 @@ contains(DEFINES, ENABLE_WORKERS=1) { contains(DEFINES, ENABLE_SHARED_WORKERS=1) { SOURCES += \ - bindings/js/JSSharedWorkerConstructor.cpp \ bindings/js/JSSharedWorkerCustom.cpp \ workers/DefaultSharedWorkerRepository.cpp \ workers/SharedWorker.cpp \ @@ -2546,7 +2563,6 @@ contains(DEFINES, ENABLE_XSLT=1) { tobe|!tobe: QT += xmlpatterns SOURCES += \ - bindings/js/JSXSLTProcessorConstructor.cpp \ bindings/js/JSXSLTProcessorCustom.cpp \ dom/TransformSourceQt.cpp \ xml/XSLStyleSheetQt.cpp \ @@ -2853,7 +2869,9 @@ contains(DEFINES, ENABLE_SVG=1) { rendering/SVGRenderSupport.cpp \ rendering/SVGRootInlineBox.cpp \ rendering/SVGShadowTreeElements.cpp \ - rendering/SVGTextLayoutUtilities.cpp + rendering/SVGTextChunkLayoutInfo.cpp \ + rendering/SVGTextLayoutUtilities.cpp \ + rendering/SVGTextQuery.cpp } contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=1) { @@ -2884,6 +2902,7 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1) { websockets/WebSocketChannelClient.h \ websockets/WebSocketHandshake.h \ websockets/WebSocketHandshakeRequest.h \ + websockets/WebSocketHandshakeResponse.h \ platform/network/qt/SocketStreamHandlePrivate.h SOURCES += \ @@ -2891,12 +2910,12 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1) { websockets/WebSocketChannel.cpp \ websockets/WebSocketHandshake.cpp \ websockets/WebSocketHandshakeRequest.cpp \ + websockets/WebSocketHandshakeResponse.cpp \ websockets/ThreadableWebSocketChannel.cpp \ platform/network/SocketStreamErrorBase.cpp \ platform/network/SocketStreamHandleBase.cpp \ platform/network/qt/SocketStreamHandleQt.cpp \ - bindings/js/JSWebSocketCustom.cpp \ - bindings/js/JSWebSocketConstructor.cpp + bindings/js/JSWebSocketCustom.cpp contains(DEFINES, ENABLE_WORKERS=1) { HEADERS += \ @@ -2910,80 +2929,65 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1) { contains(DEFINES, ENABLE_3D_CANVAS=1) { tobe|!tobe: QT += opengl HEADERS += \ - bindings/js/JSArrayBufferConstructor.h \ - bindings/js/JSArrayBufferViewHelper.h \ - bindings/js/JSInt8ArrayConstructor.h \ - bindings/js/JSFloat32ArrayConstructor.h \ - bindings/js/JSInt32ArrayConstructor.h \ - bindings/js/JSInt16ArrayConstructor.h \ - bindings/js/JSUint8ArrayConstructor.h \ - bindings/js/JSUint32ArrayConstructor.h \ - bindings/js/JSUint16ArrayConstructor.h \ - html/canvas/CanvasContextAttributes.h \ - html/canvas/CanvasObject.h \ - html/canvas/WebGLActiveInfo.h \ - html/canvas/ArrayBuffer.h \ - html/canvas/ArrayBufferView.h \ - html/canvas/WebGLBuffer.h \ - html/canvas/Int8Array.h \ - html/canvas/WebGLContextAttributes.h \ - html/canvas/Float32Array.h \ - html/canvas/WebGLFramebuffer.h \ - html/canvas/WebGLGetInfo.h \ - html/canvas/Int32Array.h \ - html/canvas/WebGLProgram.h \ - html/canvas/WebGLRenderbuffer.h \ - html/canvas/WebGLRenderingContext.h \ - html/canvas/WebGLShader.h \ - html/canvas/Int16Array.h \ - html/canvas/WebGLTexture.h \ - html/canvas/WebGLUniformLocation.h \ - html/canvas/Uint8Array.h \ - html/canvas/Uint32Array.h \ - html/canvas/Uint16Array.h \ - platform/graphics/GraphicsContext3D.h + bindings/js/JSArrayBufferViewHelper.h \ + html/canvas/CanvasContextAttributes.h \ + html/canvas/CanvasObject.h \ + html/canvas/WebGLActiveInfo.h \ + html/canvas/ArrayBuffer.h \ + html/canvas/ArrayBufferView.h \ + html/canvas/WebGLBuffer.h \ + html/canvas/Int8Array.h \ + html/canvas/WebGLContextAttributes.h \ + html/canvas/Float32Array.h \ + html/canvas/WebGLFramebuffer.h \ + html/canvas/WebGLGetInfo.h \ + html/canvas/Int32Array.h \ + html/canvas/WebGLProgram.h \ + html/canvas/WebGLRenderbuffer.h \ + html/canvas/WebGLRenderingContext.h \ + html/canvas/WebGLShader.h \ + html/canvas/Int16Array.h \ + html/canvas/WebGLTexture.h \ + html/canvas/WebGLUniformLocation.h \ + html/canvas/Uint8Array.h \ + html/canvas/Uint32Array.h \ + html/canvas/Uint16Array.h \ + platform/graphics/GraphicsContext3D.h SOURCES += \ - bindings/js/JSArrayBufferConstructor.cpp \ - bindings/js/JSArrayBufferViewCustom.cpp \ - bindings/js/JSInt8ArrayConstructor.cpp \ - bindings/js/JSInt8ArrayCustom.cpp \ - bindings/js/JSFloat32ArrayConstructor.cpp \ - bindings/js/JSFloat32ArrayCustom.cpp \ - bindings/js/JSInt32ArrayConstructor.cpp \ - bindings/js/JSInt32ArrayCustom.cpp \ - bindings/js/JSWebGLRenderingContextCustom.cpp \ - bindings/js/JSInt16ArrayConstructor.cpp \ - bindings/js/JSInt16ArrayCustom.cpp \ - bindings/js/JSUint8ArrayConstructor.cpp \ - bindings/js/JSUint8ArrayCustom.cpp \ - bindings/js/JSUint32ArrayConstructor.cpp \ - bindings/js/JSUint32ArrayCustom.cpp \ - bindings/js/JSUint16ArrayConstructor.cpp \ - bindings/js/JSUint16ArrayCustom.cpp \ - html/canvas/CanvasContextAttributes.cpp \ - html/canvas/CanvasObject.cpp \ - html/canvas/ArrayBuffer.cpp \ - html/canvas/ArrayBufferView.cpp \ - html/canvas/WebGLBuffer.cpp \ - html/canvas/Int8Array.cpp \ - html/canvas/WebGLContextAttributes.cpp \ - html/canvas/Float32Array.cpp \ - html/canvas/WebGLFramebuffer.cpp \ - html/canvas/WebGLGetInfo.cpp \ - html/canvas/Int32Array.cpp \ - html/canvas/WebGLProgram.cpp \ - html/canvas/WebGLRenderbuffer.cpp \ - html/canvas/WebGLRenderingContext.cpp \ - html/canvas/WebGLShader.cpp \ - html/canvas/Int16Array.cpp \ - html/canvas/WebGLTexture.cpp \ - html/canvas/WebGLUniformLocation.cpp \ - html/canvas/Uint8Array.cpp \ - html/canvas/Uint32Array.cpp \ - html/canvas/Uint16Array.cpp \ - platform/graphics/GraphicsContext3D.cpp \ - platform/graphics/qt/GraphicsContext3DQt.cpp \ + bindings/js/JSArrayBufferCustom.cpp \ + bindings/js/JSArrayBufferViewCustom.cpp \ + bindings/js/JSInt8ArrayCustom.cpp \ + bindings/js/JSFloat32ArrayCustom.cpp \ + bindings/js/JSInt32ArrayCustom.cpp \ + bindings/js/JSWebGLRenderingContextCustom.cpp \ + bindings/js/JSInt16ArrayCustom.cpp \ + bindings/js/JSUint8ArrayCustom.cpp \ + bindings/js/JSUint32ArrayCustom.cpp \ + bindings/js/JSUint16ArrayCustom.cpp \ + html/canvas/CanvasContextAttributes.cpp \ + html/canvas/CanvasObject.cpp \ + html/canvas/ArrayBuffer.cpp \ + html/canvas/ArrayBufferView.cpp \ + html/canvas/WebGLBuffer.cpp \ + html/canvas/Int8Array.cpp \ + html/canvas/WebGLContextAttributes.cpp \ + html/canvas/Float32Array.cpp \ + html/canvas/WebGLFramebuffer.cpp \ + html/canvas/WebGLGetInfo.cpp \ + html/canvas/Int32Array.cpp \ + html/canvas/WebGLProgram.cpp \ + html/canvas/WebGLRenderbuffer.cpp \ + html/canvas/WebGLRenderingContext.cpp \ + html/canvas/WebGLShader.cpp \ + html/canvas/Int16Array.cpp \ + html/canvas/WebGLTexture.cpp \ + html/canvas/WebGLUniformLocation.cpp \ + html/canvas/Uint8Array.cpp \ + html/canvas/Uint32Array.cpp \ + html/canvas/Uint16Array.cpp \ + platform/graphics/GraphicsContext3D.cpp \ + platform/graphics/qt/GraphicsContext3DQt.cpp \ } @@ -2998,12 +3002,7 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { include($$PWD/../WebKit/qt/Api/headers.pri) HEADERS += $$WEBKIT_API_HEADERS -CONFIG(QTDIR_build) { - modfile.files = $$moduleFile - modfile.path = $$[QMAKE_MKSPECS]/modules - - INSTALLS += modfile -} else { +!CONFIG(QTDIR_build) { exists($$OUTPUT_DIR/include/QtWebKit/classheaders.pri): include($$OUTPUT_DIR/include/QtWebKit/classheaders.pri) WEBKIT_INSTALL_HEADERS = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS @@ -3024,6 +3023,7 @@ CONFIG(QTDIR_build) { # INSTALLS is not implemented in qmake's s60 generators, copy headers manually inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} inst_headers.input = WEBKIT_INSTALL_HEADERS + inst_headers.CONFIG = no_clean !isEmpty(INSTALL_HEADERS): inst_headers.output = $$INSTALL_HEADERS/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} else: inst_headers.output = $$[QT_INSTALL_HEADERS]/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} @@ -3033,6 +3033,7 @@ CONFIG(QTDIR_build) { inst_modfile.commands = $$inst_headers.commands inst_modfile.input = moduleFile inst_modfile.output = $$[QMAKE_MKSPECS]/modules + inst_modfile.CONFIG = no_clean QMAKE_EXTRA_COMPILERS += inst_modfile @@ -3088,7 +3089,7 @@ CONFIG(QTDIR_build) { CONFIG += no_debug_info } -!win32-g++:win32:contains(QMAKE_HOST.arch, x86_64):{ +win32:!win32-g++*:contains(QMAKE_HOST.arch, x86_64):{ asm_compiler.commands = ml64 /c asm_compiler.commands += /Fo ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} asm_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} diff --git a/WebCore/WebCore.vcproj/WebCore.make b/WebCore/WebCore.vcproj/WebCore.make index afe6707..84b9661 100644 --- a/WebCore/WebCore.vcproj/WebCore.make +++ b/WebCore/WebCore.vcproj/WebCore.make @@ -17,3 +17,5 @@ install: xcopy "$(OBJROOT)\obj\WebCore\scripts\*" "$(DSTROOT)\AppleInternal\tools\scripts" /e/v/i/h/y xcopy "$(OBJROOT)\bin\*.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y xcopy "$(OBJROOT)\bin\*.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y + -mkdir "$(DSTROOT)\AppleInternal\Sources\WebCore" + xcopy "$(OBJROOT)\obj\WebCore\DerivedSources\*" "$(DSTROOT)\AppleInternal\Sources\WebCore" /e/v/i/h/y diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index e693884..ebd21a9 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -777,6 +777,14 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSBlobBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSBlobBuilder.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSCanvasGradient.cpp"
>
<FileConfiguration
@@ -21973,6 +21981,14 @@ >
</File>
<File
+ RelativePath="..\loader\FormSubmission.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\loader\FormSubmission.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\FrameLoader.cpp"
>
</File>
@@ -21985,6 +22001,14 @@ >
</File>
<File
+ RelativePath="..\loader\FrameLoaderStateMachine.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\loader\FrameLoaderStateMachine.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\FrameLoaderTypes.h"
>
</File>
@@ -22169,6 +22193,14 @@ >
</File>
<File
+ RelativePath="..\loader\SubframeLoader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\loader\SubframeLoader.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\SubresourceLoader.cpp"
>
</File>
@@ -26252,6 +26284,14 @@ >
</File>
<File
+ RelativePath="..\platform\text\Hyphenation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\text\Hyphenation.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\text\ParserUtilities.h"
>
</File>
@@ -28185,6 +28225,14 @@ >
</File>
<File
+ RelativePath="..\rendering\RenderIndicator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderIndicator.h"
+ >
+ </File>
+ <File
RelativePath="..\rendering\RenderInline.cpp"
>
</File>
@@ -28959,6 +29007,10 @@ >
</File>
<File
+ RelativePath="..\rendering\SVGTextChunkLayoutInfo.cpp"
+ >
+ </File>
+ <File
RelativePath="..\rendering\SVGTextChunkLayoutInfo.h"
>
</File>
@@ -28970,6 +29022,14 @@ RelativePath="..\rendering\SVGTextLayoutUtilities.h"
>
</File>
+ <File
+ RelativePath="..\rendering\SVGTextQuery.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\SVGTextQuery.h"
+ >
+ </File>
<File
RelativePath="..\rendering\TableLayout.h"
>
@@ -30145,6 +30205,14 @@ >
</File>
<File
+ RelativePath="..\dom\StaticHashSetNodeList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\StaticHashSetNodeList.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\StaticNodeList.cpp"
>
</File>
@@ -33141,6 +33209,14 @@ >
</File>
<File
+ RelativePath="..\html\BlobBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\BlobBuilder.h"
+ >
+ </File>
+ <File
RelativePath="..\html\canvas\CanvasGradient.cpp"
>
</File>
@@ -33208,6 +33284,14 @@ RelativePath="..\html\CollectionType.h"
>
</File>
+ <File
+ RelativePath="..\html\CSSPreloadScanner.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\CSSPreloadScanner.h"
+ >
+ </File>
<File
RelativePath="..\html\DataGridColumn.cpp"
>
@@ -33320,44 +33404,52 @@ RelativePath="..\html\FormDataList.h"
>
</File>
- <File
- RelativePath="..\html\HTML5DocumentParser.cpp"
+ <File
+ RelativePath="..\html\HTMLDocumentParser.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTMLDocumentParser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTMLEntityParser.cpp"
>
- </File>
- <File
- RelativePath="..\html\HTML5DocumentParser.h"
+ </File>
+ <File
+ RelativePath="..\html\HTMLEntityParser.h"
>
- </File>
- <File
- RelativePath="..\html\HTML5EntityParser.cpp"
+ </File>
+ <File
+ RelativePath="..\html\HTMLTokenizer.cpp"
>
</File>
<File
- RelativePath="..\html\HTML5EntityParser.h"
+ RelativePath="..\html\HTMLTokenizer.h"
>
</File>
<File
- RelativePath="..\html\HTML5Lexer.cpp"
+ RelativePath="..\html\HTMLPreloadScanner.cpp"
>
</File>
<File
- RelativePath="..\html\HTML5Lexer.h"
+ RelativePath="..\html\HTMLPreloadScanner.h"
>
</File>
<File
- RelativePath="..\html\HTML5ScriptRunner.cpp"
+ RelativePath="..\html\HTMLScriptRunner.cpp"
>
</File>
<File
- RelativePath="..\html\HTML5ScriptRunner.h"
+ RelativePath="..\html\HTMLScriptRunner.h"
>
</File>
<File
- RelativePath="..\html\HTML5TreeBuilder.cpp"
+ RelativePath="..\html\HTMLTreeBuilder.cpp"
>
</File>
<File
- RelativePath="..\html\HTML5TreeBuilder.h"
+ RelativePath="..\html\HTMLTreeBuilder.h"
>
</File>
<File
@@ -35372,6 +35464,10 @@ RelativePath="..\html\HTMLInputElement.h"
>
</File>
+ <File
+ RelativePath="..\html\HTMLInputStream.h"
+ >
+ </File>
<File
RelativePath="..\html\HTMLIsIndexElement.cpp"
>
@@ -36469,11 +36565,11 @@ >
</File>
<File
- RelativePath="..\html\LegacyHTMLTreeConstructor.cpp"
+ RelativePath="..\html\LegacyHTMLTreeBuilder.cpp"
>
</File>
<File
- RelativePath="..\html\LegacyHTMLTreeConstructor.h"
+ RelativePath="..\html\LegacyHTMLTreeBuilder.h"
>
</File>
<File
@@ -36481,6 +36577,14 @@ >
</File>
<File
+ RelativePath="..\html\HTMLParserScheduler.h"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTMLParserScheduler.cpp"
+ >
+ </File>
+ <File
RelativePath="..\html\HTMLParserErrorCodes.h"
>
</File>
@@ -37501,11 +37605,11 @@ >
</File>
<File
- RelativePath="..\html\HTMLDocumentParser.cpp"
+ RelativePath="..\html\LegacyHTMLDocumentParser.cpp"
>
</File>
<File
- RelativePath="..\html\HTMLDocumentParser.h"
+ RelativePath="..\html\LegacyHTMLDocumentParser.h"
>
</File>
<File
@@ -37657,11 +37761,11 @@ >
</File>
<File
- RelativePath="..\html\PreloadScanner.cpp"
+ RelativePath="..\html\LegacyPreloadScanner.cpp"
>
</File>
<File
- RelativePath="..\html\PreloadScanner.h"
+ RelativePath="..\html\LegacyPreloadScanner.h"
>
</File>
<File
@@ -39520,7 +39624,7 @@ >
</File>
<File
- RelativePath="..\bindings\js\JSEventSourceConstructor.cpp"
+ RelativePath="..\bindings\js\JSEventSourceCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -39572,10 +39676,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSEventSourceConstructor.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSEventTarget.cpp"
>
<FileConfiguration
@@ -40584,7 +40684,7 @@ >
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.cpp"
+ RelativePath="..\bindings\js\JSWebKitCSSMatrixCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40636,11 +40736,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSIDBAnyCustom.cpp"
+ RelativePath="..\bindings\js\JSWebKitPointCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40692,7 +40788,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40744,11 +40840,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseError.cpp"
+ RelativePath="..\bindings\js\JSIDBAnyCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40800,11 +40896,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseError.h"
- >
- </File>
- <File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseException.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40856,11 +40948,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseException.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseRequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseError.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40912,11 +41004,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseError.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBErrorEvent.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseException.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -40968,11 +41060,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBErrorEvent.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseException.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBEvent.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseRequest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41024,11 +41116,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBEvent.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseRequest.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBErrorEvent.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41080,7 +41172,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBErrorEvent.h"
>
</File>
<File
@@ -41192,11 +41284,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBEvent.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41248,11 +41340,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.h"
>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41304,11 +41396,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBObjectStoreRequest.h"
>
</File>
<File
- RelativePath="..\bindings\js\JSImageConstructor.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41360,11 +41452,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSImageConstructor.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.h"
>
</File>
<File
- RelativePath="..\bindings\js\JSImageDataCustom.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41416,7 +41508,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaserequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSImageConstructor.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41468,11 +41564,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaseRequest.h"
+ RelativePath="..\bindings\js\JSImageConstructor.h"
>
</File>
<File
- RelativePath="..\bindings\js\JSInjectedScriptHostCustom.cpp"
+ RelativePath="..\bindings\js\JSImageDataCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41524,7 +41620,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSInspectorFrontendHostCustom.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaserequest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41576,7 +41672,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSJavaScriptCallFrameCustom.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaseRequest.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSInjectedScriptHostCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41628,7 +41728,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSLazyEventListener.cpp"
+ RelativePath="..\bindings\js\JSInspectorFrontendHostCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41680,11 +41780,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSLazyEventListener.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSLocationCustom.cpp"
+ RelativePath="..\bindings\js\JSJavaScriptCallFrameCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41736,7 +41832,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSMainThreadExecState.cpp"
+ RelativePath="..\bindings\js\JSLazyEventListener.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41788,11 +41884,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSMainThreadExecState.h"
+ RelativePath="..\bindings\js\JSLazyEventListener.h"
>
</File>
<File
- RelativePath="..\bindings\js\JSMessageChannelConstructor.cpp"
+ RelativePath="..\bindings\js\JSLocationCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41844,11 +41940,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSMessageChannelConstructor.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSMessageChannelCustom.cpp"
+ RelativePath="..\bindings\js\JSMainThreadExecState.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41900,7 +41992,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSMessageEventCustom.cpp"
+ RelativePath="..\bindings\js\JSMainThreadExecState.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSMessageChannelCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -41952,7 +42048,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSMessagePortCustom.cpp"
+ RelativePath="..\bindings\js\JSMessageEventCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42004,11 +42100,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSMessagePortCustom.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSMimeTypeArrayCustom.cpp"
+ RelativePath="..\bindings\js\JSMessagePortCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42060,7 +42152,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNamedNodeMapCustom.cpp"
+ RelativePath="..\bindings\js\JSMessagePortCustom.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSMimeTypeArrayCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42112,7 +42208,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNavigatorCustom.cpp"
+ RelativePath="..\bindings\js\JSNamedNodeMapCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42164,7 +42260,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNodeCustom.cpp"
+ RelativePath="..\bindings\js\JSNavigatorCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42216,11 +42312,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNodeCustom.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSNodeFilterCondition.cpp"
+ RelativePath="..\bindings\js\JSNodeCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42272,11 +42364,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNodeFilterCondition.h"
+ RelativePath="..\bindings\js\JSNodeCustom.h"
>
</File>
<File
- RelativePath="..\bindings\js\JSNodeFilterCustom.cpp"
+ RelativePath="..\bindings\js\JSNodeFilterCondition.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42328,7 +42420,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNodeIteratorCustom.cpp"
+ RelativePath="..\bindings\js\JSNodeFilterCondition.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSNodeFilterCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42380,7 +42476,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSNodeListCustom.cpp"
+ RelativePath="..\bindings\js\JSNodeIteratorCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42432,7 +42528,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSOptionConstructor.cpp"
+ RelativePath="..\bindings\js\JSNodeListCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42484,11 +42580,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSOptionConstructor.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSPluginArrayCustom.cpp"
+ RelativePath="..\bindings\js\JSOptionConstructor.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42540,7 +42632,11 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSPluginCustom.cpp"
+ RelativePath="..\bindings\js\JSOptionConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSPluginArrayCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42592,7 +42688,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSPluginElementFunctions.cpp"
+ RelativePath="..\bindings\js\JSPluginCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42644,15 +42740,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSPluginElementFunctions.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSPopStateEventCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSScriptProfileNodeCustom.cpp"
+ RelativePath="..\bindings\js\JSPluginElementFunctions.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42704,7 +42792,15 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSSharedWorkerConstructor.cpp"
+ RelativePath="..\bindings\js\JSPluginElementFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSPopStateEventCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSScriptProfileNodeCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -42756,10 +42852,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSSharedWorkerConstructor.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSSharedWorkerCustom.cpp"
>
<FileConfiguration
@@ -43500,174 +43592,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSWebKitCSSMatrixConstructor.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSWebKitCSSMatrixConstructor.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSWebKitPointConstructor.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSWebKitPointConstructor.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSWebSocketConstructor.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSWebSocketConstructor.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSWebSocketCustom.cpp"
>
<FileConfiguration
@@ -43720,62 +43644,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSWorkerConstructor.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSWorkerConstructor.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSWorkerContextBase.cpp"
>
<FileConfiguration
@@ -44044,62 +43912,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSXSLTProcessorConstructor.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSXSLTProcessorConstructor.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSXSLTProcessorCustom.cpp"
>
<FileConfiguration
@@ -46697,6 +46509,10 @@ >
</File>
<File
+ RelativePath="..\storage\SQLException.h"
+ >
+ </File>
+ <File
RelativePath="..\storage\SQLResultSet.cpp"
>
</File>
@@ -47133,6 +46949,10 @@ >
</File>
<File
+ RelativePath="..\inspector\ScriptBreakpoint.cpp"
+ >
+ </File>
+ <File
RelativePath="..\inspector\ScriptBreakpoint.h"
>
</File>
@@ -47937,6 +47757,14 @@ >
</File>
<File
+ RelativePath="..\websockets\WebSocketHandshakeResponse.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\websockets\WebSocketHandshakeResponse.h"
+ >
+ </File>
+ <File
RelativePath="..\websockets\WorkerThreadableWebSocketChannel.cpp"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 8d6bb96..4aa4577 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -90,6 +90,9 @@ 084D2834110A7FCB0038239A /* SVGAnimatedPropertyTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 084D2832110A7FCB0038239A /* SVGAnimatedPropertyTraits.h */; settings = {ATTRIBUTES = (Private, ); }; }; 084DBAA10ED39D360038C226 /* WMLVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 084DBA9D0ED39D350038C226 /* WMLVariables.cpp */; }; 084DBAA20ED39D360038C226 /* WMLVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = 084DBA9E0ED39D360038C226 /* WMLVariables.h */; }; + 0853D73211C9109000B2FD42 /* SVGTextChunkLayoutInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0853D72F11C9108F00B2FD42 /* SVGTextChunkLayoutInfo.cpp */; }; + 0853D73311C9109000B2FD42 /* SVGTextQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0853D73011C9109000B2FD42 /* SVGTextQuery.cpp */; }; + 0853D73411C9109000B2FD42 /* SVGTextQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 0853D73111C9109000B2FD42 /* SVGTextQuery.h */; }; 08563BB4117861780012B578 /* RenderSVGResourcePattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08563BB2117861770012B578 /* RenderSVGResourcePattern.cpp */; }; 08563BB5117861780012B578 /* RenderSVGResourcePattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 08563BB3117861770012B578 /* RenderSVGResourcePattern.h */; }; 08563BD0117865F50012B578 /* RenderSVGResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08563BCF117865F50012B578 /* RenderSVGResource.cpp */; }; @@ -424,6 +427,7 @@ 1A8F6BC50DB55CDC001DB794 /* ManifestParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8F6BBA0DB55CDC001DB794 /* ManifestParser.cpp */; }; 1A8F6BC60DB55CDC001DB794 /* ManifestParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8F6BBB0DB55CDC001DB794 /* ManifestParser.h */; }; 1A98956B0AA78F80005EF5EF /* KURLCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A98956A0AA78F80005EF5EF /* KURLCFNet.cpp */; }; + 1AA8799011CBE846003C664F /* PluginStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA8798F11CBE846003C664F /* PluginStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE780C051FDE00139F4F /* zoomInCursor.png */; }; 1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */; }; 1AB7FC680A8B92EC00D9D37B /* XPathEvaluator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */; }; @@ -472,6 +476,8 @@ 1AD2316E0CD269E700C1F194 /* JSSQLTransactionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD2316D0CD269E700C1F194 /* JSSQLTransactionCustom.cpp */; }; 1AD51A140CB59CD300953D11 /* DatabaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD51A120CB59CD300953D11 /* DatabaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1AD51A150CB59CD300953D11 /* DatabaseTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */; }; + 1AD8F81B11CAB9E900E93E54 /* PlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1AD8F81C11CAB9E900E93E54 /* PlatformStrategies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */; }; 1ADA14100E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADA140E0E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp */; }; 1ADA14110E1AE5D900023EE5 /* PluginMainThreadScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ADA140F0E1AE5D900023EE5 /* PluginMainThreadScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1AE2AA1E0A1CDAB400B42B25 /* JSHTMLAreaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE2AA0A0A1CDAB300B42B25 /* JSHTMLAreaElement.cpp */; }; @@ -584,6 +590,7 @@ 1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF6BE120E9BB4670025E1CD /* ObjCNodeFilterCondition.mm */; }; 1CF6BE150E9BB4670025E1CD /* ObjCNodeFilterCondition.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CF6BE130E9BB4670025E1CD /* ObjCNodeFilterCondition.h */; }; 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */; }; + 200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */; }; 228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */ = {isa = PBXBuildFile; fileRef = 228C284410D82500009D0D0E /* ScriptWrappable.h */; settings = {ATTRIBUTES = (Private, ); }; }; 24F54EAC101FE914000AE741 /* ApplicationCacheHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 24F54EAA101FE914000AE741 /* ApplicationCacheHost.cpp */; }; 24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */; settings = {ATTRIBUTES = (); }; }; @@ -729,6 +736,7 @@ 3390CA580FFC157B00921962 /* NotificationContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA540FFC157B00921962 /* NotificationContents.h */; }; 33C0CCD4112C5E6200CE057D /* SecureTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33C0CCD2112C5E6200CE057D /* SecureTextInput.cpp */; }; 33C0CCD5112C5E6200CE057D /* SecureTextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 33C0CCD3112C5E6200CE057D /* SecureTextInput.h */; }; + 371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */; }; 371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 371F4F410D25B9AF00ECE0D5 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */; }; 371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */; }; @@ -739,6 +747,8 @@ 371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */; }; 37202199106213C600F25C4B /* FontSmoothingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37202198106213C600F25C4B /* FontSmoothingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */; }; + 375CD232119D43C800A2A859 /* Hyphenation.h in Headers */ = {isa = PBXBuildFile; fileRef = 375CD231119D43C800A2A859 /* Hyphenation.h */; }; + 375CD23B119D44EA00A2A859 /* HyphenationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375CD239119D44EA00A2A859 /* HyphenationMac.mm */; }; 3774ABA50FA21EB400AD7DE9 /* OverlapTestRequestClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 377C4CDF1014E9F600B9AE42 /* PlaceholderDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 377C4CDD1014E9F600B9AE42 /* PlaceholderDocument.h */; }; 377C4CE01014E9F600B9AE42 /* PlaceholderDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 377C4CDE1014E9F600B9AE42 /* PlaceholderDocument.cpp */; }; @@ -762,8 +772,6 @@ 411046410FA222A600BA436A /* ScriptEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 4110463F0FA222A600BA436A /* ScriptEventListener.h */; }; 411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411046400FA222A600BA436A /* ScriptEventListener.cpp */; }; 4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; }; - 415B7C580FF598E6006770F7 /* JSSharedWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */; }; - 415B7C630FF5A767006770F7 /* JSSharedWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */; }; 4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */; }; 4162A451101145AE00DFF3ED /* DedicatedWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A44E101145AE00DFF3ED /* DedicatedWorkerContext.h */; }; 4162A454101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */; }; @@ -777,6 +785,8 @@ 416E75CB0EDF90C700360E1D /* ScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */; }; 416E75CC0EDF90C700360E1D /* ScriptCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */; }; 416F45F00ED7B311008215B6 /* ScriptString.h in Headers */ = {isa = PBXBuildFile; fileRef = 416F45EF0ED7B311008215B6 /* ScriptString.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */ = {isa = PBXBuildFile; fileRef = 41885B9111B6FDA6003383BB /* FormSubmission.h */; }; + 41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41885B9211B6FDA6003383BB /* FormSubmission.cpp */; }; 418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */; }; 418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 418F88030FF957AE0080F045 /* JSAbstractWorker.h */; }; 41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */; }; @@ -850,8 +860,6 @@ 49484FCD102CF23C00187DD3 /* CanvasStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FBF102CF23C00187DD3 /* CanvasStyle.cpp */; }; 49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 49484FC0102CF23C00187DD3 /* CanvasStyle.h */; }; 494BD7950F55C8EE00747828 /* WebKitPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 494BD7930F55C8EE00747828 /* WebKitPoint.h */; }; - 494BD7990F55C90E00747828 /* JSWebKitPointConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 494BD7970F55C90E00747828 /* JSWebKitPointConstructor.cpp */; }; - 494BD79A0F55C90E00747828 /* JSWebKitPointConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 494BD7980F55C90E00747828 /* JSWebKitPointConstructor.h */; }; 494BD79D0F55C94C00747828 /* JSWebKitPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 494BD79B0F55C94C00747828 /* JSWebKitPoint.cpp */; }; 494BD79E0F55C94C00747828 /* JSWebKitPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 494BD79C0F55C94C00747828 /* JSWebKitPoint.h */; }; 4983913F0F1E767500C23782 /* JSWebKitCSSMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4983913D0F1E767500C23782 /* JSWebKitCSSMatrix.cpp */; }; @@ -861,8 +869,6 @@ 498391520F1E76B400C23782 /* DOMWebKitCSSMatrixInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4983914F0F1E76B400C23782 /* DOMWebKitCSSMatrixInternal.h */; }; 498391580F1E776900C23782 /* WebKitCSSMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498391550F1E776900C23782 /* WebKitCSSMatrix.cpp */; }; 498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391560F1E776900C23782 /* WebKitCSSMatrix.h */; }; - 498391630F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */; }; - 498391640F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */; }; 49C7B9931042D2D30009D447 /* JSWebGLBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */; }; 49C7B9941042D2D30009D447 /* JSWebGLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */; }; 49C7B9951042D2D30009D447 /* JSInt8Array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9821042D2D30009D447 /* JSInt8Array.cpp */; }; @@ -898,9 +904,6 @@ 49C7B9E51042D32F0009D447 /* WebGLTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9C51042D32F0009D447 /* WebGLTexture.cpp */; }; 49C7B9E61042D32F0009D447 /* WebGLTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C7B9C61042D32F0009D447 /* WebGLTexture.h */; }; 49C7B9FC1042D3650009D447 /* GraphicsContext3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C7B9FB1042D3650009D447 /* GraphicsContext3D.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 49C7BA001042D38C0009D447 /* Canvas3DLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C7B9FD1042D38C0009D447 /* Canvas3DLayer.h */; }; - 49C7BA011042D38C0009D447 /* Canvas3DLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9FE1042D38C0009D447 /* Canvas3DLayer.mm */; }; - 49C7BA021042D38C0009D447 /* GraphicsContext3DMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9FF1042D38C0009D447 /* GraphicsContext3DMac.cpp */; }; 49C7BA791042EFAE0009D447 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C7BA781042EFAE0009D447 /* OpenGL.framework */; }; 49C7BA8D1042F5B10009D447 /* JSDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */; }; 49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */; }; @@ -967,22 +970,6 @@ 49EECF7C10508D9C00099FAB /* JSUint8ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7510508D9C00099FAB /* JSUint8ArrayCustom.cpp */; }; 49EECF7D10508D9C00099FAB /* JSUint32ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7610508D9C00099FAB /* JSUint32ArrayCustom.cpp */; }; 49EECF7E10508D9C00099FAB /* JSUint16ArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF7710508D9C00099FAB /* JSUint16ArrayCustom.cpp */; }; - 49EECFAB1050938200099FAB /* JSArrayBufferConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF991050938200099FAB /* JSArrayBufferConstructor.cpp */; }; - 49EECFAC1050938200099FAB /* JSArrayBufferConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9A1050938200099FAB /* JSArrayBufferConstructor.h */; }; - 49EECFAD1050938200099FAB /* JSInt8ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9B1050938200099FAB /* JSInt8ArrayConstructor.cpp */; }; - 49EECFAE1050938200099FAB /* JSInt8ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9C1050938200099FAB /* JSInt8ArrayConstructor.h */; }; - 49EECFAF1050938200099FAB /* JSFloat32ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9D1050938200099FAB /* JSFloat32ArrayConstructor.cpp */; }; - 49EECFB01050938200099FAB /* JSFloat32ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECF9E1050938200099FAB /* JSFloat32ArrayConstructor.h */; }; - 49EECFB11050938200099FAB /* JSInt32ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECF9F1050938200099FAB /* JSInt32ArrayConstructor.cpp */; }; - 49EECFB21050938200099FAB /* JSInt32ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECFA01050938200099FAB /* JSInt32ArrayConstructor.h */; }; - 49EECFB51050938200099FAB /* JSInt16ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECFA31050938200099FAB /* JSInt16ArrayConstructor.cpp */; }; - 49EECFB61050938200099FAB /* JSInt16ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECFA41050938200099FAB /* JSInt16ArrayConstructor.h */; }; - 49EECFB71050938200099FAB /* JSUint8ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECFA51050938200099FAB /* JSUint8ArrayConstructor.cpp */; }; - 49EECFB81050938200099FAB /* JSUint8ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECFA61050938200099FAB /* JSUint8ArrayConstructor.h */; }; - 49EECFB91050938200099FAB /* JSUint32ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECFA71050938200099FAB /* JSUint32ArrayConstructor.cpp */; }; - 49EECFBA1050938200099FAB /* JSUint32ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECFA81050938200099FAB /* JSUint32ArrayConstructor.h */; }; - 49EECFBB1050938200099FAB /* JSUint16ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EECFA91050938200099FAB /* JSUint16ArrayConstructor.cpp */; }; - 49EECFBC1050938200099FAB /* JSUint16ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EECFAA1050938200099FAB /* JSUint16ArrayConstructor.h */; }; 49EED1421051969400099FAB /* JSCanvasRenderingContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EED13C1051969400099FAB /* JSCanvasRenderingContext.cpp */; }; 49EED1431051969400099FAB /* JSCanvasRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EED13D1051969400099FAB /* JSCanvasRenderingContext.h */; }; 49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EED13E1051969400099FAB /* JSCanvasRenderingContext2D.cpp */; }; @@ -992,6 +979,9 @@ 49EED14E1051971A00099FAB /* JSCanvasRenderingContext2DCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */; }; 49EED14F1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */; }; 49EED1501051971A00099FAB /* JSCanvasRenderingContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49EED14D1051971A00099FAB /* JSCanvasRenderingContextCustom.cpp */; }; + 49FFBF1D11C8550E006A7118 /* GraphicsContext3DMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FFBF1C11C8550E006A7118 /* GraphicsContext3DMac.mm */; }; + 49FFBF3F11C93EE3006A7118 /* WebGLLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */; }; + 49FFBF4011C93EE3006A7118 /* WebGLLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */; }; 4A8C96EB0BE69032004EEFF0 /* SelectionControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A8C96EA0BE69032004EEFF0 /* SelectionControllerMac.mm */; }; 4B2708C70AF19EE40065127F /* Pasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B2708C50AF19EE40065127F /* Pasteboard.h */; }; 4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2709810AF2E5E00065127F /* PasteboardMac.mm */; }; @@ -1106,8 +1096,6 @@ 5189F0DE10B46B0E00F3C739 /* PopStateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5189F0DD10B46B0E00F3C739 /* PopStateEvent.cpp */; }; 518A34C11026C831001B6896 /* WebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518A34BE1026C831001B6896 /* WebSocket.cpp */; }; 518A34C21026C831001B6896 /* WebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 518A34BF1026C831001B6896 /* WebSocket.h */; }; - 518A34C71026C8C9001B6896 /* JSWebSocketConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518A34C41026C8C9001B6896 /* JSWebSocketConstructor.cpp */; }; - 518A34C81026C8C9001B6896 /* JSWebSocketConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 518A34C51026C8C9001B6896 /* JSWebSocketConstructor.h */; }; 518A34C91026C8C9001B6896 /* JSWebSocketCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518A34C61026C8C9001B6896 /* JSWebSocketCustom.cpp */; }; 5196116A0CAC56570010A80C /* Database.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5196115E0CAC56570010A80C /* Database.cpp */; }; 5196116B0CAC56570010A80C /* Database.h in Headers */ = {isa = PBXBuildFile; fileRef = 5196115F0CAC56570010A80C /* Database.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -1333,6 +1321,8 @@ 75793ED50D0CE85B007FC0AC /* DOMMessageEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */; }; 7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */; }; 7637C543112E7B7E003D6CDC /* WebSocketHandshakeRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */; }; + 767F99BE11A1194A0080C51D /* WebSocketHandshakeResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 767F99BD11A1194A0080C51D /* WebSocketHandshakeResponse.cpp */; }; + 767F99C011A119560080C51D /* WebSocketHandshakeResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 767F99BF11A119560080C51D /* WebSocketHandshakeResponse.h */; }; 7693BAD2106C2DCA007B0823 /* HaltablePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 7693BACE106C2DCA007B0823 /* HaltablePlugin.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7693BAD3106C2DCA007B0823 /* PluginHalter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7693BACF106C2DCA007B0823 /* PluginHalter.cpp */; }; 7693BAD4106C2DCA007B0823 /* PluginHalter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7693BAD0106C2DCA007B0823 /* PluginHalter.h */; }; @@ -2287,6 +2277,10 @@ 895253DF116C4F0600CABF00 /* FileThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 895253DE116C4F0600CABF00 /* FileThreadTask.h */; }; 8988E10E11A3508B00DB732E /* BlobItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8988E10C11A3508B00DB732E /* BlobItem.cpp */; }; 8988E10F11A3508B00DB732E /* BlobItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8988E10D11A3508B00DB732E /* BlobItem.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 89BED5EB11BE11CE00448492 /* BlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */; }; + 89BED5EC11BE11CE00448492 /* BlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89BED5EA11BE11CE00448492 /* BlobBuilder.h */; }; + 89CD029311C85B870070B791 /* JSBlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */; }; + 89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89CD029211C85B870070B791 /* JSBlobBuilder.h */; }; 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; }; 9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; }; 9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2488,8 +2482,8 @@ 93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */; }; 93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23C02DE4396018635CA /* HTMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F198E608245E59001E9ABC /* HTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23F02DE4396018635CA /* HTMLElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 93F198EF08245E59001E9ABC /* LegacyHTMLTreeConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* LegacyHTMLTreeConstructor.h */; }; - 93F198F008245E59001E9ABC /* HTMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25302DE4396018635CA /* HTMLDocumentParser.h */; }; + 93F198EF08245E59001E9ABC /* LegacyHTMLTreeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */; }; + 93F198F008245E59001E9ABC /* LegacyHTMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25302DE4396018635CA /* LegacyHTMLDocumentParser.h */; }; 93F198F608245E59001E9ABC /* TextResourceDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D27902DE43D7018635CA /* TextResourceDecoder.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F1991808245E59001E9ABC /* Range.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30402DE4476018635CA /* Range.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93F1992108245E59001E9ABC /* XMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30A02DE4476018635CA /* XMLDocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2518,8 +2512,8 @@ 93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587855502DE375901EA4122 /* WebCoreViewFactory.m */; }; 93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23B02DE4396018635CA /* HTMLDocument.cpp */; }; 93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23E02DE4396018635CA /* HTMLElement.cpp */; }; - 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25002DE4396018635CA /* LegacyHTMLTreeConstructor.cpp */; }; - 93F19A9C08245E59001E9ABC /* HTMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25202DE4396018635CA /* HTMLDocumentParser.cpp */; }; + 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */; }; + 93F19A9C08245E59001E9ABC /* LegacyHTMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25202DE4396018635CA /* LegacyHTMLDocumentParser.cpp */; }; 93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */; }; 93F19AB908245E59001E9ABC /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30302DE4476018635CA /* Range.cpp */; }; 93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLDocumentParser.cpp */; }; @@ -2555,12 +2549,15 @@ 97059978107D975200A50A7C /* PolicyCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 97059974107D975200A50A7C /* PolicyCallback.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97059979107D975200A50A7C /* PolicyChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97059975107D975200A50A7C /* PolicyChecker.cpp */; }; 9705997A107D975200A50A7C /* PolicyChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 97059976107D975200A50A7C /* PolicyChecker.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 9719AF0011D09F2C00D45831 /* HTMLInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 9719AEFF11D09F2C00D45831 /* HTMLInputStream.h */; }; 973889A0116EA9DC00ADF313 /* DocumentWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */; }; 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9738899F116EA9DC00ADF313 /* DocumentWriter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */; }; 973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 976E896011C0CA3A00EA9CA9 /* HTML5EntityParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976E895E11C0CA3A00EA9CA9 /* HTML5EntityParser.cpp */; }; - 976E896111C0CA3A00EA9CA9 /* HTML5EntityParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 976E895F11C0CA3A00EA9CA9 /* HTML5EntityParser.h */; }; + 976E2BA711CAE4DE006C56A0 /* CSSPreloadScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976E2BA511CAE4DE006C56A0 /* CSSPreloadScanner.cpp */; }; + 976E2BA811CAE4DE006C56A0 /* CSSPreloadScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 976E2BA611CAE4DE006C56A0 /* CSSPreloadScanner.h */; }; + 976E896011C0CA3A00EA9CA9 /* HTMLEntityParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976E895E11C0CA3A00EA9CA9 /* HTMLEntityParser.cpp */; }; + 976E896111C0CA3A00EA9CA9 /* HTMLEntityParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 976E895F11C0CA3A00EA9CA9 /* HTMLEntityParser.h */; }; 979F43D31075E44A0000F83B /* RedirectScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 979F43D11075E44A0000F83B /* RedirectScheduler.cpp */; }; 979F43D41075E44A0000F83B /* RedirectScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 979F43D21075E44A0000F83B /* RedirectScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C0784F1165D5BE003A32EF /* SuffixTree.h */; }; @@ -2568,9 +2565,11 @@ 97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */; }; 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; }; - 97E8B35611A23CE200169409 /* HTML5Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */; }; - 97E8B35711A23CE200169409 /* HTML5Lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E8B35511A23CE200169409 /* HTML5Lexer.h */; }; - 97E8B3C311A2890800169409 /* HTML5Token.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E8B3C211A2890800169409 /* HTML5Token.h */; }; + 97E7936511C6030900E649BC /* HTMLPreloadScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E7936311C6030900E649BC /* HTMLPreloadScanner.cpp */; }; + 97E7936611C6030900E649BC /* HTMLPreloadScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E7936411C6030900E649BC /* HTMLPreloadScanner.h */; }; + 97E8B35611A23CE200169409 /* HTMLTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E8B35411A23CE200169409 /* HTMLTokenizer.cpp */; }; + 97E8B35711A23CE200169409 /* HTMLTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E8B35511A23CE200169409 /* HTMLTokenizer.h */; }; + 97E8B3C311A2890800169409 /* HTMLToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E8B3C211A2890800169409 /* HTMLToken.h */; }; 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; }; 9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */; }; 9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2635,6 +2634,8 @@ A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; }; A795463E0B5C4C80007B438F /* DragDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A795463D0B5C4C80007B438F /* DragDataMac.mm */; }; A79546430B5C4CB4007B438F /* DragData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79546420B5C4CB4007B438F /* DragData.cpp */; }; + A7AA66D611C5ED6A001D8C8C /* RenderIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AA66D411C5ED6A001D8C8C /* RenderIndicator.cpp */; }; + A7AA66D711C5ED6A001D8C8C /* RenderIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AA66D511C5ED6A001D8C8C /* RenderIndicator.h */; }; A7AD2F870EC89D07008AB002 /* LinkHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2F850EC89D07008AB002 /* LinkHash.cpp */; }; A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AD2F860EC89D07008AB002 /* LinkHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2937,8 +2938,8 @@ A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A833C80A0A2CF25600D57664 /* XMLNames.cpp */; }; A833C80D0A2CF25600D57664 /* XMLNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A833C80B0A2CF25600D57664 /* XMLNames.h */; }; A833C8520A2CF52800D57664 /* SVGElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581E609D1508D000E61D7 /* SVGElementFactory.cpp */; }; - A83B3AF011ADEFF500458809 /* HTML5ScriptRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A83B3AEE11ADEFF500458809 /* HTML5ScriptRunner.cpp */; }; - A83B3AF111ADEFF500458809 /* HTML5ScriptRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = A83B3AEF11ADEFF500458809 /* HTML5ScriptRunner.h */; }; + A83B3AF011ADEFF500458809 /* HTMLScriptRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A83B3AEE11ADEFF500458809 /* HTMLScriptRunner.cpp */; }; + A83B3AF111ADEFF500458809 /* HTMLScriptRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = A83B3AEF11ADEFF500458809 /* HTMLScriptRunner.h */; }; A83B78FC0CCAFF15000B0825 /* JSSVGFontFaceUriElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A83B78F20CCAFF15000B0825 /* JSSVGFontFaceUriElement.h */; }; A83B78FD0CCAFF15000B0825 /* JSSVGFontFaceUriElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A83B78F30CCAFF15000B0825 /* JSSVGFontFaceUriElement.cpp */; }; A83B78FE0CCAFF15000B0825 /* JSSVGFontFaceSrcElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A83B78F40CCAFF15000B0825 /* JSSVGFontFaceSrcElement.h */; }; @@ -2965,17 +2966,19 @@ A83B79560CCB0125000B0825 /* DOMSVGFontFaceElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = A83B79470CCB0125000B0825 /* DOMSVGFontFaceElement.mm */; }; A83B79570CCB0125000B0825 /* DOMSVGFontFaceElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A83B79480CCB0125000B0825 /* DOMSVGFontFaceElement.h */; }; A83E1C740E49042C00140B9C /* ScriptControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A83E1C720E49042B00140B9C /* ScriptControllerMac.mm */; }; + A84D827C11D333ED00972990 /* RawDataDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A84D827B11D333ED00972990 /* RawDataDocumentParser.h */; }; A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A84EBD770CB8C89200079609 /* JSStyleSheetListCustom.cpp */; }; A84EBD830CB8C97700079609 /* JSStyleSheetList.h in Headers */ = {isa = PBXBuildFile; fileRef = A84EBD810CB8C97700079609 /* JSStyleSheetList.h */; }; A84EBD840CB8C97700079609 /* JSStyleSheetList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A84EBD820CB8C97700079609 /* JSStyleSheetList.cpp */; }; + A853123D11D0471B00D4D077 /* FragmentScriptingPermission.h in Headers */ = {isa = PBXBuildFile; fileRef = A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */; settings = {ATTRIBUTES = (Private, ); }; }; A86629CF09DA2B47009633A5 /* JSUIEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629C909DA2B47009633A5 /* JSUIEvent.h */; }; A86629D009DA2B48009633A5 /* JSUIEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CA09DA2B47009633A5 /* JSUIEvent.cpp */; }; A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CB09DA2B47009633A5 /* JSMouseEvent.h */; }; A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */; }; A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */; }; A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */; }; - A871038A11A2947000DBD50E /* HTML5DocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871038811A2947000DBD50E /* HTML5DocumentParser.cpp */; }; - A871038B11A2947000DBD50E /* HTML5DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A871038911A2947000DBD50E /* HTML5DocumentParser.h */; }; + A871038A11A2947000DBD50E /* HTMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871038811A2947000DBD50E /* HTMLDocumentParser.cpp */; }; + A871038B11A2947000DBD50E /* HTMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A871038911A2947000DBD50E /* HTMLDocumentParser.h */; }; A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */; }; A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */; }; @@ -3034,9 +3037,9 @@ A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFDF0A15376B00B12A68 /* RenderReplaced.h */; settings = {ATTRIBUTES = (Private, ); }; }; A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFE00A15376B00B12A68 /* RenderWidget.h */; settings = {ATTRIBUTES = (Private, ); }; }; A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFE10A15376B00B12A68 /* RenderWidget.cpp */; }; - A879C62511A9D1F70059237A /* HTML5TreeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */; }; - A879C62611A9D1F70059237A /* HTML5TreeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */; }; - A87F163511AE841300CBB2E5 /* HTML5ScriptRunnerHost.h in Headers */ = {isa = PBXBuildFile; fileRef = A87F163411AE841300CBB2E5 /* HTML5ScriptRunnerHost.h */; }; + A879C62511A9D1F70059237A /* HTMLTreeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A879C62311A9D1F70059237A /* HTMLTreeBuilder.cpp */; }; + A879C62611A9D1F70059237A /* HTMLTreeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A879C62411A9D1F70059237A /* HTMLTreeBuilder.h */; }; + A87F163511AE841300CBB2E5 /* HTMLScriptRunnerHost.h in Headers */ = {isa = PBXBuildFile; fileRef = A87F163411AE841300CBB2E5 /* HTMLScriptRunnerHost.h */; }; A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */; }; A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = A883DF260F3D045D00F19BF6 /* VisibleSelection.h */; settings = {ATTRIBUTES = (Private, ); }; }; A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */; }; @@ -3279,6 +3282,8 @@ A8E545BD0CA9D1C20097D09B /* DOMSVGAnimatedAngleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E544BF0CA9D1C20097D09B /* DOMSVGAnimatedAngleInternal.h */; }; A8E545BF0CA9D1C20097D09B /* DOMSVGTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E544C10CA9D1C20097D09B /* DOMSVGTextElement.h */; }; A8E545C10CA9D1C20097D09B /* DOMSVGDescElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E544C30CA9D1C20097D09B /* DOMSVGDescElementInternal.h */; }; + A8E6A78111D1661B00311F4A /* HTMLParserScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E6A77F11D1661B00311F4A /* HTMLParserScheduler.h */; }; + A8E6A78211D1661B00311F4A /* HTMLParserScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8E6A78011D1661B00311F4A /* HTMLParserScheduler.cpp */; }; A8EA73C30A1900E300A8EF5F /* RenderFieldset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA73AF0A1900E300A8EF5F /* RenderFieldset.cpp */; }; A8EA73C40A1900E300A8EF5F /* RenderFieldset.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA73B00A1900E300A8EF5F /* RenderFieldset.h */; }; A8EA79F10A1916DF00A8EF5F /* HTMLOListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA79E50A1916DF00A8EF5F /* HTMLOListElement.h */; }; @@ -3469,7 +3474,6 @@ A9C6E4F00D745E38006442E9 /* PluginArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A9C6E4EE0D745E38006442E9 /* PluginArray.h */; }; A9C6E4F30D745E48006442E9 /* PluginData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4F10D745E48006442E9 /* PluginData.cpp */; }; A9C6E4F40D745E48006442E9 /* PluginData.h in Headers */ = {isa = PBXBuildFile; fileRef = A9C6E4F20D745E48006442E9 /* PluginData.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A9C6E4F60D745E61006442E9 /* PluginDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4F50D745E61006442E9 /* PluginDataMac.mm */; }; A9C6E5A50D746458006442E9 /* Navigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E5A30D746458006442E9 /* Navigator.cpp */; }; A9C6E5A60D746458006442E9 /* Navigator.h in Headers */ = {isa = PBXBuildFile; fileRef = A9C6E5A40D746458006442E9 /* Navigator.h */; }; A9C6E6470D7465CA006442E9 /* JSMimeTypeArrayCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E6460D7465CA006442E9 /* JSMimeTypeArrayCustom.cpp */; }; @@ -4234,10 +4238,13 @@ B523CF091182675400EBB29C /* SQLTransactionSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B523CF021182675400EBB29C /* SQLTransactionSync.cpp */; }; B523CF0A1182675400EBB29C /* DatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B523CF031182675400EBB29C /* DatabaseSync.cpp */; }; B523CF0B1182675400EBB29C /* DatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B523CF041182675400EBB29C /* DatabaseSync.h */; }; + B525A96511CA2340003A23A8 /* JSSQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B525A96311CA2340003A23A8 /* JSSQLException.h */; }; + B525A96611CA2340003A23A8 /* JSSQLException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B525A96411CA2340003A23A8 /* JSSQLException.cpp */; }; B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; }; B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; }; B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */; }; B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; }; + B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B56EBA8311C9FF8100B04477 /* SQLException.h */; }; B58CEB6911913607002A6790 /* JSDatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6711913607002A6790 /* JSDatabaseSync.h */; }; B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */; }; B58CEB6D1191361C002A6790 /* JSSQLTransactionSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6B1191361C002A6790 /* JSSQLTransactionSync.h */; }; @@ -4255,7 +4262,7 @@ B5A684220FFABE9800D24689 /* SQLiteFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A684210FFABE9800D24689 /* SQLiteFileSystem.h */; }; B5A684240FFABEAA00D24689 /* SQLiteFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */; }; B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5B5DC67119BB3D5002A8790 /* AbstractDatabase.cpp */; }; - B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */; }; + B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; }; B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */; }; B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; }; B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D36019112F8B560048DEA8 /* DatabaseCallback.h */; }; @@ -4349,6 +4356,10 @@ BC23EE920DAED2BC009FDC91 /* CSSImageGeneratorValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23EE910DAED2BC009FDC91 /* CSSImageGeneratorValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */; }; BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2441C30E8B65D00055320F /* ScrollView.cpp */; }; + BC275B7911C5D1C300C9206C /* JSWebKitPointCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */; }; + BC275B7D11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */; }; + BC275B8111C5D2B400C9206C /* JSEventSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */; }; + BC275CB311C5E85C00C9206C /* JSArrayBufferCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */; }; BC2CC8DF0F32881000A9DF26 /* RenderObjectChildList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2CC8DE0F32881000A9DF26 /* RenderObjectChildList.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC2ED5550C6B9BD300920BFF /* JSElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */; }; BC2ED6500C6BC48C00920BFF /* JSHTMLIFrameElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2ED64F0C6BC48C00920BFF /* JSHTMLIFrameElementCustom.cpp */; }; @@ -4722,8 +4733,6 @@ BCE789861120E7A60060ECE5 /* BidiRun.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE789851120E7A60060ECE5 /* BidiRun.h */; }; BCE7898B1120E8020060ECE5 /* BidiRun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE7898A1120E8020060ECE5 /* BidiRun.cpp */; }; BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */; }; - BCE99EC30DCA624100182683 /* JSXSLTProcessorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */; }; - BCE99EC40DCA624100182683 /* JSXSLTProcessorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */; }; BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */; }; BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCEA4852097D93020094C9E4 /* RenderBlockLineLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4813097D93020094C9E4 /* RenderBlockLineLayout.cpp */; }; @@ -4873,8 +4882,14 @@ CE4C00E410F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE4C00E310F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp */; }; CE4C00E610F6F7C100CA38F5 /* HTMLNoScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = CE4C00E510F6F7C100CA38F5 /* HTMLNoScriptElement.h */; }; CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; + CEA3949C11D45CDA003094CF /* StaticHashSetNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEA3949A11D45CDA003094CF /* StaticHashSetNodeList.cpp */; }; + CEA3949D11D45CDA003094CF /* StaticHashSetNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = CEA3949B11D45CDA003094CF /* StaticHashSetNodeList.h */; }; CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEF418CC1179678C009D112C /* ViewportArguments.cpp */; }; CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = CEF418CD1179678C009D112C /* ViewportArguments.h */; }; + D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D000EBA011BDAFD400C47726 /* FrameLoaderStateMachine.cpp */; }; + D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */ = {isa = PBXBuildFile; fileRef = D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */; settings = {ATTRIBUTES = (Private, ); }; }; + D000ED2711C1B9CD00C47726 /* SubframeLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */; }; + D000ED2811C1B9CD00C47726 /* SubframeLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = D000ED2611C1B9CD00C47726 /* SubframeLoader.h */; settings = {ATTRIBUTES = (Private, ); }; }; D01A27AD10C9BFD800026A42 /* SpaceSplitString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */; }; D01A27AE10C9BFD800026A42 /* SpaceSplitString.h in Headers */ = {isa = PBXBuildFile; fileRef = D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */; settings = {ATTRIBUTES = (Private, ); }; }; D05CED290A40BB2C00C5AF38 /* FormatBlockCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */; }; @@ -4901,12 +4916,8 @@ E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */; }; E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */; }; E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */; }; - E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */; }; - E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */; }; E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; }; E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E107400C0E77BDC00033AF24 /* JSMessageChannel.h */; }; - E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */; }; - E10743270E7835A50033AF24 /* JSMessageChannelConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E10743260E7835A50033AF24 /* JSMessageChannelConstructor.h */; }; E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */; }; E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */; }; E10B9B6C0B747599003ED890 /* NativeXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B9B6A0B747599003ED890 /* NativeXPathNSResolver.h */; }; @@ -4977,8 +4988,6 @@ E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */; }; E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */; }; E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; }; - E1CA5CD30E8CDE8000E8EF90 /* JSWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */; }; - E1CA5CD60E8CDEE900E8EF90 /* JSWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */; }; E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSWorker.h */; }; E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */; }; E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */; }; @@ -5034,8 +5043,8 @@ E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; }; E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = E47B4BE60E71241600038854 /* CachedResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; }; E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */; }; - E49626C20D80D94800E3405C /* PreloadScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D4ABE00D7542F000F96869 /* PreloadScanner.cpp */; }; - E49626C30D80D94900E3405C /* PreloadScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D4ABE10D7542F100F96869 /* PreloadScanner.h */; }; + E49626C20D80D94800E3405C /* LegacyPreloadScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D4ABE00D7542F000F96869 /* LegacyPreloadScanner.cpp */; }; + E49626C30D80D94900E3405C /* LegacyPreloadScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D4ABE10D7542F100F96869 /* LegacyPreloadScanner.h */; }; E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; }; E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0050DAF335400F5F55C /* SMILTime.cpp */; }; E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0060DAF335400F5F55C /* SMILTime.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5629,6 +5638,9 @@ 084D2832110A7FCB0038239A /* SVGAnimatedPropertyTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyTraits.h; sourceTree = "<group>"; }; 084DBA9D0ED39D350038C226 /* WMLVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLVariables.cpp; sourceTree = "<group>"; }; 084DBA9E0ED39D360038C226 /* WMLVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLVariables.h; sourceTree = "<group>"; }; + 0853D72F11C9108F00B2FD42 /* SVGTextChunkLayoutInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextChunkLayoutInfo.cpp; sourceTree = "<group>"; }; + 0853D73011C9109000B2FD42 /* SVGTextQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextQuery.cpp; sourceTree = "<group>"; }; + 0853D73111C9109000B2FD42 /* SVGTextQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextQuery.h; sourceTree = "<group>"; }; 08563BB2117861770012B578 /* RenderSVGResourcePattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourcePattern.cpp; sourceTree = "<group>"; }; 08563BB3117861770012B578 /* RenderSVGResourcePattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourcePattern.h; sourceTree = "<group>"; }; 08563BCF117865F50012B578 /* RenderSVGResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResource.cpp; sourceTree = "<group>"; }; @@ -5983,6 +5995,7 @@ 1A8F6BBA0DB55CDC001DB794 /* ManifestParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ManifestParser.cpp; sourceTree = "<group>"; }; 1A8F6BBB0DB55CDC001DB794 /* ManifestParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManifestParser.h; sourceTree = "<group>"; }; 1A98956A0AA78F80005EF5EF /* KURLCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KURLCFNet.cpp; sourceTree = "<group>"; }; + 1AA8798F11CBE846003C664F /* PluginStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginStrategy.h; sourceTree = "<group>"; }; 1AB1AE780C051FDE00139F4F /* zoomInCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomInCursor.png; sourceTree = "<group>"; }; 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomOutCursor.png; sourceTree = "<group>"; }; 1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathEvaluator.cpp; sourceTree = "<group>"; }; @@ -6037,6 +6050,8 @@ 1AD2316D0CD269E700C1F194 /* JSSQLTransactionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionCustom.cpp; sourceTree = "<group>"; }; 1AD51A120CB59CD300953D11 /* DatabaseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseTracker.h; sourceTree = "<group>"; }; 1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseTracker.cpp; sourceTree = "<group>"; }; + 1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformStrategies.h; sourceTree = "<group>"; }; + 1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformStrategies.cpp; sourceTree = "<group>"; }; 1ADA140E0E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginMainThreadScheduler.cpp; sourceTree = "<group>"; }; 1ADA140F0E1AE5D900023EE5 /* PluginMainThreadScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginMainThreadScheduler.h; sourceTree = "<group>"; }; 1AE2A9F00A1CDA5700B42B25 /* HTMLAreaElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = HTMLAreaElement.idl; sourceTree = "<group>"; }; @@ -6154,6 +6169,7 @@ 1CF6BE120E9BB4670025E1CD /* ObjCNodeFilterCondition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCNodeFilterCondition.mm; sourceTree = "<group>"; }; 1CF6BE130E9BB4670025E1CD /* ObjCNodeFilterCondition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCNodeFilterCondition.h; sourceTree = "<group>"; }; 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; }; + 200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptBreakpoint.cpp; sourceTree = "<group>"; }; 228C284410D82500009D0D0E /* ScriptWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappable.h; sourceTree = "<group>"; }; 24F54EAA101FE914000AE741 /* ApplicationCacheHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplicationCacheHost.cpp; sourceTree = "<group>"; }; 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheHost.h; sourceTree = "<group>"; }; @@ -6317,6 +6333,7 @@ 3390CA540FFC157B00921962 /* NotificationContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationContents.h; path = notifications/NotificationContents.h; sourceTree = "<group>"; }; 33C0CCD2112C5E6200CE057D /* SecureTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecureTextInput.cpp; sourceTree = "<group>"; }; 33C0CCD3112C5E6200CE057D /* SecureTextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecureTextInput.h; sourceTree = "<group>"; }; + 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HyphenationCF.cpp; sourceTree = "<group>"; }; 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; }; 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; }; 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedFontData.h; sourceTree = "<group>"; }; @@ -6327,6 +6344,8 @@ 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnicodeRangeValue.cpp; sourceTree = "<group>"; }; 37202198106213C600F25C4B /* FontSmoothingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingMode.h; sourceTree = "<group>"; }; 3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGlyphMap.h; sourceTree = "<group>"; }; + 375CD231119D43C800A2A859 /* Hyphenation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hyphenation.h; sourceTree = "<group>"; }; + 375CD239119D44EA00A2A859 /* HyphenationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HyphenationMac.mm; sourceTree = "<group>"; }; 3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlapTestRequestClient.h; sourceTree = "<group>"; }; 377C4CDD1014E9F600B9AE42 /* PlaceholderDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaceholderDocument.h; sourceTree = "<group>"; }; 377C4CDE1014E9F600B9AE42 /* PlaceholderDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlaceholderDocument.cpp; sourceTree = "<group>"; }; @@ -6351,8 +6370,6 @@ 4110463F0FA222A600BA436A /* ScriptEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptEventListener.h; sourceTree = "<group>"; }; 411046400FA222A600BA436A /* ScriptEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEventListener.cpp; sourceTree = "<group>"; }; 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; }; - 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSharedWorkerConstructor.cpp; sourceTree = "<group>"; }; - 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSharedWorkerConstructor.h; sourceTree = "<group>"; }; 4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DedicatedWorkerContext.cpp; path = workers/DedicatedWorkerContext.cpp; sourceTree = "<group>"; }; 4162A44E101145AE00DFF3ED /* DedicatedWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DedicatedWorkerContext.h; path = workers/DedicatedWorkerContext.h; sourceTree = "<group>"; }; 4162A44F101145AE00DFF3ED /* DedicatedWorkerContext.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DedicatedWorkerContext.idl; path = workers/DedicatedWorkerContext.idl; sourceTree = "<group>"; }; @@ -6367,6 +6384,8 @@ 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = "<group>"; }; 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallFrame.cpp; sourceTree = "<group>"; }; 416F45EF0ED7B311008215B6 /* ScriptString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptString.h; sourceTree = "<group>"; }; + 41885B9111B6FDA6003383BB /* FormSubmission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormSubmission.h; sourceTree = "<group>"; }; + 41885B9211B6FDA6003383BB /* FormSubmission.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormSubmission.cpp; sourceTree = "<group>"; }; 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorker.cpp; sourceTree = "<group>"; }; 418F88030FF957AE0080F045 /* JSAbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractWorker.h; sourceTree = "<group>"; }; 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DedicatedWorkerThread.cpp; path = workers/DedicatedWorkerThread.cpp; sourceTree = "<group>"; }; @@ -6460,8 +6479,6 @@ 49484FC0102CF23C00187DD3 /* CanvasStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasStyle.h; path = canvas/CanvasStyle.h; sourceTree = "<group>"; }; 494BD7930F55C8EE00747828 /* WebKitPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitPoint.h; sourceTree = "<group>"; }; 494BD7940F55C8EE00747828 /* WebKitPoint.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitPoint.idl; sourceTree = "<group>"; }; - 494BD7970F55C90E00747828 /* JSWebKitPointConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitPointConstructor.cpp; sourceTree = "<group>"; }; - 494BD7980F55C90E00747828 /* JSWebKitPointConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitPointConstructor.h; sourceTree = "<group>"; }; 494BD79B0F55C94C00747828 /* JSWebKitPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitPoint.cpp; sourceTree = "<group>"; }; 494BD79C0F55C94C00747828 /* JSWebKitPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitPoint.h; sourceTree = "<group>"; }; 4983913D0F1E767500C23782 /* JSWebKitCSSMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrix.cpp; sourceTree = "<group>"; }; @@ -6472,8 +6489,6 @@ 498391550F1E776900C23782 /* WebKitCSSMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSMatrix.cpp; sourceTree = "<group>"; }; 498391560F1E776900C23782 /* WebKitCSSMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSMatrix.h; sourceTree = "<group>"; }; 498391570F1E776900C23782 /* WebKitCSSMatrix.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSMatrix.idl; sourceTree = "<group>"; }; - 498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixConstructor.cpp; sourceTree = "<group>"; }; - 498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSMatrixConstructor.h; sourceTree = "<group>"; }; 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLBuffer.cpp; sourceTree = "<group>"; }; 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLBuffer.h; sourceTree = "<group>"; }; 49C7B9821042D2D30009D447 /* JSInt8Array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt8Array.cpp; sourceTree = "<group>"; }; @@ -6518,9 +6533,6 @@ 49C7B9C61042D32F0009D447 /* WebGLTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLTexture.h; path = canvas/WebGLTexture.h; sourceTree = "<group>"; }; 49C7B9C71042D32F0009D447 /* WebGLTexture.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLTexture.idl; path = canvas/WebGLTexture.idl; sourceTree = "<group>"; }; 49C7B9FB1042D3650009D447 /* GraphicsContext3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3D.h; sourceTree = "<group>"; }; - 49C7B9FD1042D38C0009D447 /* Canvas3DLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Canvas3DLayer.h; sourceTree = "<group>"; }; - 49C7B9FE1042D38C0009D447 /* Canvas3DLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Canvas3DLayer.mm; sourceTree = "<group>"; }; - 49C7B9FF1042D38C0009D447 /* GraphicsContext3DMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DMac.cpp; sourceTree = "<group>"; }; 49C7BA781042EFAE0009D447 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentCustom.cpp; sourceTree = "<group>"; }; 49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Matrix3DTransformOperation.cpp; path = transforms/Matrix3DTransformOperation.cpp; sourceTree = "<group>"; }; @@ -6595,22 +6607,6 @@ 49EECF7510508D9C00099FAB /* JSUint8ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint8ArrayCustom.cpp; sourceTree = "<group>"; }; 49EECF7610508D9C00099FAB /* JSUint32ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint32ArrayCustom.cpp; sourceTree = "<group>"; }; 49EECF7710508D9C00099FAB /* JSUint16ArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint16ArrayCustom.cpp; sourceTree = "<group>"; }; - 49EECF991050938200099FAB /* JSArrayBufferConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferConstructor.cpp; sourceTree = "<group>"; }; - 49EECF9A1050938200099FAB /* JSArrayBufferConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferConstructor.h; sourceTree = "<group>"; }; - 49EECF9B1050938200099FAB /* JSInt8ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt8ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECF9C1050938200099FAB /* JSInt8ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInt8ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECF9D1050938200099FAB /* JSFloat32ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFloat32ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECF9E1050938200099FAB /* JSFloat32ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFloat32ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECF9F1050938200099FAB /* JSInt32ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt32ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECFA01050938200099FAB /* JSInt32ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInt32ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECFA31050938200099FAB /* JSInt16ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInt16ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECFA41050938200099FAB /* JSInt16ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInt16ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECFA51050938200099FAB /* JSUint8ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint8ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECFA61050938200099FAB /* JSUint8ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUint8ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECFA71050938200099FAB /* JSUint32ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint32ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECFA81050938200099FAB /* JSUint32ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUint32ArrayConstructor.h; sourceTree = "<group>"; }; - 49EECFA91050938200099FAB /* JSUint16ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUint16ArrayConstructor.cpp; sourceTree = "<group>"; }; - 49EECFAA1050938200099FAB /* JSUint16ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUint16ArrayConstructor.h; sourceTree = "<group>"; }; 49EED13C1051969400099FAB /* JSCanvasRenderingContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCanvasRenderingContext.cpp; sourceTree = "<group>"; }; 49EED13D1051969400099FAB /* JSCanvasRenderingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCanvasRenderingContext.h; sourceTree = "<group>"; }; 49EED13E1051969400099FAB /* JSCanvasRenderingContext2D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCanvasRenderingContext2D.cpp; sourceTree = "<group>"; }; @@ -6620,6 +6616,9 @@ 49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCanvasRenderingContext2DCustom.cpp; sourceTree = "<group>"; }; 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLRenderingContextCustom.cpp; sourceTree = "<group>"; }; 49EED14D1051971A00099FAB /* JSCanvasRenderingContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCanvasRenderingContextCustom.cpp; sourceTree = "<group>"; }; + 49FFBF1C11C8550E006A7118 /* GraphicsContext3DMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GraphicsContext3DMac.mm; sourceTree = "<group>"; }; + 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLLayer.h; sourceTree = "<group>"; }; + 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLLayer.mm; sourceTree = "<group>"; }; 4A8C96EA0BE69032004EEFF0 /* SelectionControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = SelectionControllerMac.mm; path = mac/SelectionControllerMac.mm; sourceTree = "<group>"; }; 4B2708C50AF19EE40065127F /* Pasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pasteboard.h; sourceTree = "<group>"; }; 4B2709810AF2E5E00065127F /* PasteboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardMac.mm; sourceTree = "<group>"; }; @@ -6753,8 +6752,6 @@ 518A34BE1026C831001B6896 /* WebSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocket.cpp; sourceTree = "<group>"; }; 518A34BF1026C831001B6896 /* WebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocket.h; sourceTree = "<group>"; }; 518A34C01026C831001B6896 /* WebSocket.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSocket.idl; sourceTree = "<group>"; }; - 518A34C41026C8C9001B6896 /* JSWebSocketConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebSocketConstructor.cpp; sourceTree = "<group>"; }; - 518A34C51026C8C9001B6896 /* JSWebSocketConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebSocketConstructor.h; sourceTree = "<group>"; }; 518A34C61026C8C9001B6896 /* JSWebSocketCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebSocketCustom.cpp; sourceTree = "<group>"; }; 5196115E0CAC56570010A80C /* Database.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Database.cpp; sourceTree = "<group>"; }; 5196115F0CAC56570010A80C /* Database.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Database.h; sourceTree = "<group>"; }; @@ -7000,6 +6997,8 @@ 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMMessageEventInternal.h; sourceTree = "<group>"; }; 7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshakeRequest.cpp; sourceTree = "<group>"; }; 7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshakeRequest.h; sourceTree = "<group>"; }; + 767F99BD11A1194A0080C51D /* WebSocketHandshakeResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshakeResponse.cpp; sourceTree = "<group>"; }; + 767F99BF11A119560080C51D /* WebSocketHandshakeResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshakeResponse.h; sourceTree = "<group>"; }; 7693BACE106C2DCA007B0823 /* HaltablePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HaltablePlugin.h; sourceTree = "<group>"; }; 7693BACF106C2DCA007B0823 /* PluginHalter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginHalter.cpp; sourceTree = "<group>"; }; 7693BAD0106C2DCA007B0823 /* PluginHalter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginHalter.h; sourceTree = "<group>"; }; @@ -7909,6 +7908,11 @@ 895253DE116C4F0600CABF00 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThreadTask.h; sourceTree = "<group>"; }; 8988E10C11A3508B00DB732E /* BlobItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobItem.cpp; sourceTree = "<group>"; }; 8988E10D11A3508B00DB732E /* BlobItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobItem.h; sourceTree = "<group>"; }; + 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobBuilder.cpp; sourceTree = "<group>"; }; + 89BED5EA11BE11CE00448492 /* BlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobBuilder.h; sourceTree = "<group>"; }; + 89CD027911C859A80070B791 /* BlobBuilder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BlobBuilder.idl; sourceTree = "<group>"; }; + 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobBuilder.cpp; sourceTree = "<group>"; }; + 89CD029211C85B870070B791 /* JSBlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobBuilder.h; sourceTree = "<group>"; }; 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; }; 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; }; 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; }; @@ -8156,12 +8160,15 @@ 97059974107D975200A50A7C /* PolicyCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolicyCallback.h; sourceTree = "<group>"; }; 97059975107D975200A50A7C /* PolicyChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolicyChecker.cpp; sourceTree = "<group>"; }; 97059976107D975200A50A7C /* PolicyChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolicyChecker.h; sourceTree = "<group>"; }; + 9719AEFF11D09F2C00D45831 /* HTMLInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLInputStream.h; sourceTree = "<group>"; }; 9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentWriter.cpp; sourceTree = "<group>"; }; 9738899F116EA9DC00ADF313 /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; }; 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadNotifier.cpp; sourceTree = "<group>"; }; 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadNotifier.h; sourceTree = "<group>"; }; - 976E895E11C0CA3A00EA9CA9 /* HTML5EntityParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5EntityParser.cpp; sourceTree = "<group>"; }; - 976E895F11C0CA3A00EA9CA9 /* HTML5EntityParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5EntityParser.h; sourceTree = "<group>"; }; + 976E2BA511CAE4DE006C56A0 /* CSSPreloadScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPreloadScanner.cpp; sourceTree = "<group>"; }; + 976E2BA611CAE4DE006C56A0 /* CSSPreloadScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPreloadScanner.h; sourceTree = "<group>"; }; + 976E895E11C0CA3A00EA9CA9 /* HTMLEntityParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLEntityParser.cpp; sourceTree = "<group>"; }; + 976E895F11C0CA3A00EA9CA9 /* HTMLEntityParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLEntityParser.h; sourceTree = "<group>"; }; 979F43D11075E44A0000F83B /* RedirectScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RedirectScheduler.cpp; sourceTree = "<group>"; }; 979F43D21075E44A0000F83B /* RedirectScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RedirectScheduler.h; sourceTree = "<group>"; }; 97C0784F1165D5BE003A32EF /* SuffixTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuffixTree.h; sourceTree = "<group>"; }; @@ -8169,9 +8176,11 @@ 97DCE20010807C750057D394 /* HistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryController.h; sourceTree = "<group>"; }; 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSSAuditor.cpp; sourceTree = "<group>"; }; 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; }; - 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5Lexer.cpp; sourceTree = "<group>"; }; - 97E8B35511A23CE200169409 /* HTML5Lexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5Lexer.h; sourceTree = "<group>"; }; - 97E8B3C211A2890800169409 /* HTML5Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5Token.h; sourceTree = "<group>"; }; + 97E7936311C6030900E649BC /* HTMLPreloadScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPreloadScanner.cpp; sourceTree = "<group>"; }; + 97E7936411C6030900E649BC /* HTMLPreloadScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLPreloadScanner.h; sourceTree = "<group>"; }; + 97E8B35411A23CE200169409 /* HTMLTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTokenizer.cpp; sourceTree = "<group>"; }; + 97E8B35511A23CE200169409 /* HTMLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTokenizer.h; sourceTree = "<group>"; }; + 97E8B3C211A2890800169409 /* HTMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLToken.h; sourceTree = "<group>"; }; 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; }; 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; }; 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; }; @@ -8242,6 +8251,8 @@ A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; }; A795463D0B5C4C80007B438F /* DragDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DragDataMac.mm; sourceTree = "<group>"; }; A79546420B5C4CB4007B438F /* DragData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragData.cpp; sourceTree = "<group>"; }; + A7AA66D411C5ED6A001D8C8C /* RenderIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderIndicator.cpp; sourceTree = "<group>"; }; + A7AA66D511C5ED6A001D8C8C /* RenderIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderIndicator.h; sourceTree = "<group>"; }; A7AD2F850EC89D07008AB002 /* LinkHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkHash.cpp; sourceTree = "<group>"; }; A7AD2F860EC89D07008AB002 /* LinkHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkHash.h; sourceTree = "<group>"; }; A7B6E69D0B291A9600D0529F /* DragData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragData.h; sourceTree = "<group>"; }; @@ -8409,8 +8420,8 @@ A833C7F60A2CF1D800D57664 /* xmlattrs.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = xmlattrs.in; sourceTree = "<group>"; }; A833C80A0A2CF25600D57664 /* XMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XMLNames.cpp; sourceTree = "<group>"; }; A833C80B0A2CF25600D57664 /* XMLNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XMLNames.h; sourceTree = "<group>"; }; - A83B3AEE11ADEFF500458809 /* HTML5ScriptRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5ScriptRunner.cpp; sourceTree = "<group>"; }; - A83B3AEF11ADEFF500458809 /* HTML5ScriptRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5ScriptRunner.h; sourceTree = "<group>"; }; + A83B3AEE11ADEFF500458809 /* HTMLScriptRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLScriptRunner.cpp; sourceTree = "<group>"; }; + A83B3AEF11ADEFF500458809 /* HTMLScriptRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLScriptRunner.h; sourceTree = "<group>"; }; A83B78F20CCAFF15000B0825 /* JSSVGFontFaceUriElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGFontFaceUriElement.h; sourceTree = "<group>"; }; A83B78F30CCAFF15000B0825 /* JSSVGFontFaceUriElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGFontFaceUriElement.cpp; sourceTree = "<group>"; }; A83B78F40CCAFF15000B0825 /* JSSVGFontFaceSrcElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGFontFaceSrcElement.h; sourceTree = "<group>"; }; @@ -8437,9 +8448,11 @@ A83B79470CCB0125000B0825 /* DOMSVGFontFaceElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGFontFaceElement.mm; sourceTree = "<group>"; }; A83B79480CCB0125000B0825 /* DOMSVGFontFaceElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGFontFaceElement.h; sourceTree = "<group>"; }; A83E1C720E49042B00140B9C /* ScriptControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScriptControllerMac.mm; sourceTree = "<group>"; }; + A84D827B11D333ED00972990 /* RawDataDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RawDataDocumentParser.h; sourceTree = "<group>"; }; A84EBD770CB8C89200079609 /* JSStyleSheetListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheetListCustom.cpp; sourceTree = "<group>"; }; A84EBD810CB8C97700079609 /* JSStyleSheetList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStyleSheetList.h; sourceTree = "<group>"; }; A84EBD820CB8C97700079609 /* JSStyleSheetList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheetList.cpp; sourceTree = "<group>"; }; + A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FragmentScriptingPermission.h; sourceTree = "<group>"; }; A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; }; A86629C909DA2B47009633A5 /* JSUIEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSUIEvent.h; sourceTree = "<group>"; }; A86629CA09DA2B47009633A5 /* JSUIEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSUIEvent.cpp; sourceTree = "<group>"; }; @@ -8447,8 +8460,8 @@ A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; }; A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; }; A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; }; - A871038811A2947000DBD50E /* HTML5DocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5DocumentParser.cpp; sourceTree = "<group>"; }; - A871038911A2947000DBD50E /* HTML5DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5DocumentParser.h; sourceTree = "<group>"; }; + A871038811A2947000DBD50E /* HTMLDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocumentParser.cpp; sourceTree = "<group>"; }; + A871038911A2947000DBD50E /* HTMLDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocumentParser.h; sourceTree = "<group>"; }; A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; }; A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; }; A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; }; @@ -8507,9 +8520,9 @@ A871DFDF0A15376B00B12A68 /* RenderReplaced.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderReplaced.h; sourceTree = "<group>"; }; A871DFE00A15376B00B12A68 /* RenderWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderWidget.h; sourceTree = "<group>"; }; A871DFE10A15376B00B12A68 /* RenderWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderWidget.cpp; sourceTree = "<group>"; }; - A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTML5TreeBuilder.cpp; sourceTree = "<group>"; }; - A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5TreeBuilder.h; sourceTree = "<group>"; }; - A87F163411AE841300CBB2E5 /* HTML5ScriptRunnerHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTML5ScriptRunnerHost.h; sourceTree = "<group>"; }; + A879C62311A9D1F70059237A /* HTMLTreeBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTreeBuilder.cpp; sourceTree = "<group>"; }; + A879C62411A9D1F70059237A /* HTMLTreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTreeBuilder.h; sourceTree = "<group>"; }; + A87F163411AE841300CBB2E5 /* HTMLScriptRunnerHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLScriptRunnerHost.h; sourceTree = "<group>"; }; A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleSelection.cpp; sourceTree = "<group>"; }; A883DF260F3D045D00F19BF6 /* VisibleSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleSelection.h; sourceTree = "<group>"; }; A88DD4860B4629A300C02990 /* PathTraversalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathTraversalState.h; sourceTree = "<group>"; }; @@ -8744,6 +8757,8 @@ A8E544BF0CA9D1C20097D09B /* DOMSVGAnimatedAngleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGAnimatedAngleInternal.h; sourceTree = "<group>"; }; A8E544C10CA9D1C20097D09B /* DOMSVGTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGTextElement.h; sourceTree = "<group>"; }; A8E544C30CA9D1C20097D09B /* DOMSVGDescElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGDescElementInternal.h; sourceTree = "<group>"; }; + A8E6A77F11D1661B00311F4A /* HTMLParserScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLParserScheduler.h; sourceTree = "<group>"; }; + A8E6A78011D1661B00311F4A /* HTMLParserScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserScheduler.cpp; sourceTree = "<group>"; }; A8EA73AF0A1900E300A8EF5F /* RenderFieldset.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFieldset.cpp; sourceTree = "<group>"; }; A8EA73B00A1900E300A8EF5F /* RenderFieldset.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFieldset.h; sourceTree = "<group>"; }; A8EA79E50A1916DF00A8EF5F /* HTMLOListElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLOListElement.h; sourceTree = "<group>"; }; @@ -8816,7 +8831,6 @@ A9C6E4EE0D745E38006442E9 /* PluginArray.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginArray.h; sourceTree = "<group>"; }; A9C6E4F10D745E48006442E9 /* PluginData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PluginData.cpp; sourceTree = "<group>"; }; A9C6E4F20D745E48006442E9 /* PluginData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginData.h; sourceTree = "<group>"; }; - A9C6E4F50D745E61006442E9 /* PluginDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = PluginDataMac.mm; path = mac/PluginDataMac.mm; sourceTree = "<group>"; }; A9C6E5A30D746458006442E9 /* Navigator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Navigator.cpp; sourceTree = "<group>"; }; A9C6E5A40D746458006442E9 /* Navigator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Navigator.h; sourceTree = "<group>"; }; A9C6E6460D7465CA006442E9 /* JSMimeTypeArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMimeTypeArrayCustom.cpp; sourceTree = "<group>"; }; @@ -9734,6 +9748,8 @@ B523CF021182675400EBB29C /* SQLTransactionSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionSync.cpp; sourceTree = "<group>"; }; B523CF031182675400EBB29C /* DatabaseSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseSync.cpp; sourceTree = "<group>"; }; B523CF041182675400EBB29C /* DatabaseSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseSync.h; sourceTree = "<group>"; }; + B525A96311CA2340003A23A8 /* JSSQLException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLException.h; sourceTree = "<group>"; }; + B525A96411CA2340003A23A8 /* JSSQLException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLException.cpp; sourceTree = "<group>"; }; B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; }; B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCallback.cpp; sourceTree = "<group>"; }; B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSyncCustom.cpp; sourceTree = "<group>"; }; @@ -9741,6 +9757,8 @@ B55D5ABB1191327200BCC315 /* DatabaseSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseSync.idl; sourceTree = "<group>"; }; B55D5ABC1191327200BCC315 /* SQLTransactionSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransactionSync.idl; sourceTree = "<group>"; }; B55D5ABD1191327200BCC315 /* SQLTransactionSyncCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransactionSyncCallback.idl; sourceTree = "<group>"; }; + B56EBA8311C9FF8100B04477 /* SQLException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLException.h; sourceTree = "<group>"; }; + B56EBA8411C9FF8100B04477 /* SQLException.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLException.idl; sourceTree = "<group>"; }; B58CEB6711913607002A6790 /* JSDatabaseSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDatabaseSync.h; sourceTree = "<group>"; }; B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSync.cpp; sourceTree = "<group>"; }; B58CEB6B1191361C002A6790 /* JSSQLTransactionSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSync.h; sourceTree = "<group>"; }; @@ -9863,6 +9881,10 @@ BC23EE910DAED2BC009FDC91 /* CSSImageGeneratorValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSImageGeneratorValue.h; sourceTree = "<group>"; }; BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedImage.h; sourceTree = "<group>"; }; BC2441C30E8B65D00055320F /* ScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollView.cpp; sourceTree = "<group>"; }; + BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitPointCustom.cpp; sourceTree = "<group>"; }; + BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixCustom.cpp; sourceTree = "<group>"; }; + BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceCustom.cpp; sourceTree = "<group>"; }; + BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferCustom.cpp; sourceTree = "<group>"; }; BC2CC8DE0F32881000A9DF26 /* RenderObjectChildList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderObjectChildList.h; sourceTree = "<group>"; }; BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSElementCustom.cpp; sourceTree = "<group>"; }; BC2ED64F0C6BC48C00920BFF /* JSHTMLIFrameElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLIFrameElementCustom.cpp; sourceTree = "<group>"; }; @@ -10259,8 +10281,6 @@ BCE789851120E7A60060ECE5 /* BidiRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiRun.h; sourceTree = "<group>"; }; BCE7898A1120E8020060ECE5 /* BidiRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BidiRun.cpp; sourceTree = "<group>"; }; BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHistoryCustom.cpp; sourceTree = "<group>"; }; - BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessorConstructor.cpp; sourceTree = "<group>"; }; - BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessorConstructor.h; sourceTree = "<group>"; }; BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSComputedStyleDeclaration.cpp; sourceTree = "<group>"; }; BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSComputedStyleDeclaration.h; sourceTree = "<group>"; }; BCEA477E097CAAC80094C9E4 /* CSSGrammar.y */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.yacc; path = CSSGrammar.y; sourceTree = "<group>"; }; @@ -10430,8 +10450,14 @@ CE4C00E310F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLNoScriptElement.cpp; sourceTree = "<group>"; }; CE4C00E510F6F7C100CA38F5 /* HTMLNoScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLNoScriptElement.h; sourceTree = "<group>"; }; CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceProvider.h; sourceTree = "<group>"; }; + CEA3949A11D45CDA003094CF /* StaticHashSetNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticHashSetNodeList.cpp; sourceTree = "<group>"; }; + CEA3949B11D45CDA003094CF /* StaticHashSetNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticHashSetNodeList.h; sourceTree = "<group>"; }; CEF418CC1179678C009D112C /* ViewportArguments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportArguments.cpp; sourceTree = "<group>"; }; CEF418CD1179678C009D112C /* ViewportArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportArguments.h; sourceTree = "<group>"; }; + D000EBA011BDAFD400C47726 /* FrameLoaderStateMachine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoaderStateMachine.cpp; sourceTree = "<group>"; }; + D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoaderStateMachine.h; sourceTree = "<group>"; }; + D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubframeLoader.cpp; sourceTree = "<group>"; }; + D000ED2611C1B9CD00C47726 /* SubframeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubframeLoader.h; sourceTree = "<group>"; }; D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpaceSplitString.cpp; sourceTree = "<group>"; }; D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceSplitString.h; sourceTree = "<group>"; }; D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FormatBlockCommand.cpp; sourceTree = "<group>"; }; @@ -10458,12 +10484,8 @@ E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventSource.cpp; sourceTree = "<group>"; }; E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSource.h; sourceTree = "<group>"; }; E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSource.cpp; sourceTree = "<group>"; }; - E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSourceConstructor.h; sourceTree = "<group>"; }; - E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceConstructor.cpp; sourceTree = "<group>"; }; E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = "<group>"; }; E107400C0E77BDC00033AF24 /* JSMessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannel.h; sourceTree = "<group>"; }; - E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelConstructor.cpp; sourceTree = "<group>"; }; - E10743260E7835A50033AF24 /* JSMessageChannelConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannelConstructor.h; sourceTree = "<group>"; }; E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomXPathNSResolver.h; sourceTree = "<group>"; }; E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomXPathNSResolver.cpp; sourceTree = "<group>"; }; E10B9B6A0B747599003ED890 /* NativeXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeXPathNSResolver.h; sourceTree = "<group>"; }; @@ -10536,8 +10558,6 @@ E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMObject.cpp; sourceTree = "<group>"; }; E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorker.cpp; sourceTree = "<group>"; }; E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerCustom.cpp; sourceTree = "<group>"; }; - E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerConstructor.h; sourceTree = "<group>"; }; - E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerConstructor.cpp; sourceTree = "<group>"; }; E1CAA5C50E8BD23600A73ECA /* JSWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorker.h; sourceTree = "<group>"; }; E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowsKeyboardCodes.h; sourceTree = "<group>"; }; E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElement.cpp; sourceTree = "<group>"; }; @@ -10619,8 +10639,8 @@ E4C178960EE6903800824D69 /* CSSSelectorList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSelectorList.h; sourceTree = "<group>"; }; E4C279560CF9741900E97B98 /* RenderMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMedia.cpp; sourceTree = "<group>"; }; E4C279570CF9741900E97B98 /* RenderMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMedia.h; sourceTree = "<group>"; }; - E4D4ABE00D7542F000F96869 /* PreloadScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreloadScanner.cpp; sourceTree = "<group>"; }; - E4D4ABE10D7542F100F96869 /* PreloadScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreloadScanner.h; sourceTree = "<group>"; }; + E4D4ABE00D7542F000F96869 /* LegacyPreloadScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyPreloadScanner.cpp; sourceTree = "<group>"; }; + E4D4ABE10D7542F100F96869 /* LegacyPreloadScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyPreloadScanner.h; sourceTree = "<group>"; }; E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PurgeableBufferMac.cpp; sourceTree = "<group>"; }; E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgeableBuffer.h; sourceTree = "<group>"; }; E4EEFFC60D34550C00469A58 /* JSAudioConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioConstructor.cpp; sourceTree = "<group>"; }; @@ -10644,10 +10664,10 @@ F523D23C02DE4396018635CA /* HTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D23E02DE4396018635CA /* HTMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D23F02DE4396018635CA /* HTMLElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25002DE4396018635CA /* LegacyHTMLTreeConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyHTMLTreeConstructor.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25102DE4396018635CA /* LegacyHTMLTreeConstructor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = LegacyHTMLTreeConstructor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25202DE4396018635CA /* HTMLDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocumentParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - F523D25302DE4396018635CA /* HTMLDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocumentParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyHTMLTreeBuilder.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = LegacyHTMLTreeBuilder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25202DE4396018635CA /* LegacyHTMLDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyHTMLDocumentParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + F523D25302DE4396018635CA /* LegacyHTMLDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = LegacyHTMLDocumentParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextResourceDecoder.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D27902DE43D7018635CA /* TextResourceDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextResourceDecoder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D30302DE4476018635CA /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Range.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -10794,7 +10814,6 @@ 93EEC1EC09C2877700C515D1 /* html */, 1C81B94D0E9732D900266E07 /* inspector */, BCB16BFB0979C38700467741 /* loader */, - FABE72EC1059C1EB00D999DD /* mathml */, 333F703D0FB49C16008E12A6 /* notifications */, 65BF02180974806300C43196 /* page */, BCF1A5BA097832090061A123 /* platform */, @@ -11061,15 +11080,6 @@ 1AE82EC90CAAE177002237AE /* storage */ = { isa = PBXGroup; children = ( - 81CC114011BEAA9D00D0D856 /* IDBKeyRange.idl */, - 816C806611BE887E009A45E9 /* IDBKeyRange.cpp */, - 816C806711BE887E009A45E9 /* IDBKeyRange.h */, - B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */, - B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */, - B6693EEF11AD63F6003F2770 /* IDBObjectStoreRequest.idl */, - B6693EE811AD63E6003F2770 /* IDBObjectStore.h */, - B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */, - B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */, B5B5DC67119BB3D5002A8790 /* AbstractDatabase.cpp */, B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */, 514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */, @@ -11118,11 +11128,20 @@ C51DA9A211AEF2C1009799C5 /* IDBIndexRequest.cpp */, C51DA9A311AEF2C1009799C5 /* IDBIndexRequest.h */, C51DA9A411AEF2C1009799C5 /* IDBIndexRequest.idl */, + 816C806611BE887E009A45E9 /* IDBKeyRange.cpp */, + 816C806711BE887E009A45E9 /* IDBKeyRange.h */, + 81CC114011BEAA9D00D0D856 /* IDBKeyRange.idl */, + B6693EE811AD63E6003F2770 /* IDBObjectStore.h */, B6693EE811AD63E6003F2770 /* IDBObjectStore.h */, B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */, + B6B0540711B68F10002564C5 /* IDBObjectStoreImpl.cpp */, + B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */, B6B0540811B68F10002564C5 /* IDBObjectStoreImpl.h */, B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */, + B6693EE911AD63E6003F2770 /* IDBObjectStoreRequest.cpp */, B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */, + B6693EEA11AD63E6003F2770 /* IDBObjectStoreRequest.h */, + B6693EEF11AD63F6003F2770 /* IDBObjectStoreRequest.idl */, B6693EEF11AD63F6003F2770 /* IDBObjectStoreRequest.idl */, C5198F421192ECFD002B74A6 /* IDBRequest.cpp */, C5198F431192ECFD002B74A6 /* IDBRequest.h */, @@ -11147,6 +11166,8 @@ 51A9267B0D53F0570063ECC2 /* OriginUsageRecord.h */, 51EC92570CE90DB400F90308 /* SQLError.h */, 51EC92580CE90DB400F90308 /* SQLError.idl */, + B56EBA8311C9FF8100B04477 /* SQLException.h */, + B56EBA8411C9FF8100B04477 /* SQLException.idl */, 519611670CAC56570010A80C /* SQLResultSet.cpp */, 519611680CAC56570010A80C /* SQLResultSet.h */, 519611690CAC56570010A80C /* SQLResultSet.idl */, @@ -11264,6 +11285,7 @@ F375CC061150D300008DDB81 /* InspectorWorkerResource.h */, 1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */, BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */, + 200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */, 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */, 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */, 9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */, @@ -11780,6 +11802,8 @@ 51ABAE431043AB4A008C5260 /* WebSocketHandshake.h */, 7637C540112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp */, 7637C542112E7B7E003D6CDC /* WebSocketHandshakeRequest.h */, + 767F99BD11A1194A0080C51D /* WebSocketHandshakeResponse.cpp */, + 767F99BF11A119560080C51D /* WebSocketHandshakeResponse.h */, 5112247710CFB8F4008099D7 /* WorkerThreadableWebSocketChannel.cpp */, 5112247910CFB8FF008099D7 /* WorkerThreadableWebSocketChannel.h */, ); @@ -11848,10 +11872,10 @@ A9C6E6610D74671E006442E9 /* PluginArray.idl */, A9C6E4F10D745E48006442E9 /* PluginData.cpp */, A9C6E4F20D745E48006442E9 /* PluginData.h */, - A9C6E4F50D745E61006442E9 /* PluginDataMac.mm */, 1ADA140E0E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp */, 1ADA140F0E1AE5D900023EE5 /* PluginMainThreadScheduler.h */, 76FF17E211235673001D61B5 /* PluginViewNone.cpp */, + 1AA8798F11CBE846003C664F /* PluginStrategy.h */, 0AFDAC3C10F5448C00E1F3D2 /* PluginWidget.h */, ); path = plugins; @@ -11860,20 +11884,20 @@ 656580EC09D12B20000E61D7 /* Derived Sources */ = { isa = PBXGroup; children = ( - E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */, - E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */, - E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */, - E406F3FB1198307D009D59D6 /* ColorData.cpp */, - E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */, 656581AC09D14EE6000E61D7 /* CharsetData.cpp */, + E406F3FB1198307D009D59D6 /* ColorData.cpp */, 6565814409D13043000E61D7 /* CSSGrammar.cpp */, 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */, + E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */, 656580EE09D12B20000E61D7 /* CSSPropertyNames.gperf */, 656580EF09D12B20000E61D7 /* CSSPropertyNames.h */, + E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */, 6565814709D13043000E61D7 /* CSSValueKeywords.gperf */, 6565814809D13043000E61D7 /* CSSValueKeywords.h */, + E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */, A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */, A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */, + E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */, A8D06B380A265DCD005E7203 /* HTMLNames.cpp */, A8D06B370A265DCD005E7203 /* HTMLNames.h */, 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */, @@ -13416,15 +13440,20 @@ 93EEC1EC09C2877700C515D1 /* html */ = { isa = PBXGroup; children = ( - 49484FAE102CF01E00187DD3 /* canvas */, B0149E7911A4B21500196A7B /* AsyncImageResizer.cpp */, B0149E7A11A4B21500196A7B /* AsyncImageResizer.h */, 2EAFAF0B10E2AF2D007ED3D6 /* Blob.cpp */, 2EAFAF0C10E2AF2D007ED3D6 /* Blob.h */, 2EAFAF0D10E2AF2D007ED3D6 /* Blob.idl */, + 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */, + 89BED5EA11BE11CE00448492 /* BlobBuilder.h */, + 89CD027911C859A80070B791 /* BlobBuilder.idl */, + 49484FAE102CF01E00187DD3 /* canvas */, 93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */, 93C441EE0F813A1A00C1A634 /* CollectionCache.h */, 93C441FF0F813AE100C1A634 /* CollectionType.h */, + 976E2BA511CAE4DE006C56A0 /* CSSPreloadScanner.cpp */, + 976E2BA611CAE4DE006C56A0 /* CSSPreloadScanner.h */, BC77D2380FF298080070887B /* DataGridColumn.cpp */, BC77CFC10FF175550070887B /* DataGridColumn.h */, BC77CF9E0FF172B30070887B /* DataGridColumn.idl */, @@ -13460,18 +13489,20 @@ 895253DE116C4F0600CABF00 /* FileThreadTask.h */, A8136D370973A8E700D74463 /* FormDataList.cpp */, A8136D360973A8E700D74463 /* FormDataList.h */, - 976E895E11C0CA3A00EA9CA9 /* HTML5EntityParser.cpp */, - 976E895F11C0CA3A00EA9CA9 /* HTML5EntityParser.h */, - 97E8B35411A23CE200169409 /* HTML5Lexer.cpp */, - 97E8B35511A23CE200169409 /* HTML5Lexer.h */, - A83B3AEE11ADEFF500458809 /* HTML5ScriptRunner.cpp */, - A83B3AEF11ADEFF500458809 /* HTML5ScriptRunner.h */, - A87F163411AE841300CBB2E5 /* HTML5ScriptRunnerHost.h */, - 97E8B3C211A2890800169409 /* HTML5Token.h */, - A871038811A2947000DBD50E /* HTML5DocumentParser.cpp */, - A871038911A2947000DBD50E /* HTML5DocumentParser.h */, - A879C62311A9D1F70059237A /* HTML5TreeBuilder.cpp */, - A879C62411A9D1F70059237A /* HTML5TreeBuilder.h */, + A871038811A2947000DBD50E /* HTMLDocumentParser.cpp */, + A871038911A2947000DBD50E /* HTMLDocumentParser.h */, + 976E895E11C0CA3A00EA9CA9 /* HTMLEntityParser.cpp */, + 976E895F11C0CA3A00EA9CA9 /* HTMLEntityParser.h */, + 97E8B35411A23CE200169409 /* HTMLTokenizer.cpp */, + 97E8B35511A23CE200169409 /* HTMLTokenizer.h */, + 97E7936311C6030900E649BC /* HTMLPreloadScanner.cpp */, + 97E7936411C6030900E649BC /* HTMLPreloadScanner.h */, + A83B3AEE11ADEFF500458809 /* HTMLScriptRunner.cpp */, + A83B3AEF11ADEFF500458809 /* HTMLScriptRunner.h */, + A87F163411AE841300CBB2E5 /* HTMLScriptRunnerHost.h */, + 97E8B3C211A2890800169409 /* HTMLToken.h */, + A879C62311A9D1F70059237A /* HTMLTreeBuilder.cpp */, + A879C62411A9D1F70059237A /* HTMLTreeBuilder.h */, BC97E239109144950010D361 /* HTMLAllCollection.cpp */, BC97E238109144950010D361 /* HTMLAllCollection.h */, BC97E23C109146F10010D361 /* HTMLAllCollection.idl */, @@ -13539,6 +13570,8 @@ F523D23B02DE4396018635CA /* HTMLDocument.cpp */, F523D23C02DE4396018635CA /* HTMLDocument.h */, 1A494E290A12354300FDAFC1 /* HTMLDocument.idl */, + F523D25202DE4396018635CA /* LegacyHTMLDocumentParser.cpp */, + F523D25302DE4396018635CA /* LegacyHTMLDocumentParser.h */, F523D23E02DE4396018635CA /* HTMLElement.cpp */, F523D23F02DE4396018635CA /* HTMLElement.h */, 1A494BBB0A122DCD00FDAFC1 /* HTMLElement.idl */, @@ -13591,6 +13624,7 @@ A81369B1097374F500D74463 /* HTMLInputElement.cpp */, A81369B0097374F500D74463 /* HTMLInputElement.h */, A80E7E170A1A7CCB007FB8C5 /* HTMLInputElement.idl */, + 9719AEFF11D09F2C00D45831 /* HTMLInputStream.h */, A81369AF097374F500D74463 /* HTMLIsIndexElement.cpp */, A81369AE097374F500D74463 /* HTMLIsIndexElement.h */, 1AE2AA850A1CDCCE00B42B25 /* HTMLIsIndexElement.idl */, @@ -13654,11 +13688,11 @@ A871D44F0A127CBC00B12A68 /* HTMLParamElement.cpp */, A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */, 1AE2AB720A1CE81500B42B25 /* HTMLParamElement.idl */, - F523D25002DE4396018635CA /* LegacyHTMLTreeConstructor.cpp */, - F523D25102DE4396018635CA /* LegacyHTMLTreeConstructor.h */, BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */, BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */, 449B19F30FA72ECE0015CA4A /* HTMLParserQuirks.h */, + A8E6A78011D1661B00311F4A /* HTMLParserScheduler.cpp */, + A8E6A77F11D1661B00311F4A /* HTMLParserScheduler.h */, A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */, A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */, 4415292D0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp */, @@ -13713,8 +13747,6 @@ A871DC1D0A15205700B12A68 /* HTMLTitleElement.cpp */, A871DC1C0A15205700B12A68 /* HTMLTitleElement.h */, A80E7AAE0A19D1F1007FB8C5 /* HTMLTitleElement.idl */, - F523D25202DE4396018635CA /* HTMLDocumentParser.cpp */, - F523D25302DE4396018635CA /* HTMLDocumentParser.h */, A8EA79E70A1916DF00A8EF5F /* HTMLUListElement.cpp */, A8EA79E60A1916DF00A8EF5F /* HTMLUListElement.h */, 1A85B1D50A1B236C00D8C87C /* HTMLUListElement.idl */, @@ -13730,10 +13762,12 @@ B0149E7C11A4B21500196A7B /* ImageResizerThread.h */, A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */, A456FA2511AD4A830020B420 /* LabelsNodeList.h */, + F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */, + F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */, E446139B0CD6331000FADA75 /* MediaError.h */, E446139C0CD6331000FADA75 /* MediaError.idl */, - E4D4ABE00D7542F000F96869 /* PreloadScanner.cpp */, - E4D4ABE10D7542F100F96869 /* PreloadScanner.h */, + E4D4ABE00D7542F000F96869 /* LegacyPreloadScanner.cpp */, + E4D4ABE10D7542F100F96869 /* LegacyPreloadScanner.h */, A5AFB34D115151A700B045CB /* StepRange.cpp */, A5AFB34E115151A700B045CB /* StepRange.h */, BCEF45E80E687767001C1287 /* TextMetrics.h */, @@ -13803,6 +13837,8 @@ 49EECF1A105072F300099FAB /* JSArrayBufferView.h */, 2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */, 2E2D99CC10E2BBDA00496337 /* JSBlob.h */, + 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */, + 89CD029211C85B870070B791 /* JSBlobBuilder.h */, 65DF323309D1DE65000BE325 /* JSCanvasGradient.cpp */, 65DF323409D1DE65000BE325 /* JSCanvasGradient.h */, 65DF323509D1DE65000BE325 /* JSCanvasPattern.cpp */, @@ -14501,6 +14537,8 @@ C56C919F119D918100DE4CD9 /* JSIDBEvent.h */, C5BBC9CE11AEF838007C2BFE /* JSIDBIndexRequest.cpp */, C5BBC9CF11AEF838007C2BFE /* JSIDBIndexRequest.h */, + 816C80B011BE9934009A45E9 /* JSIDBKeyRange.cpp */, + 816C80AE11BE990D009A45E9 /* JSIDBKeyRange.h */, B6693EF011AD6486003F2770 /* JSIDBObjectStoreRequest.cpp */, B6693EF111AD6486003F2770 /* JSIDBObjectStoreRequest.h */, C5F4F404119306AC00FDFADD /* JSIDBRequest.cpp */, @@ -14511,6 +14549,8 @@ C5F4F40F119306C000FDFADD /* JSIndexedDatabaseRequest.h */, 514C76350CE9225E007EF3CD /* JSSQLError.cpp */, BC8243250D0CE8A200460C8F /* JSSQLError.h */, + B525A96311CA2340003A23A8 /* JSSQLException.h */, + B525A96411CA2340003A23A8 /* JSSQLException.cpp */, 1AE82FEA0CAB07EE002237AE /* JSSQLResultSet.cpp */, 1AE82FEB0CAB07EE002237AE /* JSSQLResultSet.h */, 1AFE11970CBFFCC4003017FA /* JSSQLResultSetRowList.cpp */, @@ -14533,8 +14573,6 @@ 51E3F9D50DA05E1D00250911 /* JSStorage.h */, 51E0BAE80DA55D4A00A9E417 /* JSStorageEvent.cpp */, 51E0BAE90DA55D4A00A9E417 /* JSStorageEvent.h */, - 816C80AE11BE990D009A45E9 /* JSIDBKeyRange.h */, - 816C80B011BE9934009A45E9 /* JSIDBKeyRange.cpp */, ); name = Storage; sourceTree = "<group>"; @@ -15096,8 +15134,6 @@ B27535490B053814002CE64F /* mac */ = { isa = PBXGroup; children = ( - 49C7B9FD1042D38C0009D447 /* Canvas3DLayer.h */, - 49C7B9FE1042D38C0009D447 /* Canvas3DLayer.mm */, EDE3A4FF0C7A430600956A37 /* ColorMac.h */, B275354A0B053814002CE64F /* ColorMac.mm */, 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */, @@ -15115,7 +15151,7 @@ B2AFFC790D00A5C10030074D /* FontPlatformData.h */, B2AFFC7A0D00A5C10030074D /* FontPlatformDataMac.mm */, B2AFFC7B0D00A5C10030074D /* GlyphPageTreeNodeMac.cpp */, - 49C7B9FF1042D38C0009D447 /* GraphicsContext3DMac.cpp */, + 49FFBF1C11C8550E006A7118 /* GraphicsContext3DMac.mm */, B277B4030B22F37C0004BEC6 /* GraphicsContextMac.mm */, 0F580B040F12A2550051D689 /* GraphicsLayerCA.h */, 0F580B030F12A2540051D689 /* GraphicsLayerCA.mm */, @@ -15130,6 +15166,8 @@ 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */, 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */, B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */, + 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */, + 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */, 0FCF332B0F2B9A25004B6795 /* WebLayer.h */, 0FCF332A0F2B9A25004B6795 /* WebLayer.mm */, 0FCF33290F2B9A25004B6795 /* WebTiledLayer.h */, @@ -15240,6 +15278,7 @@ B2B264590D00A77E000ACC1D /* cf */ = { isa = PBXGroup; children = ( + 371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */, B2B2645A0D00A77E000ACC1D /* StringCF.cpp */, B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */, ); @@ -15261,6 +15300,7 @@ B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */, B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */, B2C3D9F50D006C1D00EF6F26 /* CharacterNames.h */, + 375CD231119D43C800A2A859 /* Hyphenation.h */, BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */, B2C3D9FB0D006C1D00EF6F26 /* PlatformString.h */, B2C3D9FC0D006C1D00EF6F26 /* RegularExpression.cpp */, @@ -15308,6 +15348,7 @@ children = ( B2AFFC850D00A5DF0030074D /* character-sets.txt */, B2C3D9FA0D006C1D00EF6F26 /* CharsetData.h */, + 375CD239119D44EA00A2A859 /* HyphenationMac.mm */, B2AFFC860D00A5DF0030074D /* mac-encodings.txt */, B2AFFC870D00A5DF0030074D /* make-charset-table.pl */, B2AFFC880D00A5DF0030074D /* ShapeArabic.c */, @@ -15395,8 +15436,6 @@ 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */, 93B70D4F09EB0C7C009D8468 /* JSPluginElementFunctions.cpp */, 93B70D5009EB0C7C009D8468 /* JSPluginElementFunctions.h */, - 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */, - 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */, 14CD8D81106B529000A46D23 /* JSSharedWorkerCustom.cpp */, B21127A50B3186770009BE53 /* JSSVGPODTypeWrapper.h */, E1C36D320EB0A094007410BC /* JSWorkerContextBase.cpp */, @@ -15498,6 +15537,7 @@ BC4EDEF70C08F414007EDD49 /* Custom */ = { isa = PBXGroup; children = ( + BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */, 492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */, 86243D0011BC31F700CC006A /* JSArrayBufferViewHelper.h */, BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */, @@ -15523,6 +15563,7 @@ 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, + BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */, 49EECF7210508D9C00099FAB /* JSFloat32ArrayCustom.cpp */, FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */, BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, @@ -15587,6 +15628,8 @@ 49EECF7610508D9C00099FAB /* JSUint32ArrayCustom.cpp */, 49EECF7510508D9C00099FAB /* JSUint8ArrayCustom.cpp */, 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */, + BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */, + BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */, 518A34C61026C8C9001B6896 /* JSWebSocketCustom.cpp */, E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */, E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */, @@ -15719,6 +15762,7 @@ BCB16BFB0979C38700467741 /* loader */ = { isa = PBXGroup; children = ( + FABE72EC1059C1EB00D999DD /* mathml */, 1A8F6BB00DB55CDC001DB794 /* appcache */, 512DD8E80D91E691000F89EE /* archive */, 5126E6B60A2E3AEF005C29FA /* icon */, @@ -15761,9 +15805,13 @@ B255990D0D00D8B900BB825C /* EmptyClients.h */, 656D37230ADBA5DE00A4554D /* FormState.cpp */, 656D37220ADBA5DE00A4554D /* FormState.h */, + 41885B9111B6FDA6003383BB /* FormSubmission.h */, + 41885B9211B6FDA6003383BB /* FormSubmission.cpp */, 932E16080AF578340025F408 /* FrameLoader.cpp */, 656D37240ADBA5DE00A4554D /* FrameLoader.h */, 656D37260ADBA5DE00A4554D /* FrameLoaderClient.h */, + D000EBA011BDAFD400C47726 /* FrameLoaderStateMachine.cpp */, + D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */, 93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */, 51E4ADB20C42B4CF0042BC55 /* FTPDirectoryDocument.cpp */, 51E4ADB30C42B4CF0042BC55 /* FTPDirectoryDocument.h */, @@ -15805,6 +15853,8 @@ 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */, 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */, 51327D5E11A33A2B004F9D65 /* SinkDocument.h */, + D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */, + D000ED2611C1B9CD00C47726 /* SubframeLoader.h */, 93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */, 656D37300ADBA5DE00A4554D /* SubresourceLoader.h */, 1A3178920B20A81600316987 /* SubresourceLoaderClient.h */, @@ -15854,44 +15904,12 @@ BCCE58B41061E925008FB35A /* Constructors */ = { isa = PBXGroup; children = ( - 49EECF991050938200099FAB /* JSArrayBufferConstructor.cpp */, - 49EECF9A1050938200099FAB /* JSArrayBufferConstructor.h */, E4EEFFC60D34550C00469A58 /* JSAudioConstructor.cpp */, E4EEFFC70D34550C00469A58 /* JSAudioConstructor.h */, - E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */, - E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */, - 49EECF9D1050938200099FAB /* JSFloat32ArrayConstructor.cpp */, - 49EECF9E1050938200099FAB /* JSFloat32ArrayConstructor.h */, BC6C49F10D7DBA0500FFA558 /* JSImageConstructor.cpp */, BC6C49F20D7DBA0500FFA558 /* JSImageConstructor.h */, - 49EECFA31050938200099FAB /* JSInt16ArrayConstructor.cpp */, - 49EECFA41050938200099FAB /* JSInt16ArrayConstructor.h */, - 49EECF9F1050938200099FAB /* JSInt32ArrayConstructor.cpp */, - 49EECFA01050938200099FAB /* JSInt32ArrayConstructor.h */, - 49EECF9B1050938200099FAB /* JSInt8ArrayConstructor.cpp */, - 49EECF9C1050938200099FAB /* JSInt8ArrayConstructor.h */, - E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */, - E10743260E7835A50033AF24 /* JSMessageChannelConstructor.h */, A826E8AD0A1A8F2300CD1BB6 /* JSOptionConstructor.cpp */, A826E8AC0A1A8F2300CD1BB6 /* JSOptionConstructor.h */, - 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */, - 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */, - 49EECFA91050938200099FAB /* JSUint16ArrayConstructor.cpp */, - 49EECFAA1050938200099FAB /* JSUint16ArrayConstructor.h */, - 49EECFA71050938200099FAB /* JSUint32ArrayConstructor.cpp */, - 49EECFA81050938200099FAB /* JSUint32ArrayConstructor.h */, - 49EECFA51050938200099FAB /* JSUint8ArrayConstructor.cpp */, - 49EECFA61050938200099FAB /* JSUint8ArrayConstructor.h */, - 498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */, - 498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */, - 494BD7970F55C90E00747828 /* JSWebKitPointConstructor.cpp */, - 494BD7980F55C90E00747828 /* JSWebKitPointConstructor.h */, - 518A34C41026C8C9001B6896 /* JSWebSocketConstructor.cpp */, - 518A34C51026C8C9001B6896 /* JSWebSocketConstructor.h */, - E1CA5CD50E8CDEE900E8EF90 /* JSWorkerConstructor.cpp */, - E1CA5CD20E8CDE8000E8EF90 /* JSWorkerConstructor.h */, - BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */, - BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */, ); name = Constructors; sourceTree = "<group>"; @@ -15970,6 +15988,8 @@ 932871BF0B20DEB70049035A /* PlatformMenuDescription.h */, 935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */, BCEC01D60C274EB4009F4EC9 /* PlatformScreen.h */, + 1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */, + 1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */, 935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */, 0668E1890ADD9624004128E0 /* PopupMenu.h */, ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */, @@ -16414,6 +16434,8 @@ BCEA4837097D93020094C9E4 /* RenderImage.h */, BCB4F8920DB28E530039139B /* RenderImageGeneratedContent.cpp */, BCB4F88F0DB28DD60039139B /* RenderImageGeneratedContent.h */, + A7AA66D411C5ED6A001D8C8C /* RenderIndicator.cpp */, + A7AA66D511C5ED6A001D8C8C /* RenderIndicator.h */, BCEA4838097D93020094C9E4 /* RenderInline.cpp */, BCEA4839097D93020094C9E4 /* RenderInline.h */, BCEA483A097D93020094C9E4 /* RenderLayer.cpp */, @@ -16580,9 +16602,12 @@ 853CA9E50AEEC608002372DC /* SVGRootInlineBox.h */, 08DAB9C01103D9C1003E7ABA /* SVGShadowTreeElements.cpp */, 08DAB9C11103D9C1003E7ABA /* SVGShadowTreeElements.h */, + 0853D72F11C9108F00B2FD42 /* SVGTextChunkLayoutInfo.cpp */, 0842BC801190147200C7D08F /* SVGTextChunkLayoutInfo.h */, 083F529711957FBE00653EBE /* SVGTextLayoutUtilities.cpp */, 083F529811957FBE00653EBE /* SVGTextLayoutUtilities.h */, + 0853D73011C9109000B2FD42 /* SVGTextQuery.cpp */, + 0853D73111C9109000B2FD42 /* SVGTextQuery.h */, A8CFF04C0A154F09000A4234 /* TableLayout.h */, AB014DE10E689A4300E10445 /* TextControlInnerElements.cpp */, AB014DE20E689A4300E10445 /* TextControlInnerElements.h */, @@ -16598,6 +16623,7 @@ F523D32402DE4478018635CA /* dom */ = { isa = PBXGroup; children = ( + A84D827B11D333ED00972990 /* RawDataDocumentParser.h */, E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */, E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */, A8C4A7FC09D563270003AC8D /* Attr.cpp */, @@ -16665,6 +16691,7 @@ A8185F3509765765005826D9 /* DocumentFragment.h */, 1A494ED50A123F1A00FDAFC1 /* DocumentFragment.idl */, ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */, + BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */, A8185F3209765765005826D9 /* DocumentType.cpp */, A8185F3109765765005826D9 /* DocumentType.h */, 93EEC1E809C2877700C515D1 /* DocumentType.idl */, @@ -16803,6 +16830,8 @@ BC7FA67F0D1F167900DB22A9 /* SelectorNodeList.h */, D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */, D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */, + CEA3949A11D45CDA003094CF /* StaticHashSetNodeList.cpp */, + CEA3949B11D45CDA003094CF /* StaticHashSetNodeList.h */, BC7FA62C0D1F0EFF00DB22A9 /* StaticNodeList.cpp */, BC7FA62B0D1F0EFF00DB22A9 /* StaticNodeList.h */, A8C4A7EC09D563270003AC8D /* StyledElement.cpp */, @@ -16817,7 +16846,6 @@ 933A142B0B7D188600A53FFD /* TextEvent.cpp */, 933A142D0B7D188600A53FFD /* TextEvent.h */, 933A142C0B7D188600A53FFD /* TextEvent.idl */, - BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */, 5DB1BC6810715A6400EFAA49 /* TransformSource.h */, 5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */, 854FE72C0A2297BE0058D7AD /* Traversal.cpp */, @@ -16849,6 +16877,7 @@ 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */, 5D15E3A90F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp */, 5D15E3AA0F9E6AC1009E0E3F /* XMLDocumentParserScope.h */, + A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */, ); path = dom; sourceTree = "<group>"; @@ -16887,7 +16916,8 @@ FA7EFB031120D25400CF79C7 /* RenderMathMLUnderOver.cpp */, FA7EFB041120D25400CF79C7 /* RenderMathMLUnderOver.h */, ); - path = mathml; + name = mathml; + path = ../mathml; sourceTree = "<group>"; }; /* End PBXGroup section */ @@ -16967,6 +16997,7 @@ BC5EB9200E82040800B25965 /* BindingURI.h in Headers */, A89943280B42338800D7C802 /* BitmapImage.h in Headers */, 2EAFAF0F10E2AF2D007ED3D6 /* Blob.h in Headers */, + 89BED5EC11BE11CE00448492 /* BlobBuilder.h in Headers */, 8988E10F11A3508B00DB732E /* BlobItem.h in Headers */, 93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */, BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */, @@ -16995,7 +17026,6 @@ BCB16C260979C3BD00467741 /* CachedXBLDocument.h in Headers */, BCB16C280979C3BD00467741 /* CachedXSLStyleSheet.h in Headers */, 93F1995008245E59001E9ABC /* CachePolicy.h in Headers */, - 49C7BA001042D38C0009D447 /* Canvas3DLayer.h in Headers */, 6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */, 49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */, 49C7B9D51042D32F0009D447 /* CanvasObject.h in Headers */, @@ -17088,6 +17118,7 @@ A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */, BC772B3E0C4EA91E0083285F /* CSSParser.h in Headers */, BC02A4B70E0997B9004B6D2B /* CSSParserValues.h in Headers */, + 976E2BA811CAE4DE006C56A0 /* CSSPreloadScanner.h in Headers */, A80E6CE60A1989CA007FB8C5 /* CSSPrimitiveValue.h in Headers */, E1ED8AC30CC49BE000BFC557 /* CSSPrimitiveValueMappings.h in Headers */, A80E6CFF0A1989CA007FB8C5 /* CSSProperty.h in Headers */, @@ -17152,6 +17183,7 @@ A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */, 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */, ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */, + BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */, 0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */, A8185F3909765766005826D9 /* DocumentType.h in Headers */, 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */, @@ -17984,6 +18016,7 @@ A8136D380973A8E700D74463 /* FormDataList.h in Headers */, 514C764E0CE9234E007EF3CD /* FormDataStreamMac.h in Headers */, 656D373A0ADBA5DE00A4554D /* FormState.h in Headers */, + 41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */, 935C476D09AC4D6300A6AAB4 /* FoundationExtras.h in Headers */, 65BF022F0974816300C43196 /* Frame.h in Headers */, 656D373C0ADBA5DE00A4554D /* FrameLoader.h in Headers */, @@ -18027,13 +18060,14 @@ 930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */, 9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */, BC3BC29C0E91AB0F00835588 /* HostWindow.h in Headers */, - 976E896111C0CA3A00EA9CA9 /* HTML5EntityParser.h in Headers */, - 97E8B35711A23CE200169409 /* HTML5Lexer.h in Headers */, - A83B3AF111ADEFF500458809 /* HTML5ScriptRunner.h in Headers */, - A87F163511AE841300CBB2E5 /* HTML5ScriptRunnerHost.h in Headers */, - 97E8B3C311A2890800169409 /* HTML5Token.h in Headers */, - A871038B11A2947000DBD50E /* HTML5DocumentParser.h in Headers */, - A879C62611A9D1F70059237A /* HTML5TreeBuilder.h in Headers */, + A871038B11A2947000DBD50E /* HTMLDocumentParser.h in Headers */, + 976E896111C0CA3A00EA9CA9 /* HTMLEntityParser.h in Headers */, + 97E8B35711A23CE200169409 /* HTMLTokenizer.h in Headers */, + 97E7936611C6030900E649BC /* HTMLPreloadScanner.h in Headers */, + A83B3AF111ADEFF500458809 /* HTMLScriptRunner.h in Headers */, + A87F163511AE841300CBB2E5 /* HTMLScriptRunnerHost.h in Headers */, + 97E8B3C311A2890800169409 /* HTMLToken.h in Headers */, + A879C62611A9D1F70059237A /* HTMLTreeBuilder.h in Headers */, BC97E23A109144950010D361 /* HTMLAllCollection.h in Headers */, A8CFF7AB0A156978000A4234 /* HTMLAnchorElement.h in Headers */, A871D45D0A127CBC00B12A68 /* HTMLAppletElement.h in Headers */, @@ -18056,6 +18090,7 @@ A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */, A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */, 93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */, + 93F198F008245E59001E9ABC /* LegacyHTMLDocumentParser.h in Headers */, 93309DE8099E64920056E581 /* htmlediting.h in Headers */, 93F198E608245E59001E9ABC /* HTMLElement.h in Headers */, A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */, @@ -18100,7 +18135,6 @@ A81369DA097374F600D74463 /* HTMLOptionsCollection.h in Headers */, A8EA7CB50A192B9C00A8EF5F /* HTMLParagraphElement.h in Headers */, A871D4580A127CBC00B12A68 /* HTMLParamElement.h in Headers */, - 93F198EF08245E59001E9ABC /* LegacyHTMLTreeConstructor.h in Headers */, BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */, 449B19F50FA72ECE0015CA4A /* HTMLParserQuirks.h in Headers */, A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */, @@ -18122,12 +18156,12 @@ A871DB250A150BD600B12A68 /* HTMLTableSectionElement.h in Headers */, A81369D6097374F600D74463 /* HTMLTextAreaElement.h in Headers */, A871DC280A15205700B12A68 /* HTMLTitleElement.h in Headers */, - 93F198F008245E59001E9ABC /* HTMLDocumentParser.h in Headers */, A8EA79F20A1916DF00A8EF5F /* HTMLUListElement.h in Headers */, E44613AB0CD6331000FADA75 /* HTMLVideoElement.h in Headers */, BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */, 514C76710CE923A1007EF3CD /* HTTPHeaderMap.h in Headers */, 514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */, + 375CD232119D43C800A2A859 /* Hyphenation.h in Headers */, B275356E0B053814002CE64F /* Icon.h in Headers */, 5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */, 51E1ECBE0C91C90400DC255B /* IconDatabaseClient.h in Headers */, @@ -18143,10 +18177,17 @@ C56C9160119D84E600DE4CD9 /* IDBErrorEvent.h in Headers */, C56C9163119D84E600DE4CD9 /* IDBEvent.h in Headers */, C51DA9A511AEF2C1009799C5 /* IDBIndex.h in Headers */, + C51DA9A511AEF2C1009799C5 /* IDBIndex.h in Headers */, + C51DA9A711AEF2C1009799C5 /* IDBIndexImpl.h in Headers */, C51DA9A711AEF2C1009799C5 /* IDBIndexImpl.h in Headers */, C51DA9A911AEF2C1009799C5 /* IDBIndexRequest.h in Headers */, + C51DA9A911AEF2C1009799C5 /* IDBIndexRequest.h in Headers */, + 816C806911BE887E009A45E9 /* IDBKeyRange.h in Headers */, + B6693EEC11AD63E6003F2770 /* IDBObjectStore.h in Headers */, B6693EEC11AD63E6003F2770 /* IDBObjectStore.h in Headers */, B6B0540A11B68F10002564C5 /* IDBObjectStoreImpl.h in Headers */, + B6B0540A11B68F10002564C5 /* IDBObjectStoreImpl.h in Headers */, + B6693EEE11AD63E6003F2770 /* IDBObjectStoreRequest.h in Headers */, B6693EEE11AD63E6003F2770 /* IDBObjectStoreRequest.h in Headers */, C5198F571192ECFD002B74A6 /* IDBRequest.h in Headers */, C56C9169119D84FF00DE4CD9 /* IDBSuccessEvent.h in Headers */, @@ -18218,7 +18259,6 @@ 93309DF4099E64920056E581 /* JoinTextNodesCommand.h in Headers */, 418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */, 49EECF01105070C400099FAB /* JSArrayBuffer.h in Headers */, - 49EECFAC1050938200099FAB /* JSArrayBufferConstructor.h in Headers */, 49EECF1C105072F300099FAB /* JSArrayBufferView.h in Headers */, 86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */, 65DF31DB09D1C123000BE325 /* JSAttr.h in Headers */, @@ -18226,6 +18266,7 @@ BC124F000C26447A009E2349 /* JSBarInfo.h in Headers */, BC946348107A936600857193 /* JSBeforeLoadEvent.h in Headers */, 2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */, + 89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */, 1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */, 65DF323A09D1DE65000BE325 /* JSCanvasGradient.h in Headers */, 65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */, @@ -18294,7 +18335,6 @@ BC60D9C00D2A269A00B9918F /* JSEventException.h in Headers */, 93B70D6A09EB0C7C009D8468 /* JSEventListener.h in Headers */, E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */, - E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */, BC60901F0E91B8EC000C68B5 /* JSEventTarget.h in Headers */, 3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */, BC00F0150E0A189500FD04E3 /* JSFile.h in Headers */, @@ -18302,7 +18342,6 @@ BC00F0170E0A189500FD04E3 /* JSFileList.h in Headers */, 2E94F43C119207DA00B7F75D /* JSFileReader.h in Headers */, 49EECF03105070C400099FAB /* JSFloat32Array.h in Headers */, - 49EECFB01050938200099FAB /* JSFloat32ArrayConstructor.h in Headers */, FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */, FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */, BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */, @@ -18387,6 +18426,9 @@ C56C91A1119D918100DE4CD9 /* JSIDBErrorEvent.h in Headers */, C56C91A3119D918100DE4CD9 /* JSIDBEvent.h in Headers */, C5BBC9D111AEF838007C2BFE /* JSIDBIndexRequest.h in Headers */, + C5BBC9D111AEF838007C2BFE /* JSIDBIndexRequest.h in Headers */, + 816C80AF11BE990D009A45E9 /* JSIDBKeyRange.h in Headers */, + B6693EF311AD6486003F2770 /* JSIDBObjectStoreRequest.h in Headers */, B6693EF311AD6486003F2770 /* JSIDBObjectStoreRequest.h in Headers */, C5F4F40D119306AC00FDFADD /* JSIDBRequest.h in Headers */, C56C91A7119D918700DE4CD9 /* JSIDBSuccessEvent.h in Headers */, @@ -18397,11 +18439,8 @@ 41F060CE0F5EEB2B00A07EAC /* JSInspectorBackend.h in Headers */, 7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */, 49EECF07105070C400099FAB /* JSInt16Array.h in Headers */, - 49EECFB61050938200099FAB /* JSInt16ArrayConstructor.h in Headers */, 49EECF05105070C400099FAB /* JSInt32Array.h in Headers */, - 49EECFB21050938200099FAB /* JSInt32ArrayConstructor.h in Headers */, 49C7B9961042D2D30009D447 /* JSInt8Array.h in Headers */, - 49EECFAE1050938200099FAB /* JSInt8ArrayConstructor.h in Headers */, 1C5FAED20DCFD90100D58F78 /* JSJavaScriptCallFrame.h in Headers */, A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */, 935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */, @@ -18410,7 +18449,6 @@ BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */, 9FFE3EA611B5A4390037874E /* JSMemoryInfo.h in Headers */, E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */, - E10743270E7835A50033AF24 /* JSMessageChannelConstructor.h in Headers */, 75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */, E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */, 41F584C7104652CB009CAA64 /* JSMessagePortCustom.h in Headers */, @@ -18446,7 +18484,6 @@ 9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */, 9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */, 41D07A7F0FF935CA0095EDCE /* JSSharedWorker.h in Headers */, - 415B7C630FF5A767006770F7 /* JSSharedWorkerConstructor.h in Headers */, 41D1690610238B66009BC827 /* JSSharedWorkerContext.h in Headers */, BC8243290D0CE8A200460C8F /* JSSQLError.h in Headers */, 1AE82FED0CAB07EE002237AE /* JSSQLResultSet.h in Headers */, @@ -18607,11 +18644,8 @@ 1A750D5D0A90DEE1000FF215 /* JSTreeWalker.h in Headers */, A86629CF09DA2B47009633A5 /* JSUIEvent.h in Headers */, 49EECF0D105070C400099FAB /* JSUint16Array.h in Headers */, - 49EECFBC1050938200099FAB /* JSUint16ArrayConstructor.h in Headers */, 49EECF0B105070C400099FAB /* JSUint32Array.h in Headers */, - 49EECFBA1050938200099FAB /* JSUint32ArrayConstructor.h in Headers */, 49EECF09105070C400099FAB /* JSUint8Array.h in Headers */, - 49EECFB81050938200099FAB /* JSUint8ArrayConstructor.h in Headers */, 15C77093100D3CA8005BA267 /* JSValidityState.h in Headers */, A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */, 49C7B9941042D2D30009D447 /* JSWebGLBuffer.h in Headers */, @@ -18627,16 +18661,12 @@ 316FE0720E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h in Headers */, 316FE0740E6CCBEE00BF6088 /* JSWebKitCSSKeyframesRule.h in Headers */, 498391400F1E767500C23782 /* JSWebKitCSSMatrix.h in Headers */, - 498391640F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h in Headers */, 31611E5B0E1C4DE000F6A579 /* JSWebKitCSSTransformValue.h in Headers */, 494BD79E0F55C94C00747828 /* JSWebKitPoint.h in Headers */, - 494BD79A0F55C90E00747828 /* JSWebKitPointConstructor.h in Headers */, 31C0FF400E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.h in Headers */, 5DA5E0FD102B953800088CF9 /* JSWebSocket.h in Headers */, - 518A34C81026C8C9001B6896 /* JSWebSocketConstructor.h in Headers */, 65DF320609D1CC60000BE325 /* JSWheelEvent.h in Headers */, E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */, - E1CA5CD30E8CDE8000E8EF90 /* JSWorkerConstructor.h in Headers */, E18256900EF2B02D00933242 /* JSWorkerContext.h in Headers */, E1C36D350EB0A094007410BC /* JSWorkerContextBase.h in Headers */, F3D461491161D53200CA0D09 /* JSWorkerContextErrorHandler.h in Headers */, @@ -18653,7 +18683,6 @@ 1A762C780A074F2600989F5B /* JSXPathNSResolver.h in Headers */, 1A762C7A0A074F2600989F5B /* JSXPathResult.h in Headers */, BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */, - BCE99EC40DCA624100182683 /* JSXSLTProcessorConstructor.h in Headers */, 85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */, A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */, A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */, @@ -18665,6 +18694,7 @@ A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */, 85EC9AFB0A71A2C600EEEAED /* Language.h in Headers */, 2D9066070BE141D400956998 /* LayoutState.h in Headers */, + 93F198EF08245E59001E9ABC /* LegacyHTMLTreeBuilder.h in Headers */, 512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */, BCE65BEB0EACDF16007E4533 /* Length.h in Headers */, BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */, @@ -18809,7 +18839,7 @@ FE80D7CF0E9C1F25000D6F75 /* PositionErrorCallback.h in Headers */, 37919C240B7D188600A56998 /* PositionIterator.h in Headers */, FE80D7D10E9C1F25000D6F75 /* PositionOptions.h in Headers */, - E49626C30D80D94900E3405C /* PreloadScanner.h in Headers */, + E49626C30D80D94900E3405C /* LegacyPreloadScanner.h in Headers */, B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */, A8EA7EBC0A1945D000A8EF5F /* ProcessingInstruction.h in Headers */, E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */, @@ -18851,6 +18881,7 @@ 0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */, BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */, BCB4F8900DB28DD60039139B /* RenderImageGeneratedContent.h in Headers */, + A7AA66D711C5ED6A001D8C8C /* RenderIndicator.h in Headers */, BCEA4878097D93020094C9E4 /* RenderInline.h in Headers */, BCEA487A097D93020094C9E4 /* RenderLayer.h in Headers */, 0F580CFF0F12DE9B0051D689 /* RenderLayerBacking.h in Headers */, @@ -19264,6 +19295,7 @@ 083F529A11957FBE00653EBE /* SVGTextLayoutUtilities.h in Headers */, B2227ACE0D00BF220071B782 /* SVGTextPathElement.h in Headers */, B2227AD10D00BF220071B782 /* SVGTextPositioningElement.h in Headers */, + 0853D73411C9109000B2FD42 /* SVGTextQuery.h in Headers */, B2227AD40D00BF220071B782 /* SVGTitleElement.h in Headers */, B2227AD70D00BF220071B782 /* SVGTransform.h in Headers */, B2227ADA0D00BF220071B782 /* SVGTransformable.h in Headers */, @@ -19321,7 +19353,6 @@ 9305B24D098F1B6B00C28855 /* Timer.h in Headers */, E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */, 49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */, - BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */, 49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */, 49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */, 49E911D00EF86D47009D0CAF /* TransformOperations.h in Headers */, @@ -19375,6 +19406,7 @@ 6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */, 49C7B9CF1042D32F0009D447 /* WebGLFramebuffer.h in Headers */, 6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */, + 49FFBF3F11C93EE3006A7118 /* WebGLLayer.h in Headers */, 49C7B9D71042D32F0009D447 /* WebGLProgram.h in Headers */, 49C7B9DA1042D32F0009D447 /* WebGLRenderbuffer.h in Headers */, 49C7B9E01042D32F0009D447 /* WebGLRenderingContext.h in Headers */, @@ -19397,6 +19429,7 @@ 510D4A50103177A20049EA54 /* WebSocketChannelClient.h in Headers */, 51ABAE451043AB4A008C5260 /* WebSocketHandshake.h in Headers */, 7637C543112E7B7E003D6CDC /* WebSocketHandshakeRequest.h in Headers */, + 767F99C011A119560080C51D /* WebSocketHandshakeResponse.h in Headers */, 0FCF332D0F2B9A25004B6795 /* WebTiledLayer.h in Headers */, 85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */, 9380F47409A11AB4001FDB34 /* Widget.h in Headers */, @@ -19459,6 +19492,8 @@ 5112247A10CFB8FF008099D7 /* WorkerThreadableWebSocketChannel.h in Headers */, 93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */, 6565820209D1508D000E61D7 /* XLinkNames.h in Headers */, + 93F1992108245E59001E9ABC /* XMLDocumentParser.h in Headers */, + 5D15E3AC0F9E6AC1009E0E3F /* XMLDocumentParserScope.h in Headers */, BC772C470C4EB2C60083285F /* XMLHttpRequest.h in Headers */, BC60D9C90D2A29E500B9918F /* XMLHttpRequestException.h in Headers */, F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */, @@ -19467,8 +19502,6 @@ A833C80D0A2CF25600D57664 /* XMLNames.h in Headers */, E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */, 1ACE53EB0A8D18E70022947D /* XMLSerializer.h in Headers */, - 93F1992108245E59001E9ABC /* XMLDocumentParser.h in Headers */, - 5D15E3AC0F9E6AC1009E0E3F /* XMLDocumentParserScope.h in Headers */, 1AB7FC690A8B92EC00D9D37B /* XPathEvaluator.h in Headers */, BC60DA5B0D2A31F700B9918F /* XPathException.h in Headers */, 1AB7FC6C0A8B92EC00D9D37B /* XPathExpression.h in Headers */, @@ -19493,16 +19526,17 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, - B6693EEC11AD63E6003F2770 /* IDBObjectStore.h in Headers */, - B6693EEE11AD63E6003F2770 /* IDBObjectStoreRequest.h in Headers */, - B6693EF311AD6486003F2770 /* JSIDBObjectStoreRequest.h in Headers */, - C51DA9A511AEF2C1009799C5 /* IDBIndex.h in Headers */, - C51DA9A711AEF2C1009799C5 /* IDBIndexImpl.h in Headers */, - C51DA9A911AEF2C1009799C5 /* IDBIndexRequest.h in Headers */, - C5BBC9D111AEF838007C2BFE /* JSIDBIndexRequest.h in Headers */, - B6B0540A11B68F10002564C5 /* IDBObjectStoreImpl.h in Headers */, - 816C806911BE887E009A45E9 /* IDBKeyRange.h in Headers */, - 816C80AF11BE990D009A45E9 /* JSIDBKeyRange.h in Headers */, + D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */, + D000ED2811C1B9CD00C47726 /* SubframeLoader.h in Headers */, + 1AD8F81B11CAB9E900E93E54 /* PlatformStrategies.h in Headers */, + 1AA8799011CBE846003C664F /* PluginStrategy.h in Headers */, + B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */, + B525A96511CA2340003A23A8 /* JSSQLException.h in Headers */, + 9719AF0011D09F2C00D45831 /* HTMLInputStream.h in Headers */, + A853123D11D0471B00D4D077 /* FragmentScriptingPermission.h in Headers */, + A8E6A78111D1661B00311F4A /* HTMLParserScheduler.h in Headers */, + A84D827C11D333ED00972990 /* RawDataDocumentParser.h in Headers */, + CEA3949D11D45CDA003094CF /* StaticHashSetNodeList.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -19818,6 +19852,7 @@ BC5EB91F0E82040800B25965 /* BindingURI.cpp in Sources */, A89943290B42338800D7C802 /* BitmapImage.cpp in Sources */, 2EAFAF0E10E2AF2D007ED3D6 /* Blob.cpp in Sources */, + 89BED5EB11BE11CE00448492 /* BlobBuilder.cpp in Sources */, 8988E10E11A3508B00DB732E /* BlobItem.cpp in Sources */, 93F19AE108245E59001E9ABC /* BlockExceptions.mm in Sources */, BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */, @@ -19839,7 +19874,6 @@ BCB16C230979C3BD00467741 /* CachedScript.cpp in Sources */, BCB16C250979C3BD00467741 /* CachedXBLDocument.cpp in Sources */, BCB16C270979C3BD00467741 /* CachedXSLStyleSheet.cpp in Sources */, - 49C7BA011042D38C0009D447 /* Canvas3DLayer.mm in Sources */, 6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */, 49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */, 49C7B9D41042D32F0009D447 /* CanvasObject.cpp in Sources */, @@ -19921,6 +19955,7 @@ A80E6CF50A1989CA007FB8C5 /* CSSPageRule.cpp in Sources */, BC772B3D0C4EA91E0083285F /* CSSParser.cpp in Sources */, BC02A5400E099C5A004B6D2B /* CSSParserValues.cpp in Sources */, + 976E2BA711CAE4DE006C56A0 /* CSSPreloadScanner.cpp in Sources */, A80E6D050A1989CA007FB8C5 /* CSSPrimitiveValue.cpp in Sources */, A80E6CF70A1989CA007FB8C5 /* CSSProperty.cpp in Sources */, 0F6ECD460F252F3700BDE271 /* CSSPropertyLonghand.cpp in Sources */, @@ -20337,6 +20372,7 @@ A8136D390973A8E700D74463 /* FormDataList.cpp in Sources */, 514C764F0CE9234E007EF3CD /* FormDataStreamMac.mm in Sources */, 656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */, + 41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */, 65BF022E0974816300C43196 /* Frame.cpp in Sources */, 932E16090AF578340025F408 /* FrameLoader.cpp in Sources */, 65BF02450974819000C43196 /* FrameMac.mm in Sources */, @@ -20356,7 +20392,7 @@ B2A015A80AF6CD53006BCE0E /* GraphicsContext.cpp in Sources */, 6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */, 6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */, - 49C7BA021042D38C0009D447 /* GraphicsContext3DMac.cpp in Sources */, + 49FFBF1D11C8550E006A7118 /* GraphicsContext3DMac.mm in Sources */, B2ED97710B1F55CE00257D0F /* GraphicsContextCG.cpp in Sources */, B277B4040B22F37C0004BEC6 /* GraphicsContextMac.mm in Sources */, 0F580B0C0F12A2690051D689 /* GraphicsLayer.cpp in Sources */, @@ -20368,11 +20404,12 @@ 5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */, 9363B62C0F8E8FE000803810 /* HistoryPropertyList.cpp in Sources */, 9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */, - 976E896011C0CA3A00EA9CA9 /* HTML5EntityParser.cpp in Sources */, - 97E8B35611A23CE200169409 /* HTML5Lexer.cpp in Sources */, - A83B3AF011ADEFF500458809 /* HTML5ScriptRunner.cpp in Sources */, - A871038A11A2947000DBD50E /* HTML5DocumentParser.cpp in Sources */, - A879C62511A9D1F70059237A /* HTML5TreeBuilder.cpp in Sources */, + A871038A11A2947000DBD50E /* HTMLDocumentParser.cpp in Sources */, + 976E896011C0CA3A00EA9CA9 /* HTMLEntityParser.cpp in Sources */, + 97E8B35611A23CE200169409 /* HTMLTokenizer.cpp in Sources */, + 97E7936511C6030900E649BC /* HTMLPreloadScanner.cpp in Sources */, + A83B3AF011ADEFF500458809 /* HTMLScriptRunner.cpp in Sources */, + A879C62511A9D1F70059237A /* HTMLTreeBuilder.cpp in Sources */, BC97E23B109144950010D361 /* HTMLAllCollection.cpp in Sources */, A8CFF7A40A156978000A4234 /* HTMLAnchorElement.cpp in Sources */, A871D45E0A127CBC00B12A68 /* HTMLAppletElement.cpp in Sources */, @@ -20395,6 +20432,7 @@ A8EA7CB10A192B9C00A8EF5F /* HTMLDivElement.cpp in Sources */, A8EA79F50A1916DF00A8EF5F /* HTMLDListElement.cpp in Sources */, 93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */, + 93F19A9C08245E59001E9ABC /* LegacyHTMLDocumentParser.cpp in Sources */, 93309DE7099E64920056E581 /* htmlediting.cpp in Sources */, 93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */, A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */, @@ -20440,7 +20478,6 @@ 9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */, A8EA7CB20A192B9C00A8EF5F /* HTMLParagraphElement.cpp in Sources */, A871D4590A127CBC00B12A68 /* HTMLParamElement.cpp in Sources */, - 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeConstructor.cpp in Sources */, BC588B4B0BFA723C00EE679E /* HTMLParserErrorCodes.cpp in Sources */, A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */, 4415292F0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp in Sources */, @@ -20461,12 +20498,13 @@ A871DB260A150BD600B12A68 /* HTMLTableSectionElement.cpp in Sources */, A81369D7097374F600D74463 /* HTMLTextAreaElement.cpp in Sources */, A871DC290A15205700B12A68 /* HTMLTitleElement.cpp in Sources */, - 93F19A9C08245E59001E9ABC /* HTMLDocumentParser.cpp in Sources */, A8EA79F30A1916DF00A8EF5F /* HTMLUListElement.cpp in Sources */, E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */, BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */, 0B8C56D40F28627F000502E1 /* HTTPHeaderMap.cpp in Sources */, 514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */, + 371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */, + 375CD23B119D44EA00A2A859 /* HyphenationMac.mm in Sources */, 5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */, 445C8DB710015FC90031531A /* IconDatabaseNone.cpp in Sources */, 1A2D753E0DE47FAB00F0A648 /* IconFetcher.cpp in Sources */, @@ -20475,13 +20513,19 @@ 51E1ECC00C91C90400DC255B /* IconRecord.cpp in Sources */, C56C9152119D84CB00DE4CD9 /* IDBAny.cpp in Sources */, B627FB2D11AD743500E97B72 /* IDBDatabaseImpl.cpp in Sources */, + B627FB2D11AD743500E97B72 /* IDBDatabaseImpl.cpp in Sources */, C5198F531192ECFD002B74A6 /* IDBDatabaseRequest.cpp in Sources */, C56C915F119D84E600DE4CD9 /* IDBErrorEvent.cpp in Sources */, C56C9162119D84E600DE4CD9 /* IDBEvent.cpp in Sources */, C51DA9A611AEF2C1009799C5 /* IDBIndexImpl.cpp in Sources */, + C51DA9A611AEF2C1009799C5 /* IDBIndexImpl.cpp in Sources */, C51DA9A811AEF2C1009799C5 /* IDBIndexRequest.cpp in Sources */, + C51DA9A811AEF2C1009799C5 /* IDBIndexRequest.cpp in Sources */, + 816C806811BE887E009A45E9 /* IDBKeyRange.cpp in Sources */, + B6B0540911B68F10002564C5 /* IDBObjectStoreImpl.cpp in Sources */, B6B0540911B68F10002564C5 /* IDBObjectStoreImpl.cpp in Sources */, B6693EED11AD63E6003F2770 /* IDBObjectStoreRequest.cpp in Sources */, + B6693EED11AD63E6003F2770 /* IDBObjectStoreRequest.cpp in Sources */, C5198F561192ECFD002B74A6 /* IDBRequest.cpp in Sources */, C56C9168119D84FF00DE4CD9 /* IDBSuccessEvent.cpp in Sources */, 1A71D57B0F33819000F9CE4E /* IdentifierRep.cpp in Sources */, @@ -20547,7 +20591,7 @@ 93309DF3099E64920056E581 /* JoinTextNodesCommand.cpp in Sources */, 418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */, 49EECF00105070C400099FAB /* JSArrayBuffer.cpp in Sources */, - 49EECFAB1050938200099FAB /* JSArrayBufferConstructor.cpp in Sources */, + BC275CB311C5E85C00C9206C /* JSArrayBufferCustom.cpp in Sources */, 49EECF1B105072F300099FAB /* JSArrayBufferView.cpp in Sources */, 492273A31083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp in Sources */, 65DF31DA09D1C123000BE325 /* JSAttr.cpp in Sources */, @@ -20556,6 +20600,7 @@ BC124EFF0C26447A009E2349 /* JSBarInfo.cpp in Sources */, BC946346107A934B00857193 /* JSBeforeLoadEvent.cpp in Sources */, 2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */, + 89CD029311C85B870070B791 /* JSBlobBuilder.cpp in Sources */, 1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */, 65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */, 65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */, @@ -20646,7 +20691,7 @@ BC60D9BF0D2A269A00B9918F /* JSEventException.cpp in Sources */, 93B70D6909EB0C7C009D8468 /* JSEventListener.cpp in Sources */, E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */, - E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */, + BC275B8111C5D2B400C9206C /* JSEventSourceCustom.cpp in Sources */, BC6090200E91B8EC000C68B5 /* JSEventTarget.cpp in Sources */, 3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */, BC00F0140E0A189500FD04E3 /* JSFile.cpp in Sources */, @@ -20654,7 +20699,6 @@ BC00F0160E0A189500FD04E3 /* JSFileList.cpp in Sources */, 2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */, 49EECF02105070C400099FAB /* JSFloat32Array.cpp in Sources */, - 49EECFAF1050938200099FAB /* JSFloat32ArrayConstructor.cpp in Sources */, 49EECF7910508D9C00099FAB /* JSFloat32ArrayCustom.cpp in Sources */, FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */, FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */, @@ -20758,6 +20802,9 @@ C56C91A0119D918100DE4CD9 /* JSIDBErrorEvent.cpp in Sources */, C56C91A2119D918100DE4CD9 /* JSIDBEvent.cpp in Sources */, C5BBC9D011AEF838007C2BFE /* JSIDBIndexRequest.cpp in Sources */, + C5BBC9D011AEF838007C2BFE /* JSIDBIndexRequest.cpp in Sources */, + 816C80B111BE9934009A45E9 /* JSIDBKeyRange.cpp in Sources */, + B6693EF211AD6486003F2770 /* JSIDBObjectStoreRequest.cpp in Sources */, B6693EF211AD6486003F2770 /* JSIDBObjectStoreRequest.cpp in Sources */, C5F4F40C119306AC00FDFADD /* JSIDBRequest.cpp in Sources */, C56C91A6119D918700DE4CD9 /* JSIDBSuccessEvent.cpp in Sources */, @@ -20771,13 +20818,10 @@ 7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */, 7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */, 49EECF06105070C400099FAB /* JSInt16Array.cpp in Sources */, - 49EECFB51050938200099FAB /* JSInt16ArrayConstructor.cpp in Sources */, 49EECF7B10508D9C00099FAB /* JSInt16ArrayCustom.cpp in Sources */, 49EECF04105070C400099FAB /* JSInt32Array.cpp in Sources */, - 49EECFB11050938200099FAB /* JSInt32ArrayConstructor.cpp in Sources */, 49EECF7A10508D9C00099FAB /* JSInt32ArrayCustom.cpp in Sources */, 49C7B9951042D2D30009D447 /* JSInt8Array.cpp in Sources */, - 49EECFAD1050938200099FAB /* JSInt8ArrayConstructor.cpp in Sources */, 49EECF7810508D9C00099FAB /* JSInt8ArrayCustom.cpp in Sources */, 1C5FAED10DCFD90100D58F78 /* JSJavaScriptCallFrame.cpp in Sources */, 1C5FAEE70DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp in Sources */, @@ -20790,7 +20834,6 @@ BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */, 9FFE3EA511B5A4390037874E /* JSMemoryInfo.cpp in Sources */, E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */, - E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */, E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */, 75793EC80D0CE72D007FC0AC /* JSMessageEvent.cpp in Sources */, 410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */, @@ -20839,7 +20882,6 @@ 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */, 9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */, 41D07A7E0FF935CA0095EDCE /* JSSharedWorker.cpp in Sources */, - 415B7C580FF598E6006770F7 /* JSSharedWorkerConstructor.cpp in Sources */, 41D1690510238B66009BC827 /* JSSharedWorkerContext.cpp in Sources */, 14CD8D82106B529000A46D23 /* JSSharedWorkerCustom.cpp in Sources */, 514C76370CE9225E007EF3CD /* JSSQLError.cpp in Sources */, @@ -21012,13 +21054,10 @@ 516BB7940CE91E6800512F79 /* JSTreeWalkerCustom.cpp in Sources */, A86629D009DA2B48009633A5 /* JSUIEvent.cpp in Sources */, 49EECF0C105070C400099FAB /* JSUint16Array.cpp in Sources */, - 49EECFBB1050938200099FAB /* JSUint16ArrayConstructor.cpp in Sources */, 49EECF7E10508D9C00099FAB /* JSUint16ArrayCustom.cpp in Sources */, 49EECF0A105070C400099FAB /* JSUint32Array.cpp in Sources */, - 49EECFB91050938200099FAB /* JSUint32ArrayConstructor.cpp in Sources */, 49EECF7D10508D9C00099FAB /* JSUint32ArrayCustom.cpp in Sources */, 49EECF08105070C400099FAB /* JSUint8Array.cpp in Sources */, - 49EECFB71050938200099FAB /* JSUint8ArrayConstructor.cpp in Sources */, 49EECF7C10508D9C00099FAB /* JSUint8ArrayCustom.cpp in Sources */, 15C77094100D3CA8005BA267 /* JSValidityState.cpp in Sources */, A7D20F62107F406900A80392 /* JSWebGLActiveInfo.cpp in Sources */, @@ -21036,17 +21075,15 @@ 316FE0710E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp in Sources */, 316FE0730E6CCBEE00BF6088 /* JSWebKitCSSKeyframesRule.cpp in Sources */, 4983913F0F1E767500C23782 /* JSWebKitCSSMatrix.cpp in Sources */, - 498391630F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp in Sources */, + BC275B7D11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp in Sources */, 31611E5A0E1C4DE000F6A579 /* JSWebKitCSSTransformValue.cpp in Sources */, 494BD79D0F55C94C00747828 /* JSWebKitPoint.cpp in Sources */, - 494BD7990F55C90E00747828 /* JSWebKitPointConstructor.cpp in Sources */, + BC275B7911C5D1C300C9206C /* JSWebKitPointCustom.cpp in Sources */, 31C0FF3F0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.cpp in Sources */, 5DA5E0FC102B953800088CF9 /* JSWebSocket.cpp in Sources */, - 518A34C71026C8C9001B6896 /* JSWebSocketConstructor.cpp in Sources */, 518A34C91026C8C9001B6896 /* JSWebSocketCustom.cpp in Sources */, 65DF320509D1CC60000BE325 /* JSWheelEvent.cpp in Sources */, E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */, - E1CA5CD60E8CDEE900E8EF90 /* JSWorkerConstructor.cpp in Sources */, E182568F0EF2B02D00933242 /* JSWorkerContext.cpp in Sources */, E1C36D340EB0A094007410BC /* JSWorkerContextBase.cpp in Sources */, E18258AC0EF3CD7000933242 /* JSWorkerContextCustom.cpp in Sources */, @@ -21067,7 +21104,6 @@ 1A762C770A074F2600989F5B /* JSXPathNSResolver.cpp in Sources */, 1A762C790A074F2600989F5B /* JSXPathResult.cpp in Sources */, BCEFE1EA0DCA5F6400739219 /* JSXSLTProcessor.cpp in Sources */, - BCE99EC30DCA624100182683 /* JSXSLTProcessorConstructor.cpp in Sources */, BCEFE1E50DCA5F3300739219 /* JSXSLTProcessorCustom.cpp in Sources */, 85031B430A44EFC700F992E0 /* KeyboardEvent.cpp in Sources */, A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */, @@ -21082,6 +21118,7 @@ A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */, 9352084509BD43B900F2038D /* Language.mm in Sources */, 2D9066060BE141D400956998 /* LayoutState.cpp in Sources */, + 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeBuilder.cpp in Sources */, 512DD8F40D91E6AF000F89EE /* LegacyWebArchive.cpp in Sources */, 51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */, BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */, @@ -21187,7 +21224,6 @@ A9C6E4EB0D745E2B006442E9 /* Plugin.cpp in Sources */, A9C6E4EF0D745E38006442E9 /* PluginArray.cpp in Sources */, A9C6E4F30D745E48006442E9 /* PluginData.cpp in Sources */, - A9C6E4F60D745E61006442E9 /* PluginDataMac.mm in Sources */, 1AC694C70A3B1676003F5049 /* PluginDocument.cpp in Sources */, 7693BAD3106C2DCA007B0823 /* PluginHalter.cpp in Sources */, 1ADA14100E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp in Sources */, @@ -21200,7 +21236,7 @@ 0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */, 93F19AF808245E59001E9ABC /* Position.cpp in Sources */, 37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */, - E49626C20D80D94800E3405C /* PreloadScanner.cpp in Sources */, + E49626C20D80D94800E3405C /* LegacyPreloadScanner.cpp in Sources */, B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */, A8EA7EBD0A1945D000A8EF5F /* ProcessingInstruction.cpp in Sources */, E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */, @@ -21238,6 +21274,7 @@ 0FD308D5117D168500A791F7 /* RenderIFrame.cpp in Sources */, BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */, BCB4F8930DB28E530039139B /* RenderImageGeneratedContent.cpp in Sources */, + A7AA66D611C5ED6A001D8C8C /* RenderIndicator.cpp in Sources */, BCEA4877097D93020094C9E4 /* RenderInline.cpp in Sources */, BCEA4879097D93020094C9E4 /* RenderLayer.cpp in Sources */, 0F580D000F12DE9B0051D689 /* RenderLayerBacking.cpp in Sources */, @@ -21613,11 +21650,13 @@ B2227ABD0D00BF220071B782 /* SVGSwitchElement.cpp in Sources */, B2227AC00D00BF220071B782 /* SVGSymbolElement.cpp in Sources */, B2227AC40D00BF220071B782 /* SVGTests.cpp in Sources */, + 0853D73211C9109000B2FD42 /* SVGTextChunkLayoutInfo.cpp in Sources */, B2227AC70D00BF220071B782 /* SVGTextContentElement.cpp in Sources */, B2227ACA0D00BF220071B782 /* SVGTextElement.cpp in Sources */, 083F529911957FBE00653EBE /* SVGTextLayoutUtilities.cpp in Sources */, B2227ACD0D00BF220071B782 /* SVGTextPathElement.cpp in Sources */, B2227AD00D00BF220071B782 /* SVGTextPositioningElement.cpp in Sources */, + 0853D73311C9109000B2FD42 /* SVGTextQuery.cpp in Sources */, B2227AD30D00BF220071B782 /* SVGTitleElement.cpp in Sources */, B2227AD60D00BF220071B782 /* SVGTransform.cpp in Sources */, B2227AD90D00BF220071B782 /* SVGTransformable.cpp in Sources */, @@ -21701,6 +21740,7 @@ 6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */, 49C7B9CE1042D32F0009D447 /* WebGLFramebuffer.cpp in Sources */, 6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */, + 49FFBF4011C93EE3006A7118 /* WebGLLayer.mm in Sources */, 49C7B9D61042D32F0009D447 /* WebGLProgram.cpp in Sources */, 49C7B9D91042D32F0009D447 /* WebGLRenderbuffer.cpp in Sources */, 49C7B9DF1042D32F0009D447 /* WebGLRenderingContext.cpp in Sources */, @@ -21719,6 +21759,7 @@ 510D4A4E103177A20049EA54 /* WebSocketChannel.cpp in Sources */, 51ABAE441043AB4A008C5260 /* WebSocketHandshake.cpp in Sources */, 7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */, + 767F99BE11A1194A0080C51D /* WebSocketHandshakeResponse.cpp in Sources */, 0FCF332C0F2B9A25004B6795 /* WebTiledLayer.mm in Sources */, 85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */, 935C477309AC4D7700A6AAB4 /* WheelEventMac.mm in Sources */, @@ -21777,15 +21818,15 @@ 5112247810CFB8F4008099D7 /* WorkerThreadableWebSocketChannel.cpp in Sources */, 93309E23099E64920056E581 /* WrapContentsInDummySpanCommand.cpp in Sources */, A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */, + 93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */, + 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */, + 5D15E3AB0F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp in Sources */, BC772C460C4EB2C60083285F /* XMLHttpRequest.cpp in Sources */, A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */, BCDFD48F0E305290009D10AD /* XMLHttpRequestUpload.cpp in Sources */, A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */, E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */, 1ACE53EA0A8D18E70022947D /* XMLSerializer.cpp in Sources */, - 93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */, - 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */, - 5D15E3AB0F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp in Sources */, 1AB7FC680A8B92EC00D9D37B /* XPathEvaluator.cpp in Sources */, 1AB7FC6B0A8B92EC00D9D37B /* XPathExpression.cpp in Sources */, 1AB7FC6E0A8B92EC00D9D37B /* XPathExpressionNode.cpp in Sources */, @@ -21809,15 +21850,13 @@ 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - B6693EED11AD63E6003F2770 /* IDBObjectStoreRequest.cpp in Sources */, - B6693EF211AD6486003F2770 /* JSIDBObjectStoreRequest.cpp in Sources */, - B627FB2D11AD743500E97B72 /* IDBDatabaseImpl.cpp in Sources */, - C51DA9A611AEF2C1009799C5 /* IDBIndexImpl.cpp in Sources */, - C51DA9A811AEF2C1009799C5 /* IDBIndexRequest.cpp in Sources */, - C5BBC9D011AEF838007C2BFE /* JSIDBIndexRequest.cpp in Sources */, - B6B0540911B68F10002564C5 /* IDBObjectStoreImpl.cpp in Sources */, - 816C806811BE887E009A45E9 /* IDBKeyRange.cpp in Sources */, - 816C80B111BE9934009A45E9 /* JSIDBKeyRange.cpp in Sources */, + D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */, + D000ED2711C1B9CD00C47726 /* SubframeLoader.cpp in Sources */, + 200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */, + 1AD8F81C11CAB9E900E93E54 /* PlatformStrategies.cpp in Sources */, + B525A96611CA2340003A23A8 /* JSSQLException.cpp in Sources */, + A8E6A78211D1661B00311F4A /* HTMLParserScheduler.cpp in Sources */, + CEA3949C11D45CDA003094CF /* StaticHashSetNodeList.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cpp index b7622b8..750c611 100644 --- a/WebCore/accessibility/AXObjectCache.cpp +++ b/WebCore/accessibility/AXObjectCache.cpp @@ -456,6 +456,15 @@ void AXObjectCache::selectedChildrenChanged(RenderObject* renderer) #endif #if HAVE(ACCESSIBILITY) +void AXObjectCache::handleAriaExpandedChange(RenderObject *renderer) +{ + if (!renderer) + return; + AccessibilityObject* obj = getOrCreate(renderer); + if (obj) + obj->handleAriaExpandedChanged(); +} + void AXObjectCache::handleActiveDescendantChanged(RenderObject* renderer) { if (!renderer) diff --git a/WebCore/accessibility/AXObjectCache.h b/WebCore/accessibility/AXObjectCache.h index 25f5347..8d98fa3 100644 --- a/WebCore/accessibility/AXObjectCache.h +++ b/WebCore/accessibility/AXObjectCache.h @@ -88,7 +88,8 @@ public: void handleAriaRoleChanged(RenderObject*); void handleFocusedUIElementChanged(RenderObject* oldFocusedRenderer, RenderObject* newFocusedRenderer); void handleScrolledToAnchor(const Node* anchorNode); - + void handleAriaExpandedChange(RenderObject*); + static void enableAccessibility() { gAccessibilityEnabled = true; } static void enableEnhancedUserInterfaceAccessibility() { gAccessibilityEnhancedUserInterfaceEnabled = true; } @@ -116,6 +117,9 @@ public: AXScrolledToAnchor, AXLiveRegionChanged, AXMenuListValueChanged, + AXRowCountChanged, + AXRowCollapsed, + AXRowExpanded, }; void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously); @@ -150,10 +154,12 @@ inline void AXObjectCache::detachWrapper(AccessibilityObject*) { } inline void AXObjectCache::attachWrapper(AccessibilityObject*) { } inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { } inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { } +inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { } inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { } inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) { } inline void AXObjectCache::handleScrolledToAnchor(const Node*) { } inline void AXObjectCache::contentChanged(RenderObject*) { } +inline void AXObjectCache::handleAriaExpandedChange(RenderObject*) { } #endif } diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp index 8dedc36..555ba6f 100644 --- a/WebCore/accessibility/AccessibilityObject.cpp +++ b/WebCore/accessibility/AccessibilityObject.cpp @@ -902,7 +902,7 @@ static ARIARoleMap* createARIARoleMap() { "img", ImageRole }, { "link", WebCoreLinkRole }, { "list", ListRole }, - { "listitem", GroupRole }, + { "listitem", ListItemRole }, { "listbox", ListBoxRole }, { "log", ApplicationLogRole }, // "option" isn't here because it may map to different roles depending on the parent element's role @@ -917,7 +917,7 @@ static ARIARoleMap* createARIARoleMap() { "note", DocumentNoteRole }, { "navigation", LandmarkNavigationRole }, { "option", ListBoxOptionRole }, - { "presentation", IgnoredRole }, + { "presentation", PresentationalRole }, { "progressbar", ProgressIndicatorRole }, { "radio", RadioButtonRole }, { "radiogroup", RadioGroupRole }, diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h index 8b4923a..3c8d392 100644 --- a/WebCore/accessibility/AccessibilityObject.h +++ b/WebCore/accessibility/AccessibilityObject.h @@ -160,6 +160,7 @@ enum AccessibilityRole { AnnotationRole, SliderThumbRole, IgnoredRole, + PresentationalRole, TabRole, TabListRole, TabPanelRole, @@ -296,6 +297,7 @@ public: bool isTreeItem() const { return roleValue() == TreeItemRole; } bool isScrollbar() const { return roleValue() == ScrollBarRole; } bool isButton() const { return roleValue() == ButtonRole; } + bool isListItem() const { return roleValue() == ListItemRole; } virtual bool isChecked() const { return false; } virtual bool isEnabled() const { return false; } @@ -442,13 +444,15 @@ public: virtual void addChildren() { } virtual bool canHaveChildren() const { return true; } virtual bool hasChildren() const { return m_haveChildren; } + virtual void updateChildrenIfNecessary() { } virtual void selectedChildren(AccessibilityChildrenVector&) { } virtual void visibleChildren(AccessibilityChildrenVector&) { } virtual void tabChildren(AccessibilityChildrenVector&) { } virtual bool shouldFocusActiveDescendant() const { return false; } virtual AccessibilityObject* activeDescendant() const { return 0; } virtual void handleActiveDescendantChanged() { } - + virtual void handleAriaExpandedChanged() { } + static AccessibilityRole ariaRoleToWebCoreRole(const String&); static const AtomicString& getAttribute(Node*, const QualifiedName&); diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index ffe62f8..1ef6e09 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1256,11 +1256,11 @@ static HTMLLabelElement* labelForElement(Element* element) HTMLLabelElement* AccessibilityRenderObject::labelElementContainer() const { if (!m_renderer) - return false; + return 0; // the control element should not be considered part of the label if (isControl()) - return false; + return 0; // find if this has a parent that is a label for (Node* parentNode = m_renderer->node(); parentNode; parentNode = parentNode->parentNode()) { @@ -1735,6 +1735,9 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const if (roleValue() == IgnoredRole) return true; + if (roleValue() == PresentationalRole || inheritsPresentationalRole()) + return true; + // An ARIA tree can only have tree items and static text as children. if (!isAllowedChildOfTree()) return true; @@ -2829,6 +2832,39 @@ AccessibilityObject* AccessibilityRenderObject::activeDescendant() const return 0; } +void AccessibilityRenderObject::handleAriaExpandedChanged() +{ + // Find if a parent of this object should handle aria-expanded changes. + AccessibilityObject* containerParent = this->parentObject(); + while (containerParent) { + bool foundParent = false; + + switch (containerParent->roleValue()) { + case TreeRole: + case TreeGridRole: + case GridRole: + case TableRole: + case BrowserRole: + foundParent = true; + break; + default: + break; + } + + if (foundParent) + break; + + containerParent = containerParent->parentObject(); + } + + // Post that the row count changed. + if (containerParent) + axObjectCache()->postNotification(containerParent, document(), AXObjectCache::AXRowCountChanged, true); + + // Post that the specific row either collapsed or expanded. + if (roleValue() == RowRole || roleValue() == TreeItemRole) + axObjectCache()->postNotification(this, document(), isExpanded() ? AXObjectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true); +} void AccessibilityRenderObject::handleActiveDescendantChanged() { @@ -2954,6 +2990,8 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole() return ImageMapRole; return WebCoreLinkRole; } + if (m_renderer->isListItem()) + return ListItemRole; if (m_renderer->isListMarker()) return ListMarkerRole; if (node && node->hasTagName(buttonTag)) @@ -3046,6 +3084,49 @@ AccessibilityOrientation AccessibilityRenderObject::orientation() const return AccessibilityObject::orientation(); } +bool AccessibilityRenderObject::inheritsPresentationalRole() const +{ + // ARIA spec says that when a parent object is presentational, and it has required child elements, + // those child elements are also presentational. For example, <li> becomes presentational from <ul>. + // http://www.w3.org/WAI/PF/aria/complete#presentation + DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, listItemParents, ()); + + HashSet<QualifiedName>* possibleParentTagNames = 0; + switch (roleValue()) { + case ListItemRole: + case ListMarkerRole: + if (listItemParents.isEmpty()) { + listItemParents.add(ulTag); + listItemParents.add(olTag); + listItemParents.add(dlTag); + } + possibleParentTagNames = &listItemParents; + break; + default: + break; + } + + // Not all elements need to check for this, only ones that are required children. + if (!possibleParentTagNames) + return false; + + for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) { + if (!parent->isAccessibilityRenderObject()) + continue; + + Node* elementNode = static_cast<AccessibilityRenderObject*>(parent)->node(); + if (!elementNode || !elementNode->isElementNode()) + continue; + + // If native tag of the parent element matches an acceptable name, then return + // based on its presentational status. + if (possibleParentTagNames->contains(static_cast<Element*>(elementNode)->tagQName())) + return parent->roleValue() == PresentationalRole; + } + + return false; +} + bool AccessibilityRenderObject::isPresentationalChildOfAriaRole() const { // Walk the parent chain looking for a parent that has presentational children @@ -3142,18 +3223,16 @@ void AccessibilityRenderObject::contentChanged() void AccessibilityRenderObject::childrenChanged() { - // this method is meant as a quick way of marking dirty - // a portion of the accessibility tree - + // This method is meant as a quick way of marking a portion of the accessibility tree dirty. if (!m_renderer) return; - // Go up the render parent chain, marking children as dirty. - // We can't rely on the accessibilityParent() because it may not exist and we must not create an AX object here either + // Go up the accessibility parent chain, but only if the element already exists. This method is + // called during render layouts, minimal work should be done. + // If AX elements are created now, they could interrogate the render tree while it's in a funky state. // At the same time, process ARIA live region changes. - for (RenderObject* renderParent = m_renderer; renderParent; renderParent = renderParent->parent()) { - AccessibilityObject* parent = m_renderer->document()->axObjectCache()->get(renderParent); - if (!parent || !parent->isAccessibilityRenderObject()) + for (AccessibilityObject* parent = this; parent; parent = parent->parentObjectIfExists()) { + if (!parent->isAccessibilityRenderObject()) continue; AccessibilityRenderObject* axParent = static_cast<AccessibilityRenderObject*>(parent); @@ -3165,7 +3244,7 @@ void AccessibilityRenderObject::childrenChanged() // If this element supports ARIA live regions, then notify the AT of changes. if (axParent->supportsARIALiveRegion()) - axObjectCache()->postNotification(renderParent, AXObjectCache::AXLiveRegionChanged, true); + axObjectCache()->postNotification(axParent->renderer(), AXObjectCache::AXLiveRegionChanged, true); } } } @@ -3232,8 +3311,7 @@ void AccessibilityRenderObject::addChildren() // add all unignored acc children for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling()) { if (obj->accessibilityIsIgnored()) { - if (!obj->hasChildren()) - obj->addChildren(); + obj->updateChildrenIfNecessary(); AccessibilityChildrenVector children = obj->children(); unsigned length = children.size(); for (unsigned i = 0; i < length; ++i) diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h index 494e6bb..d4f798a 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.h +++ b/WebCore/accessibility/AccessibilityRenderObject.h @@ -30,6 +30,7 @@ #define AccessibilityRenderObject_h #include "AccessibilityObject.h" +#include "RenderObject.h" namespace WebCore { @@ -47,7 +48,6 @@ class HTMLSelectElement; class IntPoint; class IntSize; class Node; -class RenderObject; class RenderListBox; class RenderTextControl; class RenderView; @@ -169,6 +169,11 @@ public: void setRenderer(RenderObject* renderer) { m_renderer = renderer; } RenderObject* renderer() const { return m_renderer; } + Node* node() const + { + return m_renderer ? m_renderer->node() : 0; + }; + RenderView* topRenderer() const; RenderTextControl* textControl() const; Document* document() const; @@ -199,7 +204,7 @@ public: virtual const AccessibilityChildrenVector& children(); virtual void clearChildren(); - void updateChildrenIfNecessary(); + virtual void updateChildrenIfNecessary(); virtual void setFocused(bool); virtual void setSelectedTextRange(const PlainTextRange&); @@ -222,7 +227,8 @@ public: virtual bool shouldFocusActiveDescendant() const; virtual AccessibilityObject* activeDescendant() const; virtual void handleActiveDescendantChanged(); - + virtual void handleAriaExpandedChanged(); + virtual VisiblePositionRange visiblePositionRange() const; virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const; virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const; @@ -305,6 +311,7 @@ private: virtual bool ariaLiveRegionAtomic() const; virtual bool ariaLiveRegionBusy() const; + bool inheritsPresentationalRole() const; void setNeedsToUpdateChildren() const { m_childrenDirty = true; } mutable AccessibilityRole m_roleForMSAA; diff --git a/WebCore/accessibility/AccessibilityTableCell.cpp b/WebCore/accessibility/AccessibilityTableCell.cpp index 318c619..7fadb88 100644 --- a/WebCore/accessibility/AccessibilityTableCell.cpp +++ b/WebCore/accessibility/AccessibilityTableCell.cpp @@ -71,7 +71,7 @@ bool AccessibilityTableCell::accessibilityIsIgnored() const AccessibilityObject* AccessibilityTableCell::parentTable() const { if (!m_renderer || !m_renderer->isTableCell()) - return false; + return 0; return axObjectCache()->getOrCreate(toRenderTableCell(m_renderer)->table()); } diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 5158774..8e2aa2c 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -143,18 +143,7 @@ static AccessibilityObject* core(AtkDocument* document) return core(ATK_OBJECT(document)); } -static const gchar* nameFromChildren(AccessibilityObject* object) -{ - if (!object) - return 0; - - AccessibilityRenderObject::AccessibilityChildrenVector children = object->children(); - // Currently, object->stringValue() should be an empty String. This might not be the case down the road. - String name = object->stringValue(); - for (unsigned i = 0; i < children.size(); ++i) - name += children.at(i).get()->stringValue(); - return returnString(name); -} +static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, gint endOffset); static const gchar* webkit_accessible_get_name(AtkObject* object) { @@ -165,8 +154,11 @@ static const gchar* webkit_accessible_get_name(AtkObject* object) AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject); if (coreObject->isControl()) { AccessibilityObject* label = renderObject->correspondingLabelForControlElement(); - if (label) - return returnString(nameFromChildren(label)); + if (label) { + AtkObject* atkObject = label->wrapper(); + if (ATK_IS_TEXT(atkObject)) + return webkit_accessible_text_get_text(ATK_TEXT(atkObject), 0, -1); + } } if (renderObject->isImage() || renderObject->isInputImage()) { @@ -422,6 +414,7 @@ static AtkRole atkRole(AccessibilityRole role) return ATK_ROLE_HEADING; case ListBoxRole: return ATK_ROLE_LIST; + case ListItemRole: case ListBoxOptionRole: return ATK_ROLE_LIST_ITEM; default: @@ -436,13 +429,6 @@ static AtkRole webkit_accessible_get_role(AtkObject* object) if (!axObject) return ATK_ROLE_UNKNOWN; - // WebCore does not seem to have a role for list items - if (axObject->isGroup()) { - AccessibilityObject* parent = axObject->parentObjectUnignored(); - if (parent && parent->isList()) - return ATK_ROLE_LIST_ITEM; - } - // WebCore does not know about paragraph role, label role, or section role if (axObject->isAccessibilityRenderObject()) { Node* node = static_cast<AccessibilityRenderObject*>(axObject)->renderer()->node(); @@ -1501,8 +1487,8 @@ static AtkObject* webkit_accessible_table_get_caption(AtkTable* table) static const gchar* webkit_accessible_table_get_column_description(AtkTable* table, gint column) { AtkObject* columnHeader = atk_table_get_column_header(table, column); - if (columnHeader) - return returnString(nameFromChildren(core(columnHeader))); + if (columnHeader && ATK_IS_TEXT(columnHeader)) + return webkit_accessible_text_get_text(ATK_TEXT(columnHeader), 0, -1); return 0; } @@ -1510,8 +1496,8 @@ static const gchar* webkit_accessible_table_get_column_description(AtkTable* tab static const gchar* webkit_accessible_table_get_row_description(AtkTable* table, gint row) { AtkObject* rowHeader = atk_table_get_row_header(table, row); - if (rowHeader) - return returnString(nameFromChildren(core(rowHeader))); + if (rowHeader && ATK_IS_TEXT(rowHeader)) + return webkit_accessible_text_get_text(ATK_TEXT(rowHeader), 0, -1); return 0; } diff --git a/WebCore/accessibility/mac/AXObjectCacheMac.mm b/WebCore/accessibility/mac/AXObjectCacheMac.mm index 6f886fe..a02bc75 100644 --- a/WebCore/accessibility/mac/AXObjectCacheMac.mm +++ b/WebCore/accessibility/mac/AXObjectCacheMac.mm @@ -91,7 +91,18 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific case AXLiveRegionChanged: macNotification = NSAccessibilityLiveRegionChangedNotification; break; - // Does not exist on Mac. + case AXRowCountChanged: + macNotification = NSAccessibilityRowCountChangedNotification; + break; +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + case AXRowExpanded: + macNotification = NSAccessibilityRowExpandedNotification; + break; + case AXRowCollapsed: + macNotification = NSAccessibilityRowCollapsedNotification; + break; +#endif + // Does not exist on Mac. case AXCheckedStateChanged: default: return; diff --git a/WebCore/accessibility/mac/AccessibilityObjectMac.mm b/WebCore/accessibility/mac/AccessibilityObjectMac.mm index 37fa65a..1076972 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectMac.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectMac.mm @@ -46,6 +46,11 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO if (isMenuListPopup() || isMenuListOption()) return IgnoreObject; + // Never expose an unknown object on the Mac. Clients of the AX API will not know what to do with it. + // Special case is when the unknown object is actually an attachment. + if (roleValue() == UnknownRole && !isAttachment()) + return IgnoreObject; + return DefaultBehavior; } diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index 1fdb0cc..9de7e4d 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -957,7 +957,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi else if (m_object->isControl()) objectAttributes = controlAttrs; - else if (m_object->isGroup()) + else if (m_object->isGroup() || m_object->isListItem()) objectAttributes = groupAttrs; else if (m_object->isTabList()) objectAttributes = tabListAttrs; @@ -1148,6 +1148,7 @@ static const AccessibilityRoleMap& createAccessibilityRoleMap() { TabPanelRole, NSAccessibilityGroupRole }, { TreeRole, NSAccessibilityOutlineRole }, { TreeItemRole, NSAccessibilityRowRole }, + { ListItemRole, NSAccessibilityGroupRole } }; AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap; diff --git a/WebCore/bindings/cpp/WebDOMDOMWindowCustom.cpp b/WebCore/bindings/cpp/WebDOMDOMWindowCustom.cpp new file mode 100644 index 0000000..5dd9ec4 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMDOMWindowCustom.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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 "WebDOMDOMWindow.h" + +#include "DOMWindow.h" +#include "WebDOMEventListener.h" +#include "WebNativeEventListener.h" + +void WebDOMDOMWindow::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + if (toWebCore(listener)) + impl()->addEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMDOMWindow::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + if (toWebCore(listener)) + impl()->removeEventListener(type, toWebCore(listener), useCapture); +} diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.cpp b/WebCore/bindings/cpp/WebDOMEventTarget.cpp index 2eaef00..b24bc84 100644 --- a/WebCore/bindings/cpp/WebDOMEventTarget.cpp +++ b/WebCore/bindings/cpp/WebDOMEventTarget.cpp @@ -22,6 +22,7 @@ #include "WebDOMEventTarget.h" #include "DOMApplicationCache.h" +#include "DOMWindow.h" #include "DedicatedWorkerContext.h" #include "EventSource.h" #include "MessagePort.h" @@ -31,6 +32,7 @@ #include "SharedWorkerContext.h" #include "ThreadCheck.h" #include "WebDOMDOMApplicationCache.h" +#include "WebDOMDOMWindow.h" #include "WebDOMDedicatedWorkerContext.h" #include "WebDOMEventSource.h" #include "WebDOMMessagePort.h" @@ -88,6 +90,45 @@ WebCore::EventTarget* WebDOMEventTarget::impl() const return m_impl ? m_impl->impl.get() : 0; } +#define ConvertTo(type) \ +WebDOM##type WebDOMEventTarget::to##type() \ +{ \ + WebCore::EventTarget* target = impl(); \ + return WebDOM##type(target ? target->to##type() : 0); \ +} + +ConvertTo(Node) +ConvertTo(DOMWindow) +ConvertTo(XMLHttpRequest) +ConvertTo(XMLHttpRequestUpload) +ConvertTo(MessagePort) + +#if ENABLE(EVENTSOURCE) +ConvertTo(EventSource) +#endif + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) +ConvertTo(DOMApplicationCache) +#endif + +#if ENABLE(WORKERS) +ConvertTo(Worker) +ConvertTo(DedicatedWorkerContext) +#endif + +#if ENABLE(SHARED_WORKERS) +ConvertTo(SharedWorker) +ConvertTo(SharedWorkerContext) +#endif + +#if ENABLE(NOTIFICATIONS) +ConvertTo(Notification) +#endif + +#if ENABLE(WEB_SOCKETS) +ConvertTo(WebSocket) +#endif + WebCore::EventTarget* toWebCore(const WebDOMEventTarget& wrapper) { return wrapper.impl(); @@ -95,6 +136,21 @@ WebCore::EventTarget* toWebCore(const WebDOMEventTarget& wrapper) WebDOMEventTarget toWebKit(WebCore::EventTarget* value) { + if (WebCore::Node* node = value->toNode()) + return toWebKit(node); + + if (WebCore::DOMWindow* window = value->toDOMWindow()) + return toWebKit(window); + + if (WebCore::XMLHttpRequest* xhr = value->toXMLHttpRequest()) + return toWebKit(xhr); + + if (WebCore::XMLHttpRequestUpload* upload = value->toXMLHttpRequestUpload()) + return toWebKit(upload); + + if (WebCore::MessagePort* messagePort = value->toMessagePort()) + return toWebKit(messagePort); + #if ENABLE(EVENTSOURCE) if (WebCore::EventSource* eventSource = value->toEventSource()) return toWebKit(eventSource); @@ -107,23 +163,11 @@ WebDOMEventTarget toWebKit(WebCore::EventTarget* value) return toWebKit(instance); #endif - if (WebCore::Node* node = value->toNode()) - return toWebKit(node); - - if (WebCore::XMLHttpRequest* xhr = value->toXMLHttpRequest()) - return toWebKit(xhr); - - if (WebCore::XMLHttpRequestUpload* upload = value->toXMLHttpRequestUpload()) - return toWebKit(upload); - #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (WebCore::DOMApplicationCache* cache = value->toDOMApplicationCache()) return toWebKit(cache); #endif - if (WebCore::MessagePort* messagePort = value->toMessagePort()) - return toWebKit(messagePort); - #if ENABLE(WORKERS) if (WebCore::Worker* worker = value->toWorker()) return toWebKit(worker); diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.h b/WebCore/bindings/cpp/WebDOMEventTarget.h index f5360ca..d514372 100644 --- a/WebCore/bindings/cpp/WebDOMEventTarget.h +++ b/WebCore/bindings/cpp/WebDOMEventTarget.h @@ -26,6 +26,20 @@ namespace WebCore { class EventTarget; }; +class WebDOMDedicatedWorkerContext; +class WebDOMDOMApplicationCache; +class WebDOMDOMWindow; +class WebDOMEventSource; +class WebDOMMessagePort; +class WebDOMNode; +class WebDOMNotification; +class WebDOMSharedWorker; +class WebDOMSharedWorkerContext; +class WebDOMWebSocket; +class WebDOMWorker; +class WebDOMXMLHttpRequest; +class WebDOMXMLHttpRequestUpload; + class WebDOMEventTarget : public WebDOMObject { public: WebDOMEventTarget(); @@ -35,8 +49,20 @@ public: WebCore::EventTarget* impl() const; - // FIXME: Add a possibility to check what kind of EventTarget we have, - // to be able to cast eg. a WebDOMEventTarget to a WebDOMNode + WebDOMNode toNode(); + WebDOMDOMWindow toDOMWindow(); + WebDOMXMLHttpRequest toXMLHttpRequest(); + WebDOMXMLHttpRequestUpload toXMLHttpRequestUpload(); + WebDOMMessagePort toMessagePort(); + + WebDOMEventSource toEventSource(); + WebDOMDOMApplicationCache toDOMApplicationCache(); + WebDOMWorker toWorker(); + WebDOMDedicatedWorkerContext toDedicatedWorkerContext(); + WebDOMSharedWorker toSharedWorker(); + WebDOMSharedWorkerContext toSharedWorkerContext(); + WebDOMNotification toNotification(); + WebDOMWebSocket toWebSocket(); protected: struct WebDOMEventTargetPrivate; diff --git a/WebCore/platform/graphics/efl/FloatRectEfl.cpp b/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp index 12f8d03..3f3378c 100644 --- a/WebCore/platform/graphics/efl/FloatRectEfl.cpp +++ b/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp @@ -1,8 +1,5 @@ /* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia - * Copyright (C) 2009-2010 ProFUSION embedded systems - * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) Research In Motion Limited 2010. 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 @@ -21,21 +18,25 @@ */ #include "config.h" -#include "FloatRect.h" +#include "WebDOMHTMLCollection.h" -namespace WebCore { +#include "AtomicString.h" +#include "HTMLCollection.h" +#include "WebDOMNode.h" +#include <wtf/GetPtr.h> -FloatRect::FloatRect(const Eina_Rectangle& r) - : m_location(FloatPoint(r.x, r.y)) - , m_size(r.w, r.h) +WebDOMNode WebDOMHTMLCollection::item(unsigned index) { + if (!impl()) + return WebDOMNode(); + + return toWebKit(WTF::getPtr(impl()->item(index))); } -FloatRect::operator Eina_Rectangle() const // NOLINT +WebDOMNode WebDOMHTMLCollection::namedItem(const WebDOMString& name) { - Eina_Rectangle r = {(int) round(x()), (int) round(y()), (int) round(width()), (int) round(height())}; - return r; -} + if (!impl()) + return WebDOMNode(); + return toWebKit(WTF::getPtr(impl()->namedItem(name))); } - diff --git a/WebCore/platform/graphics/efl/IntRectEfl.cpp b/WebCore/bindings/cpp/WebDOMHTMLOptionsCollectionCustom.cpp index 5ff8626..7e2eb25 100644 --- a/WebCore/platform/graphics/efl/IntRectEfl.cpp +++ b/WebCore/bindings/cpp/WebDOMHTMLOptionsCollectionCustom.cpp @@ -1,8 +1,5 @@ /* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia - * Copyright (C) 2009-2010 ProFUSION embedded systems - * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) Research In Motion Limited 2010. 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 @@ -21,21 +18,25 @@ */ #include "config.h" -#include "IntRect.h" +#include "WebDOMHTMLOptionsCollection.h" -namespace WebCore { +#include "HTMLOptionsCollection.h" +#include "WebExceptionHandler.h" -IntRect::IntRect(const Eina_Rectangle& r) - : m_location(IntPoint(r.x, r.y)) - , m_size(r.w, r.h) +unsigned WebDOMHTMLOptionsCollection::length() const { + if (!impl()) + return 0; + + return impl()->length(); } -IntRect::operator Eina_Rectangle() const // NOLINT +void WebDOMHTMLOptionsCollection::setLength(unsigned length) { - Eina_Rectangle r = { x(), y(), width(), height() }; - return r; -} + if (!impl()) + return; + WebCore::ExceptionCode ec = 0; + impl()->setLength(length, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); } - diff --git a/WebCore/bindings/js/JSWebKitPointConstructor.h b/WebCore/bindings/cpp/WebDOMNodeFilterCustom.cpp index 44c253d..565fa61 100644 --- a/WebCore/bindings/js/JSWebKitPointConstructor.h +++ b/WebCore/bindings/cpp/WebDOMNodeFilterCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) Research In Motion Limited 2010. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,24 +23,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSWebKitPointConstructor_h -#define JSWebKitPointConstructor_h +#include "config.h" +#include "WebDOMNodeFilter.h" -#include "JSDOMBinding.h" -#include "JSDocument.h" +#include "WebDOMNode.h" +#include "WebNativeNodeFilterCondition.h" -namespace WebCore { - -class JSWebKitPointConstructor : public DOMConstructorObject { -public: - JSWebKitPointConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - -private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } -}; +short WebDOMNodeFilter::acceptNode(const WebDOMNode& n) +{ + if (!impl()) + return 0; + return impl()->acceptNode(0, toWebCore(n)); } -#endif // JSWebKitPointConstructor_h +WebDOMNodeFilter toWebKit(WebUserNodeFilter* value) +{ + RefPtr<WebCore::NodeFilter> listener = WebCore::NodeFilter::create(WebNativeNodeFilterCondition::create(value)); + return WebDOMNodeFilter(listener.get()); +} diff --git a/WebCore/bindings/cpp/WebNativeNodeFilterCondition.cpp b/WebCore/bindings/cpp/WebNativeNodeFilterCondition.cpp new file mode 100644 index 0000000..3d30810 --- /dev/null +++ b/WebCore/bindings/cpp/WebNativeNodeFilterCondition.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "WebNativeNodeFilterCondition.h" + +#include "WebDOMNode.h" + +WebNativeNodeFilterCondition::WebNativeNodeFilterCondition(WebUserNodeFilter* filter) + : WebCore::NodeFilterCondition() + , m_filter(filter) +{ + ASSERT(m_filter); + m_filter->ref(); +} + +WebNativeNodeFilterCondition::~WebNativeNodeFilterCondition() +{ + m_filter->deref(); +} + +short WebNativeNodeFilterCondition::acceptNode(WebCore::ScriptState*, WebCore::Node* node) const +{ + return m_filter->acceptNode(toWebKit(node)); +} diff --git a/WebCore/bindings/cpp/WebNativeNodeFilterCondition.h b/WebCore/bindings/cpp/WebNativeNodeFilterCondition.h new file mode 100644 index 0000000..33d2786 --- /dev/null +++ b/WebCore/bindings/cpp/WebNativeNodeFilterCondition.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2001 Peter Kelly (pmk@post.com) + * Copyright (C) 2003, 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 Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebNativeNodeFilterCondition_h +#define WebNativeNodeFilterCondition_h + +#include "NodeFilter.h" +#include "WebDOMNodeFilter.h" + +class WebNativeNodeFilterCondition : public WebCore::NodeFilterCondition { +public: + static PassRefPtr<WebNativeNodeFilterCondition> create(WebUserNodeFilter* filter) + { + return adoptRef(new WebNativeNodeFilterCondition(filter)); + } + + virtual ~WebNativeNodeFilterCondition(); + + virtual short acceptNode(WebCore::ScriptState*, WebCore::Node*) const; + +protected: + WebNativeNodeFilterCondition(WebUserNodeFilter*); + WebUserNodeFilter* m_filter; +}; + +#endif diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index a3e488e..93ce1ee 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -31,8 +31,7 @@ #include "config.h" #include "RuntimeEnabledFeatures.h" -#include "Database.h" -#include "DatabaseSync.h" +#include "AbstractDatabase.h" #include "MediaPlayer.h" #include "SharedWorkerRepository.h" #include "WebSocket.h" @@ -95,12 +94,12 @@ bool RuntimeEnabledFeatures::webSocketEnabled() #if ENABLE(DATABASE) bool RuntimeEnabledFeatures::openDatabaseEnabled() { - return Database::isAvailable(); + return AbstractDatabase::isAvailable(); } bool RuntimeEnabledFeatures::openDatabaseSyncEnabled() { - return DatabaseSync::isAvailable(); + return AbstractDatabase::isAvailable(); } #endif diff --git a/WebCore/bindings/js/JSArrayBufferConstructor.h b/WebCore/bindings/js/JSArrayBufferConstructor.h deleted file mode 100644 index fa07a55..0000000 --- a/WebCore/bindings/js/JSArrayBufferConstructor.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSArrayBufferConstructor_h -#define JSArrayBufferConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" -#include "JSArrayBuffer.h" -#include <runtime/Error.h> -#include "ArrayBuffer.h" - -namespace WebCore { - - class ArrayBufferView; - - // Template function used by CanvasXXXArrayConstructors - template<class C, typename T> - PassRefPtr<ArrayBufferView> construct(JSC::ExecState* exec, const JSC::ArgList& args) - { - // There are 3 constructors: - // - // 1) (in int size) - // 2) (in ArrayBuffer buffer, [Optional] in int offset, [Optional] in unsigned int length) - // 3) (in sequence<T>) - This ends up being a JS "array-like" object - // - RefPtr<C> arrayObject; - - // For the 0 args case, just create an object without a buffer - if (args.size() < 1) - return C::create(0, 0, 0); - - if (args.size() > 1 && !args.at(0).isObject()) - // Invalid first argument - return 0; - - if (args.at(0).isObject()) { - RefPtr<ArrayBuffer> buffer = toArrayBuffer(args.at(0)); - if (buffer) { - unsigned offset = (args.size() > 1) ? args.at(1).toUInt32(exec) : 0; - unsigned int length = (buffer->byteLength() - offset) / sizeof(T); - if (args.size() > 2) - length = args.at(2).toUInt32(exec); - return C::create(buffer, offset, length); - } - - JSC::JSObject* array = asObject(args.at(0)); - unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec); - void* tempValues; - if (!tryFastCalloc(length, sizeof(T)).getValue(tempValues)) { - throwError(exec, createError(exec, "Error")); - return 0; - } - - OwnFastMallocPtr<T> values(static_cast<T*>(tempValues)); - for (unsigned i = 0; i < length; ++i) { - JSC::JSValue v = array->get(exec, i); - if (exec->hadException()) - return 0; - values.get()[i] = static_cast<T>(v.toNumber(exec)); - } - - return C::create(values.get(), length); - } - - unsigned size = args.at(0).toUInt32(exec); - return C::create(size); - } - - class JSArrayBufferConstructor : public DOMConstructorObject { - public: - JSArrayBufferConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - }; - -} - -#endif // JSArrayBufferConstructor_h diff --git a/WebCore/bindings/js/JSArrayBufferConstructor.cpp b/WebCore/bindings/js/JSArrayBufferCustom.cpp index 683f9d1..3555a60 100644 --- a/WebCore/bindings/js/JSArrayBufferConstructor.cpp +++ b/WebCore/bindings/js/JSArrayBufferCustom.cpp @@ -27,49 +27,31 @@ #if ENABLE(3D_CANVAS) -#include "JSArrayBufferConstructor.h" +#include "JSArrayBuffer.h" -#include "Document.h" +#include "ArrayBuffer.h" #include "ExceptionCode.h" -#include "JSArrayBuffer.h" +#include <runtime/Error.h> namespace WebCore { using namespace JSC; -const ClassInfo JSArrayBufferConstructor::s_info = { "ArrayBufferConstructor", 0, 0, 0 }; - -JSArrayBufferConstructor::JSArrayBufferConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSArrayBufferConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSArrayBufferPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasArrayBuffer(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSArrayBufferConstructor::constructJSArrayBuffer(ExecState* exec) { JSArrayBufferConstructor* jsConstructor = static_cast<JSArrayBufferConstructor*>(exec->callee()); - unsigned int size = 0; - if (exec->argumentCount() == 1) { - size = (unsigned int)exec->argument(0).toInt32(exec); - if (isnan(size)) - size = 0; - } - RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(size, 1); - if (!buffer.get()){ - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } + int length = 0; + if (exec->argumentCount() > 0) + length = exec->argument(0).toInt32(exec); // NaN/+inf/-inf returns 0, this is intended by WebIDL + RefPtr<ArrayBuffer> buffer; + if (length >= 0) + buffer = ArrayBuffer::create(static_cast<unsigned>(length), 1); + if (!buffer.get()) + return throwVMError(exec, createRangeError(exec, "ArrayBuffer size is not a small enough positive integer.")); return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), buffer.get()))); } -JSC::ConstructType JSArrayBufferConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasArrayBuffer; - return ConstructTypeHost; -} - } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSArrayBufferViewHelper.h b/WebCore/bindings/js/JSArrayBufferViewHelper.h index f632f38..331e950 100644 --- a/WebCore/bindings/js/JSArrayBufferViewHelper.h +++ b/WebCore/bindings/js/JSArrayBufferViewHelper.h @@ -27,7 +27,9 @@ #ifndef JSArrayBufferViewHelper_h #define JSArrayBufferViewHelper_h +#include "ArrayBufferView.h" #include "ExceptionCode.h" +#include "JSArrayBuffer.h" #include "JSDOMBinding.h" #include <interpreter/CallFrame.h> #include <runtime/ArgList.h> @@ -81,6 +83,73 @@ JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionF return JSC::throwSyntaxError(exec); } +// Template function used by XXXArrayConstructors. +// If this returns 0, it will already have thrown a JavaScript exception. +template<class C, typename T> +PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec) +{ + // There are 3 constructors: + // + // 1) (in int size) + // 2) (in ArrayBuffer buffer, [Optional] in int offset, [Optional] in unsigned int length) + // 3) (in sequence<T>) - This ends up being a JS "array-like" object + // + RefPtr<C> arrayObject; + + // For the 0 args case, just create an object without a buffer + if (exec->argumentCount() < 1) + return C::create(0, 0, 0); + + if (exec->argument(0).isNull()) { + // Invalid first argument + throwTypeError(exec); + return 0; + } + + if (exec->argument(0).isObject()) { + RefPtr<ArrayBuffer> buffer = toArrayBuffer(exec->argument(0)); + if (buffer) { + unsigned offset = (exec->argumentCount() > 1) ? exec->argument(1).toUInt32(exec) : 0; + unsigned int length = (buffer->byteLength() - offset) / sizeof(T); + if (exec->argumentCount() > 2) + length = exec->argument(2).toUInt32(exec); + PassRefPtr<ArrayBufferView> array = C::create(buffer, offset, length); + if (!array) + setDOMException(exec, INDEX_SIZE_ERR); + return array; + } + + JSC::JSObject* array = asObject(exec->argument(0)); + unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec); + void* tempValues; + if (!tryFastCalloc(length, sizeof(T)).getValue(tempValues)) { + JSC::throwError(exec, createError(exec, "Error")); + return 0; + } + + OwnFastMallocPtr<T> values(static_cast<T*>(tempValues)); + for (unsigned i = 0; i < length; ++i) { + JSC::JSValue v = array->get(exec, i); + if (exec->hadException()) + return 0; + values.get()[i] = static_cast<T>(v.toNumber(exec)); + } + + PassRefPtr<ArrayBufferView> result = C::create(values.get(), length); + if (!result) + setDOMException(exec, INDEX_SIZE_ERR); + return result; + } + + int length = exec->argument(0).toInt32(exec); + PassRefPtr<ArrayBufferView> result; + if (length >= 0) + result = C::create(static_cast<unsigned>(length)); + if (!result) + throwError(exec, createRangeError(exec, "ArrayBufferView size is not a small enough positive integer.")); + return result; } +} // namespace WebCore + #endif // JSArrayBufferViewHelper_h diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp index ae31608..1d64198 100644 --- a/WebCore/bindings/js/JSBindingsAllInOne.cpp +++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,7 +58,7 @@ #include "JSElementCustom.cpp" #include "JSEventCustom.cpp" #include "JSEventListener.cpp" -#include "JSEventSourceConstructor.cpp" +#include "JSEventSourceCustom.cpp" #include "JSEventTarget.cpp" #include "JSExceptionBase.cpp" #include "JSHTMLAllCollectionCustom.cpp" @@ -86,7 +86,6 @@ #include "JSLazyEventListener.cpp" #include "JSLocationCustom.cpp" #include "JSMainThreadExecState.cpp" -#include "JSMessageChannelConstructor.cpp" #include "JSMessageChannelCustom.cpp" #include "JSMessageEventCustom.cpp" #include "JSMessagePortCustom.cpp" @@ -111,25 +110,21 @@ #include "JSSVGPathSegCustom.cpp" #include "JSSVGPathSegListCustom.cpp" #include "JSScriptProfileNodeCustom.cpp" -#include "JSSharedWorkerConstructor.cpp" #include "JSSharedWorkerCustom.cpp" #include "JSStorageCustom.cpp" #include "JSStyleSheetCustom.cpp" #include "JSStyleSheetListCustom.cpp" #include "JSTextCustom.cpp" #include "JSTreeWalkerCustom.cpp" -#include "JSWebKitCSSMatrixConstructor.cpp" -#include "JSWebKitPointConstructor.cpp" -#include "JSWebSocketConstructor.cpp" +#include "JSWebKitCSSMatrixCustom.cpp" +#include "JSWebKitPointCustom.cpp" #include "JSWebSocketCustom.cpp" -#include "JSWorkerConstructor.cpp" #include "JSWorkerContextBase.cpp" #include "JSWorkerContextCustom.cpp" #include "JSWorkerContextErrorHandler.cpp" #include "JSWorkerCustom.cpp" #include "JSXMLHttpRequestCustom.cpp" #include "JSXMLHttpRequestUploadCustom.cpp" -#include "JSXSLTProcessorConstructor.cpp" #include "JSXSLTProcessorCustom.cpp" #include "JavaScriptCallFrame.cpp" #include "MemoryInfo.cpp" diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 27ac9e4..8220f51 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -71,6 +71,11 @@ #include "XPathException.h" #endif +#if ENABLE(DATABASE) +#include "JSSQLException.h" +#include "SQLException.h" +#endif + using namespace JSC; namespace WebCore { @@ -600,6 +605,11 @@ void setDOMException(ExecState* exec, ExceptionCode ec) errorObject = toJS(exec, globalObject, XPathException::create(description)); break; #endif +#if ENABLE(DATABASE) + case SQLExceptionType: + errorObject = toJS(exec, globalObject, SQLException::create(description)); + break; +#endif } ASSERT(errorObject); diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 7e0a785..30d79b3 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -43,38 +43,38 @@ #include "JSDOMWindowShell.h" #include "JSEvent.h" #include "JSEventListener.h" -#include "JSEventSourceConstructor.h" +#include "JSEventSource.h" #include "JSHTMLCollection.h" #include "JSHistory.h" #include "JSImageConstructor.h" #include "JSLocation.h" -#include "JSMessageChannelConstructor.h" +#include "JSMessageChannel.h" #include "JSMessagePort.h" #include "JSMessagePortCustom.h" #include "JSOptionConstructor.h" #if ENABLE(SHARED_WORKERS) -#include "JSSharedWorkerConstructor.h" +#include "JSSharedWorker.h" #endif #if ENABLE(3D_CANVAS) -#include "JSArrayBufferConstructor.h" -#include "JSInt8ArrayConstructor.h" -#include "JSUint8ArrayConstructor.h" -#include "JSInt32ArrayConstructor.h" -#include "JSUint32ArrayConstructor.h" -#include "JSInt16ArrayConstructor.h" -#include "JSUint16ArrayConstructor.h" -#include "JSFloat32ArrayConstructor.h" +#include "JSArrayBuffer.h" +#include "JSInt8Array.h" +#include "JSUint8Array.h" +#include "JSInt32Array.h" +#include "JSUint32Array.h" +#include "JSInt16Array.h" +#include "JSUint16Array.h" +#include "JSFloat32Array.h" #endif -#include "JSWebKitCSSMatrixConstructor.h" -#include "JSWebKitPointConstructor.h" +#include "JSWebKitCSSMatrix.h" +#include "JSWebKitPoint.h" #if ENABLE(WEB_SOCKETS) -#include "JSWebSocketConstructor.h" +#include "JSWebSocket.h" #endif -#include "JSWorkerConstructor.h" +#include "JSWorker.h" #include "JSXMLHttpRequest.h" -#include "JSXSLTProcessorConstructor.h" +#include "JSXSLTProcessor.h" #include "Location.h" #include "MediaPlayer.h" #include "MessagePort.h" diff --git a/WebCore/bindings/js/JSEventSourceConstructor.h b/WebCore/bindings/js/JSEventSourceConstructor.h deleted file mode 100644 index b2f3cb5..0000000 --- a/WebCore/bindings/js/JSEventSourceConstructor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSEventSourceConstructor_h -#define JSEventSourceConstructor_h - -#if ENABLE(EVENTSOURCE) - -#include "JSDOMBinding.h" - -namespace WebCore { - - class JSEventSourceConstructor : public DOMConstructorObject { - public: - JSEventSourceConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - }; - -} // namespace WebCore - -#endif // ENABLE(EVENTSOURCE) - -#endif // JSEventSourceConstructor_h diff --git a/WebCore/bindings/js/JSEventSourceConstructor.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp index 4524f70..aa991dd 100644 --- a/WebCore/bindings/js/JSEventSourceConstructor.cpp +++ b/WebCore/bindings/js/JSEventSourceCustom.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. + * Copyright (C) 2009 Ericsson AB. All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,11 +33,10 @@ #if ENABLE(EVENTSOURCE) -#include "JSEventSourceConstructor.h" +#include "JSEventSource.h" #include "EventSource.h" #include "ExceptionCode.h" -#include "JSEventSource.h" #include "ScriptExecutionContext.h" #include <runtime/Error.h> @@ -45,18 +44,7 @@ using namespace JSC; namespace WebCore { -ASSERT_CLASS_FITS_IN_CELL(JSEventSourceConstructor); - -const ClassInfo JSEventSourceConstructor::s_info = { "EventSourceContructor", 0, 0, 0 }; - -JSEventSourceConstructor::JSEventSourceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSEventSourceConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSEventSourcePrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); -} - -static EncodedJSValue JSC_HOST_CALL constructEventSource(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSEventSourceConstructor::constructJSEventSource(ExecState* exec) { if (exec->argumentCount() < 1) return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); @@ -80,12 +68,6 @@ static EncodedJSValue JSC_HOST_CALL constructEventSource(ExecState* exec) return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release()))); } -ConstructType JSEventSourceConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructEventSource; - return ConstructTypeHost; -} - } // namespace WebCore #endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSExceptionBase.cpp b/WebCore/bindings/js/JSExceptionBase.cpp index 3749eed..44b38ec 100644 --- a/WebCore/bindings/js/JSExceptionBase.cpp +++ b/WebCore/bindings/js/JSExceptionBase.cpp @@ -1,64 +1,72 @@ -/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSExceptionBase.h"
-
-#include "JSDOMCoreException.h"
-#include "JSEventException.h"
-#include "JSRangeException.h"
-#include "JSXMLHttpRequestException.h"
-#if ENABLE(SVG)
-#include "JSSVGException.h"
-#endif
-#if ENABLE(XPATH)
-#include "JSXPathException.h"
-#endif
-
-namespace WebCore {
-
-ExceptionBase* toExceptionBase(JSC::JSValue value)
-{
- if (DOMCoreException* domException = toDOMCoreException(value))
- return reinterpret_cast<ExceptionBase*>(domException);
- if (RangeException* rangeException = toRangeException(value))
- return reinterpret_cast<ExceptionBase*>(rangeException);
- if (EventException* eventException = toEventException(value))
- return reinterpret_cast<ExceptionBase*>(eventException);
- if (XMLHttpRequestException* xmlHttpException = toXMLHttpRequestException(value))
- return reinterpret_cast<ExceptionBase*>(xmlHttpException);
-#if ENABLE(SVG)
- if (SVGException* svgException = toSVGException(value))
- return reinterpret_cast<ExceptionBase*>(svgException);
-#endif
-#if ENABLE(XPATH)
- if (XPathException* pathException = toXPathException(value))
- return reinterpret_cast<ExceptionBase*>(pathException);
-#endif
-
- return 0;
-}
-
-} // namespace WebCore
+/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JSExceptionBase.h" + +#include "JSDOMCoreException.h" +#include "JSEventException.h" +#include "JSRangeException.h" +#include "JSXMLHttpRequestException.h" +#if ENABLE(DATABASE) +#include "SQLException.h" +#include "JSSQLException.h" +#endif +#if ENABLE(SVG) +#include "JSSVGException.h" +#endif +#if ENABLE(XPATH) +#include "JSXPathException.h" +#endif + +namespace WebCore { + +ExceptionBase* toExceptionBase(JSC::JSValue value) +{ + if (DOMCoreException* domException = toDOMCoreException(value)) + return reinterpret_cast<ExceptionBase*>(domException); + if (RangeException* rangeException = toRangeException(value)) + return reinterpret_cast<ExceptionBase*>(rangeException); + if (EventException* eventException = toEventException(value)) + return reinterpret_cast<ExceptionBase*>(eventException); + if (XMLHttpRequestException* xmlHttpException = toXMLHttpRequestException(value)) + return reinterpret_cast<ExceptionBase*>(xmlHttpException); +#if ENABLE(SVG) + if (SVGException* svgException = toSVGException(value)) + return reinterpret_cast<ExceptionBase*>(svgException); +#endif +#if ENABLE(XPATH) + if (XPathException* pathException = toXPathException(value)) + return reinterpret_cast<ExceptionBase*>(pathException); +#endif +#if ENABLE(DATABASE) + if (SQLException* pathException = toSQLException(value)) + return reinterpret_cast<ExceptionBase*>(pathException); +#endif + + return 0; +} + +} // namespace WebCore diff --git a/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp b/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp deleted file mode 100644 index 08cffb5..0000000 --- a/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSFloat32ArrayConstructor.h" - -#include "Document.h" -#include "Float32Array.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSFloat32Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSFloat32ArrayConstructor::s_info = { "Float32ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSFloat32ArrayConstructor::JSFloat32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSFloat32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSFloat32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSFloat32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSFloat32ArrayPrototype(globalObject, JSFloat32ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSFloat32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSFloat32ArrayConstructor, DOMObject>(exec, JSFloat32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSFloat32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSFloat32ArrayConstructor, DOMObject>(exec, JSFloat32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasFloatArray(ExecState* exec) -{ - ArgList args(exec); - JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee()); - RefPtr<Float32Array> array = static_cast<Float32Array*>(construct<Float32Array, float>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSFloat32ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasFloatArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSFloat32ArrayConstructor.h b/WebCore/bindings/js/JSFloat32ArrayConstructor.h deleted file mode 100644 index c2f8b7e..0000000 --- a/WebCore/bindings/js/JSFloat32ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSFloat32ArrayConstructor_h -#define JSFloat32ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSFloat32ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSFloat32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSFloat32ArrayConstructor_h diff --git a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp index 7965274..3be7458 100644 --- a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp +++ b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp @@ -51,6 +51,16 @@ JSC::JSValue JSFloat32Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toFloat32Array); } +EncodedJSValue JSC_HOST_CALL JSFloat32ArrayConstructor::constructJSFloat32Array(ExecState* exec) +{ + JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee()); + RefPtr<Float32Array> array = static_cast<Float32Array*>(constructArrayBufferView<Float32Array, float>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSInt16ArrayConstructor.cpp b/WebCore/bindings/js/JSInt16ArrayConstructor.cpp deleted file mode 100644 index aaed578..0000000 --- a/WebCore/bindings/js/JSInt16ArrayConstructor.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSInt16ArrayConstructor.h" - -#include "Document.h" -#include "Int16Array.h" -#include "JSArrayBufferView.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSInt16Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSInt16ArrayConstructor::s_info = { "Int16ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSInt16ArrayConstructor::JSInt16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSInt16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSInt16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSInt16ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSInt16ArrayPrototype(globalObject, JSInt16ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSInt16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSInt16ArrayConstructor, DOMObject>(exec, JSInt16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSInt16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSInt16ArrayConstructor, DOMObject>(exec, JSInt16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasShortArray(ExecState* exec) -{ - ArgList args(exec); - JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee()); - RefPtr<Int16Array> array = static_cast<Int16Array*>(construct<Int16Array, short>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSInt16ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasShortArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSInt16ArrayConstructor.h b/WebCore/bindings/js/JSInt16ArrayConstructor.h deleted file mode 100644 index 87908a0..0000000 --- a/WebCore/bindings/js/JSInt16ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSInt16ArrayConstructor_h -#define JSInt16ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSInt16ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSInt16ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSInt16ArrayConstructor_h diff --git a/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/WebCore/bindings/js/JSInt16ArrayCustom.cpp index 2888a1b..e8be4d1 100644 --- a/WebCore/bindings/js/JSInt16ArrayCustom.cpp +++ b/WebCore/bindings/js/JSInt16ArrayCustom.cpp @@ -51,6 +51,16 @@ JSC::JSValue JSInt16Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toInt16Array); } +EncodedJSValue JSC_HOST_CALL JSInt16ArrayConstructor::constructJSInt16Array(ExecState* exec) +{ + JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee()); + RefPtr<Int16Array> array = static_cast<Int16Array*>(constructArrayBufferView<Int16Array, short>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSInt32ArrayConstructor.cpp b/WebCore/bindings/js/JSInt32ArrayConstructor.cpp deleted file mode 100644 index b44c9ca..0000000 --- a/WebCore/bindings/js/JSInt32ArrayConstructor.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSInt32ArrayConstructor.h" - -#include "Document.h" -#include "Int32Array.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSInt32Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSInt32ArrayConstructor::s_info = { "Int32ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSInt32ArrayConstructor::JSInt32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSInt32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSInt32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSInt32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSInt32ArrayPrototype(globalObject, JSInt32ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSInt32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSInt32ArrayConstructor, DOMObject>(exec, JSInt32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSInt32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSInt32ArrayConstructor, DOMObject>(exec, JSInt32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasIntArray(ExecState* exec) -{ - ArgList args(exec); - JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee()); - RefPtr<Int32Array> array = static_cast<Int32Array*>(construct<Int32Array, int>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSInt32ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasIntArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSInt32ArrayConstructor.h b/WebCore/bindings/js/JSInt32ArrayConstructor.h deleted file mode 100644 index 6bed3c4..0000000 --- a/WebCore/bindings/js/JSInt32ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSInt32ArrayConstructor_h -#define JSInt32ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSInt32ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSInt32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSInt32ArrayConstructor_h diff --git a/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/WebCore/bindings/js/JSInt32ArrayCustom.cpp index cfdab63..ee5712b 100644 --- a/WebCore/bindings/js/JSInt32ArrayCustom.cpp +++ b/WebCore/bindings/js/JSInt32ArrayCustom.cpp @@ -51,6 +51,16 @@ JSC::JSValue JSInt32Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toInt32Array); } +EncodedJSValue JSC_HOST_CALL JSInt32ArrayConstructor::constructJSInt32Array(ExecState* exec) +{ + JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee()); + RefPtr<Int32Array> array = static_cast<Int32Array*>(constructArrayBufferView<Int32Array, int>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSInt8ArrayConstructor.cpp b/WebCore/bindings/js/JSInt8ArrayConstructor.cpp deleted file mode 100644 index e4c5688..0000000 --- a/WebCore/bindings/js/JSInt8ArrayConstructor.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSInt8ArrayConstructor.h" - -#include "Document.h" -#include "Int8Array.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSInt8Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSInt8ArrayConstructor::s_info = { "Int8ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSInt8ArrayConstructor::JSInt8ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSInt8ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSInt8ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSInt8ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSInt8ArrayPrototype(globalObject, JSInt8ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSInt8ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSInt8ArrayConstructor, DOMObject>(exec, JSInt8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSInt8ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSInt8ArrayConstructor, DOMObject>(exec, JSInt8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasByteArray(ExecState* exec) -{ - ArgList args(exec); - JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee()); - RefPtr<Int8Array> array = static_cast<Int8Array*>(construct<Int8Array, signed char>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSInt8ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasByteArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSInt8ArrayConstructor.h b/WebCore/bindings/js/JSInt8ArrayConstructor.h deleted file mode 100644 index 96482fc..0000000 --- a/WebCore/bindings/js/JSInt8ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSInt8ArrayConstructor_h -#define JSInt8ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSInt8ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSInt8ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSInt8ArrayConstructor_h diff --git a/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/WebCore/bindings/js/JSInt8ArrayCustom.cpp index 9d41694..70f18a5 100644 --- a/WebCore/bindings/js/JSInt8ArrayCustom.cpp +++ b/WebCore/bindings/js/JSInt8ArrayCustom.cpp @@ -31,7 +31,6 @@ #include "JSInt8Array.h" #include "Int8Array.h" - #include <runtime/Error.h> using namespace JSC; @@ -53,6 +52,16 @@ JSC::JSValue JSInt8Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toInt8Array); } +EncodedJSValue JSC_HOST_CALL JSInt8ArrayConstructor::constructJSInt8Array(ExecState* exec) +{ + JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee()); + RefPtr<Int8Array> array = static_cast<Int8Array*>(constructArrayBufferView<Int8Array, signed char>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp deleted file mode 100644 index b188ed5..0000000 --- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JSMessageChannelConstructor.h" - -#include "Document.h" -#include "JSDocument.h" -#include "JSMessageChannel.h" -#include "MessageChannel.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -const ClassInfo JSMessageChannelConstructor::s_info = { "MessageChannelConstructor", 0, 0, 0 }; - -JSMessageChannelConstructor::JSMessageChannelConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSMessageChannelConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSMessageChannelPrototype::self(exec, globalObject), None); -} - -JSMessageChannelConstructor::~JSMessageChannelConstructor() -{ -} - -ConstructType JSMessageChannelConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = construct; - return ConstructTypeHost; -} - -EncodedJSValue JSC_HOST_CALL JSMessageChannelConstructor::construct(ExecState* exec) -{ - JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(exec->callee()); - ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); - if (!context) - return throwVMError(exec, createReferenceError(exec, "MessageChannel constructor associated document is unavailable")); - - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), MessageChannel::create(context)))); -} - -} // namespace WebCore diff --git a/WebCore/bindings/js/JSMessageChannelCustom.cpp b/WebCore/bindings/js/JSMessageChannelCustom.cpp index d28d494..c2f5779 100644 --- a/WebCore/bindings/js/JSMessageChannelCustom.cpp +++ b/WebCore/bindings/js/JSMessageChannelCustom.cpp @@ -27,6 +27,7 @@ #include "JSMessageChannel.h" #include "MessageChannel.h" +#include <runtime/Error.h> using namespace JSC; @@ -43,4 +44,14 @@ void JSMessageChannel::markChildren(MarkStack& markStack) markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), port); } +EncodedJSValue JSC_HOST_CALL JSMessageChannelConstructor::constructJSMessageChannel(ExecState* exec) +{ + JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(exec->callee()); + ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); + if (!context) + return throwVMError(exec, createReferenceError(exec, "MessageChannel constructor associated document is unavailable")); + + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), MessageChannel::create(context)))); +} + } // namespace WebCore diff --git a/WebCore/bindings/js/JSSharedWorkerConstructor.cpp b/WebCore/bindings/js/JSSharedWorkerConstructor.cpp deleted file mode 100644 index f2bf6de..0000000 --- a/WebCore/bindings/js/JSSharedWorkerConstructor.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(SHARED_WORKERS) - -#include "JSSharedWorkerConstructor.h" - -#include "JSDOMWindowCustom.h" -#include "JSSharedWorker.h" -#include "SharedWorker.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -const ClassInfo JSSharedWorkerConstructor::s_info = { "SharedWorkerConstructor", 0, 0, 0 }; - -JSSharedWorkerConstructor::JSSharedWorkerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSSharedWorkerConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSSharedWorkerPrototype::self(exec, globalObject), None); - // Host functions have a length property describing the number of expected arguments. - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); -} - -static EncodedJSValue JSC_HOST_CALL constructSharedWorker(ExecState* exec) -{ - JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(exec->callee()); - - if (exec->argumentCount() < 1) - return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - - UString scriptURL = exec->argument(0).toString(exec); - UString name; - if (exec->argumentCount() > 1) - name = exec->argument(1).toString(exec); - - if (exec->hadException()) - return JSValue::encode(JSValue()); - - // FIXME: We need to use both the dynamic scope and the lexical scope (dynamic scope for resolving the worker URL) - DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); - ExceptionCode ec = 0; - RefPtr<SharedWorker> worker = SharedWorker::create(ustringToString(scriptURL), ustringToString(name), window->document(), ec); - setDOMException(exec, ec); - - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release()))); -} - -ConstructType JSSharedWorkerConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructSharedWorker; - return ConstructTypeHost; -} - - -} // namespace WebCore - -#endif // ENABLE(SHARED_WORKERS) diff --git a/WebCore/bindings/js/JSSharedWorkerCustom.cpp b/WebCore/bindings/js/JSSharedWorkerCustom.cpp index 4617087..261ae2b 100644 --- a/WebCore/bindings/js/JSSharedWorkerCustom.cpp +++ b/WebCore/bindings/js/JSSharedWorkerCustom.cpp @@ -35,7 +35,9 @@ #include "JSSharedWorker.h" #include "JSDOMGlobalObject.h" +#include "JSDOMWindowCustom.h" #include "SharedWorker.h" +#include <runtime/Error.h> using namespace JSC; @@ -49,6 +51,30 @@ void JSSharedWorker::markChildren(MarkStack& markStack) markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), port); } +EncodedJSValue JSC_HOST_CALL JSSharedWorkerConstructor::constructJSSharedWorker(ExecState* exec) +{ + JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(exec->callee()); + + if (exec->argumentCount() < 1) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); + + UString scriptURL = exec->argument(0).toString(exec); + UString name; + if (exec->argumentCount() > 1) + name = exec->argument(1).toString(exec); + + if (exec->hadException()) + return JSValue::encode(JSValue()); + + // FIXME: We need to use both the dynamic scope and the lexical scope (dynamic scope for resolving the worker URL) + DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); + ExceptionCode ec = 0; + RefPtr<SharedWorker> worker = SharedWorker::create(ustringToString(scriptURL), ustringToString(name), window->document(), ec); + setDOMException(exec, ec); + + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release()))); +} + } // namespace WebCore #endif // ENABLE(SHARED_WORKERS) diff --git a/WebCore/bindings/js/JSUint16ArrayConstructor.cpp b/WebCore/bindings/js/JSUint16ArrayConstructor.cpp deleted file mode 100644 index b1770c5..0000000 --- a/WebCore/bindings/js/JSUint16ArrayConstructor.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSUint16ArrayConstructor.h" - -#include "Document.h" -#include "Uint16Array.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSUint16Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSUint16ArrayConstructor::s_info = { "Uint16ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSUint16ArrayConstructor::JSUint16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSUint16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSUint16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSUint16ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSUint16ArrayPrototype(globalObject, JSUint16ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSUint16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSUint16ArrayConstructor, DOMObject>(exec, JSUint16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSUint16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSUint16ArrayConstructor, DOMObject>(exec, JSUint16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedShortArray(ExecState* exec) -{ - ArgList args(exec); - JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee()); - RefPtr<Uint16Array> array = static_cast<Uint16Array*>(construct<Uint16Array, unsigned short>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSUint16ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasUnsignedShortArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSUint16ArrayConstructor.h b/WebCore/bindings/js/JSUint16ArrayConstructor.h deleted file mode 100644 index b950791..0000000 --- a/WebCore/bindings/js/JSUint16ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSUint16ArrayConstructor_h -#define JSUint16ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSUint16ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSUint16ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSUint16ArrayConstructor_h diff --git a/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/WebCore/bindings/js/JSUint16ArrayCustom.cpp index 4eb254f..ccea62f 100644 --- a/WebCore/bindings/js/JSUint16ArrayCustom.cpp +++ b/WebCore/bindings/js/JSUint16ArrayCustom.cpp @@ -51,6 +51,16 @@ JSC::JSValue JSUint16Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toUint16Array); } +EncodedJSValue JSC_HOST_CALL JSUint16ArrayConstructor::constructJSUint16Array(ExecState* exec) +{ + JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee()); + RefPtr<Uint16Array> array = static_cast<Uint16Array*>(constructArrayBufferView<Uint16Array, unsigned short>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSUint32ArrayConstructor.cpp b/WebCore/bindings/js/JSUint32ArrayConstructor.cpp deleted file mode 100644 index 46ec9da..0000000 --- a/WebCore/bindings/js/JSUint32ArrayConstructor.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSUint32ArrayConstructor.h" - -#include "Document.h" -#include "Uint32Array.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSUint32Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSUint32ArrayConstructor::s_info = { "Uint32ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSUint32ArrayConstructor::JSUint32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSUint32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSUint32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSUint32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSUint32ArrayPrototype(globalObject, JSUint32ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSUint32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSUint32ArrayConstructor, DOMObject>(exec, JSUint32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSUint32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSUint32ArrayConstructor, DOMObject>(exec, JSUint32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedIntArray(ExecState* exec) -{ - ArgList args(exec); - JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee()); - RefPtr<Uint32Array> array = static_cast<Uint32Array*>(construct<Uint32Array, unsigned int>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSUint32ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasUnsignedIntArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSUint32ArrayConstructor.h b/WebCore/bindings/js/JSUint32ArrayConstructor.h deleted file mode 100644 index 7cad849..0000000 --- a/WebCore/bindings/js/JSUint32ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSUint32ArrayConstructor_h -#define JSUint32ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSUint32ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSUint32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSUint32ArrayConstructor_h diff --git a/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/WebCore/bindings/js/JSUint32ArrayCustom.cpp index 2826b6a..31ec8cb 100644 --- a/WebCore/bindings/js/JSUint32ArrayCustom.cpp +++ b/WebCore/bindings/js/JSUint32ArrayCustom.cpp @@ -51,6 +51,16 @@ JSC::JSValue JSUint32Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toUint32Array); } +EncodedJSValue JSC_HOST_CALL JSUint32ArrayConstructor::constructJSUint32Array(ExecState* exec) +{ + JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee()); + RefPtr<Uint32Array> array = static_cast<Uint32Array*>(constructArrayBufferView<Uint32Array, unsigned int>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSUint8ArrayConstructor.cpp b/WebCore/bindings/js/JSUint8ArrayConstructor.cpp deleted file mode 100644 index 0d47b51..0000000 --- a/WebCore/bindings/js/JSUint8ArrayConstructor.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "JSUint8ArrayConstructor.h" - -#include "Document.h" -#include "ExceptionCode.h" -#include "Uint8Array.h" -#include "JSArrayBuffer.h" -#include "JSArrayBufferConstructor.h" -#include "JSUint8Array.h" -#include <runtime/Error.h> - -namespace WebCore { - -using namespace JSC; - -const ClassInfo JSUint8ArrayConstructor::s_info = { "Uint8ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 }; - -JSUint8ArrayConstructor::JSUint8ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSUint8ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSUint8ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -JSObject* JSUint8ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return new (exec) JSUint8ArrayPrototype(globalObject, JSUint8ArrayPrototype::createStructure(globalObject->objectPrototype())); -} - -bool JSUint8ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSUint8ArrayConstructor, DOMObject>(exec, JSUint8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot); -} - -bool JSUint8ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSUint8ArrayConstructor, DOMObject>(exec, JSUint8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor); -} - -static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedByteArray(ExecState* exec) -{ - ArgList args(exec); - JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee()); - RefPtr<Uint8Array> array = static_cast<Uint8Array*>(construct<Uint8Array, unsigned char>(exec, args).get()); - if (!array.get()) { - setDOMException(exec, INDEX_SIZE_ERR); - return JSValue::encode(JSValue()); - } - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); -} - -JSC::ConstructType JSUint8ArrayConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructCanvasUnsignedByteArray; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSUint8ArrayConstructor.h b/WebCore/bindings/js/JSUint8ArrayConstructor.h deleted file mode 100644 index 644cf86..0000000 --- a/WebCore/bindings/js/JSUint8ArrayConstructor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSUint8ArrayConstructor_h -#define JSUint8ArrayConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" - -namespace WebCore { - - class JSUint8ArrayConstructor : public DOMConstructorObject { - typedef DOMConstructorObject Base; - public: - JSUint8ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); - virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); - virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - static const JSC::ClassInfo s_info; - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) - { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); - } - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; - }; - -} - -#endif // JSUint8ArrayConstructor_h diff --git a/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/WebCore/bindings/js/JSUint8ArrayCustom.cpp index 45c80c0..7361b08 100644 --- a/WebCore/bindings/js/JSUint8ArrayCustom.cpp +++ b/WebCore/bindings/js/JSUint8ArrayCustom.cpp @@ -51,6 +51,16 @@ JSC::JSValue JSUint8Array::set(JSC::ExecState* exec) return setWebGLArrayHelper(exec, impl(), toUint8Array); } +EncodedJSValue JSC_HOST_CALL JSUint8ArrayConstructor::constructJSUint8Array(ExecState* exec) +{ + JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee()); + RefPtr<Uint8Array> array = static_cast<Uint8Array*>(constructArrayBufferView<Uint8Array, unsigned char>(exec).get()); + if (!array.get()) + // Exception has already been thrown. + return JSValue::encode(JSValue()); + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get()))); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp b/WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp index 5013a6d..0889dcf 100644 --- a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp +++ b/WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp @@ -24,25 +24,15 @@ */ #include "config.h" -#include "JSWebKitCSSMatrixConstructor.h" +#include "JSWebKitCSSMatrix.h" #include "WebKitCSSMatrix.h" -#include "JSWebKitCSSMatrix.h" using namespace JSC; namespace WebCore { -const ClassInfo JSWebKitCSSMatrixConstructor::s_info = { "WebKitCSSMatrixConstructor", 0, 0, 0 }; - -JSWebKitCSSMatrixConstructor::JSWebKitCSSMatrixConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSWebKitCSSMatrixConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSWebKitCSSMatrixPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); -} - -static EncodedJSValue JSC_HOST_CALL constructWebKitCSSMatrix(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSWebKitCSSMatrixConstructor::constructJSWebKitCSSMatrix(ExecState* exec) { JSWebKitCSSMatrixConstructor* jsConstructor = static_cast<JSWebKitCSSMatrixConstructor*>(exec->callee()); String s; @@ -55,10 +45,4 @@ static EncodedJSValue JSC_HOST_CALL constructWebKitCSSMatrix(ExecState* exec) return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebKitCSSMatrix, matrix.get())); } -ConstructType JSWebKitCSSMatrixConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructWebKitCSSMatrix; - return ConstructTypeHost; -} - } // namespace WebCore diff --git a/WebCore/bindings/js/JSWebKitPointConstructor.cpp b/WebCore/bindings/js/JSWebKitPointCustom.cpp index c62f5b6..e1b20ce 100644 --- a/WebCore/bindings/js/JSWebKitPointConstructor.cpp +++ b/WebCore/bindings/js/JSWebKitPointCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,34 +24,23 @@ */ #include "config.h" -#include "JSWebKitPointConstructor.h" - -#include "Document.h" -#include "WebKitPoint.h" #include "JSWebKitPoint.h" -namespace WebCore { +#include "WebKitPoint.h" using namespace JSC; -const ClassInfo JSWebKitPointConstructor::s_info = { "WebKitPointConstructor", 0, 0, 0 }; - -JSWebKitPointConstructor::JSWebKitPointConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSWebKitPointConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSWebKitPointPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum); -} +namespace WebCore { -static EncodedJSValue JSC_HOST_CALL constructWebKitPoint(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSWebKitPointConstructor::constructJSWebKitPoint(ExecState* exec) { JSWebKitPointConstructor* jsConstructor = static_cast<JSWebKitPointConstructor*>(exec->callee()); float x = 0; float y = 0; if (exec->argumentCount() >= 2) { - x = (float)exec->argument(0).toNumber(exec); - y = (float)exec->argument(1).toNumber(exec); + x = static_cast<float>(exec->argument(0).toNumber(exec)); + y = static_cast<float>(exec->argument(1).toNumber(exec)); if (isnan(x)) x = 0; if (isnan(y)) @@ -60,11 +49,4 @@ static EncodedJSValue JSC_HOST_CALL constructWebKitPoint(ExecState* exec) return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), WebKitPoint::create(x, y)))); } -JSC::ConstructType JSWebKitPointConstructor::getConstructData(JSC::ConstructData& constructData) -{ - constructData.native.function = constructWebKitPoint; - return ConstructTypeHost; -} - - } // namespace WebCore diff --git a/WebCore/bindings/js/JSWebSocketConstructor.cpp b/WebCore/bindings/js/JSWebSocketConstructor.cpp deleted file mode 100644 index 2384c7b..0000000 --- a/WebCore/bindings/js/JSWebSocketConstructor.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WEB_SOCKETS) - -#include "JSWebSocketConstructor.h" - -#include "JSWebSocket.h" -#include "ScriptExecutionContext.h" -#include "WebSocket.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -ASSERT_CLASS_FITS_IN_CELL(JSWebSocketConstructor); - -const ClassInfo JSWebSocketConstructor::s_info = { "WebSocketConstructor", 0, 0, 0 }; - -JSWebSocketConstructor::JSWebSocketConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSWebSocketConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSWebSocketPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); -} - -static EncodedJSValue JSC_HOST_CALL constructWebSocket(ExecState* exec) -{ - JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(exec->callee()); - ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); - if (!context) - return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable")); - - if (!exec->argumentCount()) - return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - - const String& urlString = ustringToString(exec->argument(0).toString(exec)); - if (exec->hadException()) - return throwVMError(exec, createSyntaxError(exec, "wrong URL")); - const KURL& url = context->completeURL(urlString); - RefPtr<WebSocket> webSocket = WebSocket::create(context); - ExceptionCode ec = 0; - if (exec->argumentCount() < 2) - webSocket->connect(url, ec); - else { - const String& protocol = ustringToString(exec->argument(1).toString(exec)); - if (exec->hadException()) - return JSValue::encode(JSValue()); - webSocket->connect(url, protocol, ec); - } - setDOMException(exec, ec); - return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get())); -} - -ConstructType JSWebSocketConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructWebSocket; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index eb0fda0..3567206 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * Copyright (C) 2009 Apple, Inc. All rights reserved. + * Copyright (C) 2009, 2010 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 @@ -44,21 +44,34 @@ using namespace JSC; namespace WebCore { -// Custom functions -JSValue JSWebSocket::send(ExecState* exec) +EncodedJSValue JSC_HOST_CALL JSWebSocketConstructor::constructJSWebSocket(ExecState* exec) { - if (exec->argumentCount() < 1) - return throwError(exec, createSyntaxError(exec, "Not enough arguments")); + JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(exec->callee()); + ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); + if (!context) + return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable")); - const String& msg = ustringToString(exec->argument(0).toString(exec)); + if (!exec->argumentCount()) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); + + const String& urlString = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) - return throwError(exec, createSyntaxError(exec, "bad message data.")); + return throwVMError(exec, createSyntaxError(exec, "wrong URL")); + const KURL& url = context->completeURL(urlString); + RefPtr<WebSocket> webSocket = WebSocket::create(context); ExceptionCode ec = 0; - JSValue ret = jsBoolean(impl()->send(msg, ec)); + if (exec->argumentCount() < 2) + webSocket->connect(url, ec); + else { + const String& protocol = ustringToString(exec->argument(1).toString(exec)); + if (exec->hadException()) + return JSValue::encode(JSValue()); + webSocket->connect(url, protocol, ec); + } setDOMException(exec, ec); - return ret; + return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get())); } -} // namespace WebCore +} // namespace WebCore #endif diff --git a/WebCore/bindings/js/JSWorkerConstructor.cpp b/WebCore/bindings/js/JSWorkerConstructor.cpp deleted file mode 100644 index 13d8ddc..0000000 --- a/WebCore/bindings/js/JSWorkerConstructor.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2008 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WORKERS) - -#include "JSWorkerConstructor.h" - -#include "Document.h" -#include "ExceptionCode.h" -#include "JSDOMWindowCustom.h" -#include "JSWorker.h" -#include "Worker.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -const ClassInfo JSWorkerConstructor::s_info = { "WorkerConstructor", 0, 0, 0 }; - -JSWorkerConstructor::JSWorkerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSWorkerConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSWorkerPrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); -} - -static EncodedJSValue JSC_HOST_CALL constructWorker(ExecState* exec) -{ - JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(exec->callee()); - - if (!exec->argumentCount()) - return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); - - UString scriptURL = exec->argument(0).toString(exec); - if (exec->hadException()) - return JSValue::encode(JSValue()); - - // See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject. - DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); - - ExceptionCode ec = 0; - RefPtr<Worker> worker = Worker::create(ustringToString(scriptURL), window->document(), ec); - if (ec) { - setDOMException(exec, ec); - return JSValue::encode(JSValue()); - } - - return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release()))); -} - -ConstructType JSWorkerConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructWorker; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(WORKERS) diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 2bde58b..b443f90 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -31,6 +31,7 @@ #if ENABLE(DATABASE) #include "Database.h" +#include "DatabaseSync.h" #include "JSDatabase.h" #include "JSDatabaseCallback.h" #include "JSDatabaseSync.h" @@ -39,10 +40,9 @@ #include "JSDOMBinding.h" #include "JSDOMGlobalObject.h" #include "JSEventListener.h" -#include "JSEventSourceConstructor.h" -#include "JSMessageChannelConstructor.h" +#include "JSEventSource.h" +#include "JSMessageChannel.h" #include "JSMessagePort.h" -#include "JSWebSocketConstructor.h" #include "JSWorkerLocation.h" #include "JSWorkerNavigator.h" #include "JSXMLHttpRequest.h" @@ -52,6 +52,10 @@ #include "WorkerNavigator.h" #include <interpreter/Interpreter.h> +#if ENABLE(WEB_SOCKETS) +#include "JSWebSocket.h" +#endif + using namespace JSC; namespace WebCore { diff --git a/WebCore/bindings/js/JSWorkerCustom.cpp b/WebCore/bindings/js/JSWorkerCustom.cpp index 64d9d41..27580ae 100644 --- a/WebCore/bindings/js/JSWorkerCustom.cpp +++ b/WebCore/bindings/js/JSWorkerCustom.cpp @@ -32,6 +32,8 @@ #include "JSDOMGlobalObject.h" #include "JSMessagePortCustom.h" #include "Worker.h" +#include "JSDOMWindowCustom.h" +#include <runtime/Error.h> using namespace JSC; @@ -42,6 +44,30 @@ JSC::JSValue JSWorker::postMessage(JSC::ExecState* exec) return handlePostMessage(exec, impl()); } +EncodedJSValue JSC_HOST_CALL JSWorkerConstructor::constructJSWorker(ExecState* exec) +{ + JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(exec->callee()); + + if (!exec->argumentCount()) + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); + + UString scriptURL = exec->argument(0).toString(exec); + if (exec->hadException()) + return JSValue::encode(JSValue()); + + // See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject. + DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); + + ExceptionCode ec = 0; + RefPtr<Worker> worker = Worker::create(ustringToString(scriptURL), window->document(), ec); + if (ec) { + setDOMException(exec, ec); + return JSValue::encode(JSValue()); + } + + return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release()))); +} + } // namespace WebCore #endif // ENABLE(WORKERS) diff --git a/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp b/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp deleted file mode 100644 index b2ebef3..0000000 --- a/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2008 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(XSLT) - -#include "JSXSLTProcessorConstructor.h" - -#include "JSXSLTProcessor.h" -#include "XSLTProcessor.h" -#include <wtf/RefPtr.h> - -using namespace JSC; - -namespace WebCore { - -ASSERT_CLASS_FITS_IN_CELL(JSXSLTProcessorConstructor); - -const ClassInfo JSXSLTProcessorConstructor::s_info = { "XSLTProcessorConsructor", 0, 0, 0 }; - -JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSXSLTProcessorConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec, globalObject), None); -} - -static EncodedJSValue JSC_HOST_CALL constructXSLTProcessor(ExecState* exec) -{ - JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(exec->callee()); - return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XSLTProcessor, XSLTProcessor::create().get())); -} - -ConstructType JSXSLTProcessorConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructXSLTProcessor; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(XSLT) diff --git a/WebCore/bindings/js/JSXSLTProcessorConstructor.h b/WebCore/bindings/js/JSXSLTProcessorConstructor.h deleted file mode 100644 index 96fa607..0000000 --- a/WebCore/bindings/js/JSXSLTProcessorConstructor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005, 2008 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSXSLTProcessorConstructor_h -#define JSXSLTProcessorConstructor_h - -#if ENABLE(XSLT) - -#include "JSDOMBinding.h" - -namespace WebCore { - - class JSXSLTProcessorConstructor : public DOMConstructorObject { - public: - JSXSLTProcessorConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - }; - -} // namespace WebCore - -#endif // ENABLE(XSLT) - -#endif // JSXSLTProcessorConstructor_h diff --git a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp index 63aa2b5..3423272 100644 --- a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp +++ b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp @@ -116,6 +116,12 @@ JSValue JSXSLTProcessor::removeParameter(ExecState* exec) return jsUndefined(); } +EncodedJSValue JSC_HOST_CALL JSXSLTProcessorConstructor::constructJSXSLTProcessor(ExecState* exec) +{ + JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(exec->callee()); + return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XSLTProcessor, XSLTProcessor::create().get())); +} + } // namespace WebCore #endif // ENABLE(XSLT) diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp index 5c4bd4c..6f0457a 100644 --- a/WebCore/bindings/js/ScriptController.cpp +++ b/WebCore/bindings/js/ScriptController.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "ScriptController.h" +#include "DocumentParser.h" #include "Event.h" #include "EventNames.h" #include "Frame.h" @@ -60,7 +61,6 @@ void ScriptController::initializeThreading() ScriptController::ScriptController(Frame* frame) : m_frame(frame) - , m_handlerLineNumber(0) , m_sourceURL(0) , m_inExecuteScript(false) , m_processingTimerCallback(false) @@ -235,6 +235,14 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) return windowShell; } +int ScriptController::eventHandlerLineNumber() const +{ + // JSC expects 1-based line numbers, so we must add one here to get it right. + if (DocumentParser* parser = m_frame->document()->parser()) + return parser->lineNumber() + 1; + return 0; +} + bool ScriptController::processingUserGesture(DOMWrapperWorld* world) const { if (m_allowPopupsFromPlugin || isJavaScriptAnchorNavigation()) diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index ee7cc7d..0debf39 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -117,9 +117,8 @@ public: ScriptValue evaluate(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS); ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS); - void setEventHandlerLineNumber(int lineno) { m_handlerLineNumber = lineno; } - int eventHandlerLineNumber() { return m_handlerLineNumber; } - + int eventHandlerLineNumber() const; + void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; } bool processingUserGesture(DOMWrapperWorld*) const; bool anyPageIsProcessingUserGesture() const; @@ -187,7 +186,6 @@ private: ShellMap m_windowShells; Frame* m_frame; - int m_handlerLineNumber; const String* m_sourceURL; bool m_inExecuteScript; diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp index eb0923b..1fd9ae4 100644 --- a/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/WebCore/bindings/js/ScriptDebugServer.cpp @@ -69,6 +69,7 @@ ScriptDebugServer::ScriptDebugServer() , m_pauseOnExceptionsState(DontPauseOnExceptions) , m_pauseOnNextStatement(false) , m_paused(false) + , m_pausedPage(0) , m_doneProcessingDebuggerEvents(true) , m_breakpointsActivated(true) , m_pauseOnCallFrame(0) @@ -113,8 +114,6 @@ void ScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page } didRemoveListener(page); - if (!hasListeners()) - didRemoveLastListener(); } void ScriptDebugServer::pageCreated(Page* page) @@ -324,7 +323,7 @@ void ScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, if (m_callingListeners) return; - Page* page = toPage(exec->dynamicGlobalObject()); + Page* page = toPage(exec->lexicalGlobalObject()); if (!page) return; @@ -360,8 +359,6 @@ void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback m_callingListeners = true; - ASSERT(hasListeners()); - if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) { ASSERT(!pageListeners->isEmpty()); dispatchFunctionToListeners(*pageListeners, callback); @@ -443,6 +440,7 @@ void ScriptDebugServer::pauseIfNeeded(Page* page) m_pauseOnCallFrame = 0; m_pauseOnNextStatement = false; m_paused = true; + m_pausedPage = page; dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, page); @@ -458,6 +456,7 @@ void ScriptDebugServer::pauseIfNeeded(Page* page) setJavaScriptPaused(page->group(), false); m_paused = false; + m_pausedPage = 0; dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, page); } @@ -573,29 +572,19 @@ void ScriptDebugServer::recompileAllJSFunctions(Timer<ScriptDebugServer>*) void ScriptDebugServer::didAddListener(Page* page) { recompileAllJSFunctionsSoon(); - - if (page) - page->setDebugger(this); - else - Page::setDebuggerForAllPages(this); + page->setDebugger(this); } void ScriptDebugServer::didRemoveListener(Page* page) { - if (page && hasListenersInterestedInPage(page)) + if (hasListenersInterestedInPage(page)) return; - recompileAllJSFunctionsSoon(); + if (m_pausedPage == page) + m_doneProcessingDebuggerEvents = true; - if (page) - page->setDebugger(0); - else - Page::setDebuggerForAllPages(0); -} - -void ScriptDebugServer::didRemoveLastListener() -{ - m_doneProcessingDebuggerEvents = true; + recompileAllJSFunctionsSoon(); + page->setDebugger(0); } } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h index a45fae4..dcf290e 100644 --- a/WebCore/bindings/js/ScriptDebugServer.h +++ b/WebCore/bindings/js/ScriptDebugServer.h @@ -101,7 +101,6 @@ private: ~ScriptDebugServer(); bool hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const; - bool hasListeners() const { return !m_pageListenersMap.isEmpty(); } bool hasListenersInterestedInPage(Page*); void setJavaScriptPaused(const PageGroup&, bool paused); @@ -131,7 +130,6 @@ private: void didAddListener(Page*); void didRemoveListener(Page*); - void didRemoveLastListener(); typedef HashMap<Page*, ListenerSet*> PageListenersMap; typedef HashMap<intptr_t, SourceBreakpoints> BreakpointsMap; @@ -141,6 +139,7 @@ private: PauseOnExceptionsState m_pauseOnExceptionsState; bool m_pauseOnNextStatement; bool m_paused; + Page* m_pausedPage; bool m_doneProcessingDebuggerEvents; bool m_breakpointsActivated; JavaScriptCallFrame* m_pauseOnCallFrame; diff --git a/WebCore/bindings/js/ScriptProfiler.h b/WebCore/bindings/js/ScriptProfiler.h index a86bcfb..16195a3 100644 --- a/WebCore/bindings/js/ScriptProfiler.h +++ b/WebCore/bindings/js/ScriptProfiler.h @@ -39,6 +39,7 @@ class ScriptProfiler : public Noncopyable { public: static void start(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); + static void takeHeapSnapshot() { } }; } // namespace WebCore diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index 7c0f427..fbcee02 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -381,5 +381,86 @@ sub LinkOverloadedFunctions } } +sub AttributeNameForGetterAndSetter +{ + my ($generator, $attribute) = @_; + + my $attributeName = $attribute->signature->name; + + # Avoid clash with C++ keyword. + $attributeName = "_operator" if $attributeName eq "operator"; + + # SVG animated types need to use a special attribute name. + # The rest of the special casing for SVG animated types is handled in the language-specific code generators. + $attributeName .= "Animated" if $generator->IsSVGAnimatedType($generator->StripModule($attribute->signature->type)); + + return $attributeName; +} + +sub ContentAttributeName +{ + my ($generator, $implIncludes, $interfaceName, $attribute) = @_; + + my $contentAttributeName = $attribute->signature->extendedAttributes->{"Reflect"} + || $attribute->signature->extendedAttributes->{"ReflectURL"}; + return undef if !$contentAttributeName; + + $contentAttributeName = lc $generator->AttributeNameForGetterAndSetter($attribute) if $contentAttributeName eq "1"; + + my $namespace = $generator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + + $implIncludes->{"${namespace}.h"} = 1; + return "WebCore::${namespace}::${contentAttributeName}Attr"; +} + +sub GetterExpressionPrefix +{ + my ($generator, $implIncludes, $interfaceName, $attribute) = @_; + + my $contentAttributeName = $generator->ContentAttributeName($implIncludes, $interfaceName, $attribute); + + if (!$contentAttributeName) { + return $generator->WK_lcfirst($generator->AttributeNameForGetterAndSetter($attribute)) . "("; + } + + my $functionName; + if ($attribute->signature->extendedAttributes->{"ReflectURL"}) { + $functionName = "getURLAttribute"; + } elsif ($attribute->signature->type eq "boolean") { + $functionName = "hasAttribute"; + } elsif ($attribute->signature->type eq "long") { + $functionName = "getIntegralAttribute"; + } elsif ($attribute->signature->type eq "unsigned long") { + $functionName = "getUnsignedIntegralAttribute"; + } else { + $functionName = "getAttribute"; + } + + return "$functionName($contentAttributeName" +} + +sub SetterExpressionPrefix +{ + my ($generator, $implIncludes, $interfaceName, $attribute) = @_; + + my $contentAttributeName = $generator->ContentAttributeName($implIncludes, $interfaceName, $attribute); + + if (!$contentAttributeName) { + return "set" . $generator->WK_ucfirst($generator->AttributeNameForGetterAndSetter($attribute)) . "("; + } + + my $functionName; + if ($attribute->signature->type eq "boolean") { + $functionName = "setBooleanAttribute"; + } elsif ($attribute->signature->type eq "long") { + $functionName = "setIntegralAttribute"; + } elsif ($attribute->signature->type eq "unsigned long") { + $functionName = "setUnsignedIntegralAttribute"; + } else { + $functionName = "setAttribute"; + } + + return "$functionName($contentAttributeName, " +} 1; diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm index f441b0e..7df91ca 100644 --- a/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -145,7 +145,6 @@ sub GetClassName # special cases return "WebDOMString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue"; - return "WebDOMAbstractView" if $name eq "DOMWindow"; return "WebDOMObject" if $name eq "DOMObject"; return "bool" if $name eq "boolean"; return $name if $codeGenerator->IsPrimitiveType($name); @@ -155,10 +154,7 @@ sub GetClassName sub GetImplClassName { - my $name = $codeGenerator->StripModule(shift); - - return "DOMWindow" if $name eq "AbstractView"; - return $name; + return $codeGenerator->StripModule(shift); } sub GetParentImplClassName @@ -203,7 +199,8 @@ sub ShouldSkipTypeInImplementation return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} or $typeInfo->signature->extendedAttributes->{"CustomGetter"} - or $typeInfo->signature->extendedAttributes->{"NeedsUserGestureCheck"}; + or $typeInfo->signature->extendedAttributes->{"NeedsUserGestureCheck"} + or $typeInfo->signature->extendedAttributes->{"CPPCustom"}; # FIXME: We don't generate bindings for SVG related interfaces yet return 1 if $typeInfo->signature->name =~ /getSVGDocument/; @@ -297,12 +294,6 @@ sub AddIncludesForType return; } - if ($type eq "DOMWindow") { - $implIncludes{"DOMWindow.h"} = 1; - $implIncludes{"WebDOMAbstractView.h"} = 1; - return; - } - if ($type eq "EventListener") { $implIncludes{"WebNativeEventListener.h"} = 1; return; @@ -388,12 +379,12 @@ sub GenerateHeader push(@headerContent, " explicit $className($implClassNameWithNamespace*);\n"); # Copy constructor on classes which have the d-ptr - if (@{$dataNode->parents} eq 0) { + if ($parentName eq "WebDOMObject") { push(@headerContent, " $className(const $className&);\n"); } # Destructor - if (@{$dataNode->parents} eq 0) { + if ($parentName eq "WebDOMObject") { push(@headerContent, " ~$className();\n"); } @@ -505,7 +496,7 @@ sub GenerateHeader push(@headerContent, "\n"); push(@headerContent, " $implClassNameWithNamespace* impl() const;\n"); - if (@{$dataNode->parents} eq 0) { + if ($parentName eq "WebDOMObject") { push(@headerContent, "\nprotected:\n"); push(@headerContent, " struct ${className}Private;\n"); push(@headerContent, " ${className}Private* m_impl;\n"); @@ -607,7 +598,7 @@ sub GenerateImplementation push(@implContent, "#include <wtf/RefPtr.h>\n\n"); # Private datastructure, encapsulating WebCore types - if (@{$dataNode->parents} eq 0) { + if ($baseClass eq "WebDOMObject") { push(@implContent, "struct ${className}::${className}Private {\n"); push(@implContent, " ${className}Private($implClassNameWithNamespace* object = 0)\n"); push(@implContent, " : impl(object)\n"); @@ -620,12 +611,12 @@ sub GenerateImplementation # Constructor push(@implContent, "${className}::$className()\n"); push(@implContent, " : ${baseClass}()\n"); - push(@implContent, " , m_impl(0)\n") if (@{$dataNode->parents} eq 0); + push(@implContent, " , m_impl(0)\n") if ($baseClass eq "WebDOMObject"); push(@implContent, "{\n"); push(@implContent, "}\n\n"); push(@implContent, "${className}::$className($implClassNameWithNamespace* impl)\n"); - if (@{$dataNode->parents} eq 0) { + if ($baseClass eq "WebDOMObject") { push(@implContent, " : ${baseClass}()\n"); push(@implContent, " , m_impl(new ${className}Private(impl))\n"); push(@implContent, "{\n"); @@ -679,18 +670,7 @@ sub GenerateImplementation # - GETTER my $getterSig = "$attributeType $className\:\:$attributeName() const\n"; my $hasGetterException = @{$attribute->getterExceptions}; - my $getterContentHead; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $getterContentHead = "impl()->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; - } else { - $getterContentHead = "impl()->" . $codeGenerator->WK_lcfirst($attributeName) . "("; - } + my $getterContentHead = "impl()->" . $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); my $getterContentTail = ")"; # Special cases @@ -698,8 +678,6 @@ sub GenerateImplementation if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { $getterContentHead = "WebCore::String::number(" . $getterContentHead; $getterContentTail .= ")"; - } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $getterContentTail .= ".toInt()"; } elsif ($attribute->signature->type eq "SerializedScriptValue") { $getterContentHead = "$getterContentHead"; $getterContentTail .= "->toString()"; @@ -750,10 +728,8 @@ sub GenerateImplementation my $argName = "new" . ucfirst($attributeName); my $arg = GetCPPTypeGetter($argName, $idlType); - # The definition of ConvertFromString and ConvertToString is flipped for the setter - if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $arg = "WebCore::String::number($arg)"; - } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + # The definition of ConvertToString is flipped for the setter + if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { $arg = "WebCore::String($arg).toInt()"; } @@ -762,18 +738,10 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, AddEarlyReturnStatement()); - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; push(@implContent, " $exceptionInit\n") if $hasSetterException; my $ec = $hasSetterException ? ", ec" : ""; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - push(@implContent, " impl()->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, $arg$ec);\n"); - } else { - push(@implContent, " impl()->$coreSetterName($arg$ec);\n"); - } + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + push(@implContent, " impl()->$setterExpressionPrefix$arg$ec);\n"); push(@implContent, " $exceptionRaiseOnError\n") if $hasSetterException; push(@implContent, "}\n\n"); } diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index e98c661..ef2a125 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -301,11 +301,29 @@ sub GetWriteableProperties { return @result; } +sub GenerateConditionalString +{ + my $node = shift; + my $conditional = $node->extendedAttributes->{"Conditional"}; + if ($conditional) { + if ($conditional =~ /&/) { + return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + } elsif ($conditional =~ /\|/) { + return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")"; + } else { + return "ENABLE(" . $conditional . ")"; + } + } else { + return ""; + } +} + sub GenerateProperty { my $attribute = shift; my $interfaceName = shift; my @writeableProperties = @{shift @_}; + my $conditionalString = GenerateConditionalString($attribute->signature); my $camelPropName = $attribute->signature->name; my $setPropNameFunction = $codeGenerator->WK_ucfirst($camelPropName); my $getPropNameFunction = $codeGenerator->WK_lcfirst($camelPropName); @@ -314,7 +332,9 @@ sub GenerateProperty { my $propNameCaps = uc($propName); $propName =~ s/_/-/g; my ${propEnum} = "PROP_${propNameCaps}"; + push(@cBodyPriv, "#if ${conditionalString}\n") if $conditionalString; push(@cBodyPriv, " ${propEnum},\n"); + push(@cBodyPriv, "#endif /* ${conditionalString} */\n") if $conditionalString; my $propType = $attribute->signature->type; my ${propGType} = decamelize($propType); @@ -341,35 +361,26 @@ sub GenerateProperty { my $convertFunction = ""; if ($gtype eq "string") { $convertFunction = "WebCore::String::fromUTF8"; - } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $convertFunction = "WebCore::String::number"; } - my $setterContentHead; - my $getterContentHead; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $camelPropName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $setterContentHead = "coreSelf->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, ${convertFunction}(g_value_get_$gtype(value))"; - $getterContentHead = "coreSelf->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; - } else { - $setterContentHead = "coreSelf->set${setPropNameFunction}(${convertFunction}(g_value_get_$gtype(value))"; - $getterContentHead = "coreSelf->${getPropNameFunction}("; - } + my $getterExpressionPrefix = $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + + my $getterContentHead = "coreSelf->$getterExpressionPrefix"; + my $setterContentHead = "coreSelf->$setterExpressionPrefix${convertFunction}(g_value_get_$gtype(value))"; if (grep {$_ eq $attribute} @writeableProperties) { + push(@txtSetProps, "#if ${conditionalString}\n") if $conditionalString; push(@txtSetProps, " case ${propEnum}:\n {\n"); push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; push(@txtSetProps, " ${setterContentHead}"); push(@txtSetProps, ", ec") if @{$attribute->setterExceptions}; push(@txtSetProps, ");\n"); push(@txtSetProps, " break;\n }\n"); + push(@txtSetProps, "#endif /* ${conditionalString} */\n") if $conditionalString; } + push(@txtGetProps, "#if ${conditionalString}\n") if $conditionalString; push(@txtGetProps, " case ${propEnum}:\n {\n"); my $exception = ""; @@ -392,17 +403,6 @@ EOF $done = 1; } - if($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - # TODO: Add other conversion functions for different types. Current - # IDLs only list longs. - if($gtype eq "long") { - $convertFunction = ""; - $postConvertFunction = ".toInt()"; - } else { - die "Can't convert to type ${gtype}."; - } - } - # FIXME: get rid of this glitch? my $_gtype = $gtype; if ($gtype eq "ushort") { @@ -410,10 +410,11 @@ EOF } if (!$done) { - push(@txtGetProps, " g_value_set_$_gtype(value, ${convertFunction}coreSelf->${getPropNameFunction}(${exception})${postConvertFunction});\n"); + push(@txtGetProps, " g_value_set_$_gtype(value, ${convertFunction}coreSelf->${getterExpressionPrefix}${exception})${postConvertFunction});\n"); } push(@txtGetProps, " break;\n }\n"); + push(@txtGetProps, "#endif /* ${conditionalString} */\n") if $conditionalString; my %param_spec_options = ("int", "G_MININT, /* min */\nG_MAXINT, /* max */\n0, /* default */", "boolean", "FALSE, /* default */", @@ -439,7 +440,9 @@ EOF $param_spec_options{$gtype} ${gparamflag})); EOF + push(@txtInstallProps, "#if ${conditionalString}\n") if $conditionalString; push(@txtInstallProps, $txtInstallProp); + push(@txtInstallProps, "#endif /* ${conditionalString} */\n") if $conditionalString; } my %breakWords = ("before" => 1, "can" => 1, "context" => 1, "dbl" => 1, "drag" => 1, @@ -755,10 +758,11 @@ sub GenerateFunction { } my $functionSigName = $function->signature->name; - my $functionSigType = $function->signature->type; + my $functionSigType = $prefix eq "set_" ? "void" : $function->signature->type; my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . decamelize($functionSigName); my $returnType = GetGlibTypeName($functionSigType); my $returnValueIsGDOMType = IsGDOMClassType($functionSigType); + my $conditionalString = GenerateConditionalString($function->signature); my $functionSig = "${className}* self"; @@ -788,7 +792,7 @@ sub GenerateFunction { } } if ($paramIsGDOMType || ($paramIDLType eq "DOMString") || ($paramIDLType eq "CompareHow")) { - $paramName = "_g_" . $paramName; + $paramName = "converted_" . $paramName; } if ($callImplParams) { $callImplParams .= ", $paramName"; @@ -812,7 +816,12 @@ sub GenerateFunction { $functionSig .= ", GError **error"; } - push(@hBody, "WEBKIT_API $returnType\n$functionName($functionSig);\n\n"); + push(@hBody, "#if ${conditionalString}\n") if $conditionalString; + push(@hBody, "WEBKIT_API $returnType\n$functionName($functionSig);\n"); + push(@hBody, "#endif /* ${conditionalString} */\n") if $conditionalString; + push(@hBody, "\n"); + + push(@cBody, "#if ${conditionalString}\n") if $conditionalString; push(@cBody, "$returnType\n$functionName($functionSig)\n{\n"); if ($conditionalMethods{$functionName}) { @@ -821,9 +830,9 @@ sub GenerateFunction { if ($returnType ne "void") { # TODO: return proper default result - push(@cBody, " g_return_val_if_fail (self, 0);\n"); + push(@cBody, " g_return_val_if_fail(self, 0);\n"); } else { - push(@cBody, " g_return_if_fail (self);\n"); + push(@cBody, " g_return_if_fail(self);\n"); } # The WebKit::core implementations check for NULL already; no need to @@ -838,9 +847,9 @@ sub GenerateFunction { if (!$paramTypeIsPrimitive) { if ($returnType ne "void") { # TODO: return proper default result - push(@cBody, " g_return_val_if_fail ($paramName, 0);\n"); + push(@cBody, " g_return_val_if_fail($paramName, 0);\n"); } else { - push(@cBody, " g_return_if_fail ($paramName);\n"); + push(@cBody, " g_return_if_fail($paramName);\n"); } } } @@ -852,19 +861,19 @@ sub GenerateFunction { my $paramIsGDOMType = IsGDOMClassType($paramIDLType); if ($paramIDLType eq "DOMString") { - push(@cBody, " WebCore::String _g_${paramName} = WebCore::String::fromUTF8($paramName);\n"); + push(@cBody, " WebCore::String converted_${paramName} = WebCore::String::fromUTF8($paramName);\n"); } elsif ($paramIDLType eq "CompareHow") { - push(@cBody, " WebCore::Range::CompareHow _g_${paramName} = static_cast<WebCore::Range::CompareHow>($paramName);\n"); + push(@cBody, " WebCore::Range::CompareHow converted_${paramName} = static_cast<WebCore::Range::CompareHow>($paramName);\n"); } elsif ($paramIsGDOMType) { - push(@cBody, " WebCore::${paramIDLType} * _g_${paramName} = WebKit::core($paramName);\n"); + push(@cBody, " WebCore::${paramIDLType} * converted_${paramName} = WebKit::core($paramName);\n"); if ($returnType ne "void") { # TODO: return proper default result - push(@cBody, " g_return_val_if_fail (_g_${paramName}, 0);\n"); + push(@cBody, " g_return_val_if_fail(converted_${paramName}, 0);\n"); } else { - push(@cBody, " g_return_if_fail (_g_${paramName});\n"); + push(@cBody, " g_return_if_fail(converted_${paramName});\n"); } } - $returnParamName = "_g_".$paramName if $param->extendedAttributes->{"Return"}; + $returnParamName = "converted_".$paramName if $param->extendedAttributes->{"Return"}; } my $assign = ""; @@ -923,35 +932,25 @@ EOF return; } elsif ($functionSigType eq "DOMString") { my $getterContentHead; - my $reflect = $function->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $function->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $functionSigName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $getterContentHead = "${assign}convertToUTF8String(item->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr));\n"; + if ($prefix) { + my $getterExpressionPrefix = $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $function); + $getterContentHead = "${assign}convertToUTF8String(item->$getterExpressionPrefix${exceptions}));\n"; } else { $getterContentHead = "${assign}convertToUTF8String(item->${functionSigName}(${callImplParams}${exceptions}));\n"; } - push(@cBody, " ${getterContentHead}"); } else { - my $setterContentHead; - my $reflect = $function->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $function->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $functionSigName : ($reflect || $reflectURL); - $contentAttributeName =~ s/set//; - $contentAttributeName = $codeGenerator->WK_lcfirst($contentAttributeName); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - $setterContentHead = "${assign}${assignPre}item->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, ${callImplParams}${exceptions}${assignPost});\n"; + my $contentHead; + if ($prefix eq "get_") { + my $getterExpressionPrefix = $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $function); + $contentHead = "${assign}${assignPre}item->$getterExpressionPrefix${callImplParams}${exceptions}${assignPost});\n"; + } elsif ($prefix eq "set_") { + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $function); + $contentHead = "${assign}${assignPre}item->$setterExpressionPrefix${callImplParams}${exceptions}${assignPost});\n"; } else { - $setterContentHead = "${assign}${assignPre}item->${functionSigName}(${callImplParams}${exceptions}${assignPost});\n"; + $contentHead = "${assign}${assignPre}item->${functionSigName}(${callImplParams}${exceptions}${assignPost});\n"; } - - push(@cBody, " ${setterContentHead}"); + push(@cBody, " ${contentHead}"); if(@{$function->raisesExceptions}) { my $exceptionHandling = << "EOF"; @@ -982,7 +981,9 @@ EOF push(@cBody, "#endif\n"); } - push(@cBody, "}\n\n"); + push(@cBody, "}\n"); + push(@cBody, "#endif /* ${conditionalString} */\n") if $conditionalString; + push(@cBody, "\n"); } sub ClassHasFunction { @@ -1014,7 +1015,6 @@ sub GenerateFunctions { # This will conflict with the get_type() function we define to return a GType # according to GObject conventions. Skip this for now. || $attribute->signature->name eq "URL" # TODO: handle this - || $attribute->signature->extendedAttributes->{"ConvertFromString"} # TODO: handle this ) { next TOP; } @@ -1044,8 +1044,8 @@ sub GenerateFunctions { $function = new domFunction(); $function->signature(new domSignature()); - $function->signature->name($setname); - $function->signature->type("void"); + $function->signature->name($attribute->signature->name); + $function->signature->type($attribute->signature->type); $function->signature->extendedAttributes($attribute->signature->extendedAttributes); my $param = new domSignature(); @@ -1058,7 +1058,7 @@ sub GenerateFunctions { $function->raisesExceptions($attribute->setterExceptions); - $object->GenerateFunction($interfaceName, $function, ""); + $object->GenerateFunction($interfaceName, $function, "set_"); } } @@ -1128,7 +1128,7 @@ sub GenerateEndHeader { my $guard = $className . "_h"; push(@hBody, "G_END_DECLS\n\n"); - push(@hBody, "#endif /* $guard */\n"); + push(@hPrefixGuardEnd, "#endif /* $guard */\n"); } sub GeneratePrivateHeader { @@ -1189,7 +1189,7 @@ EOF #endif /* ${guard} */ EOF print PRIVHEADER $text; - + close(PRIVHEADER); } @@ -1248,6 +1248,11 @@ sub Generate { my $parentGObjType = GetParentGObjType($dataNode); my $interfaceName = $dataNode->name; + # Add the guard if the 'Conditional' extended attribute exists + my $conditionalString = GenerateConditionalString($dataNode); + push(@conditionGuardStart, "#if ${conditionalString}\n\n") if $conditionalString; + push(@conditionGuardEnd, "#endif /* ${conditionalString} */\n") if $conditionalString; + # Add the default impl header template @cPrefix = split("\r", $licenceTemplate); push(@cPrefix, "\n"); @@ -1308,6 +1313,7 @@ sub WriteData { print HEADER "\n"; print HEADER @hBodyPre; print HEADER @hBody; + print HEADER @hPrefixGuardEnd; close(HEADER); @@ -1318,6 +1324,7 @@ sub WriteData { print IMPL @cPrefix; print IMPL "#include <glib-object.h>\n"; print IMPL "#include \"config.h\"\n\n"; + print IMPL @conditionGuardStart; print IMPL "#include <wtf/GetPtr.h>\n"; print IMPL "#include <wtf/RefPtr.h>\n"; print IMPL map { "#include \"$_\"\n" } sort keys(%implIncludes); @@ -1326,6 +1333,7 @@ sub WriteData { print IMPL "\n"; print IMPL @cBodyPriv; + print IMPL @conditionGuardEnd; close(IMPL); diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index c3521bf..4e2e911 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -3,7 +3,7 @@ # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> -# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> # Copyright (C) Research In Motion Limited 2010. All rights reserved. # @@ -1170,7 +1170,7 @@ END push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n"); } push(@implContent, <<END); - return JSValue::encode(throwTypeError(exec)); + return throwVMTypeError(exec); } END @@ -1570,20 +1570,9 @@ sub GenerateImplementation push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName()", "castedThis") . ";\n"); } } else { + my $getterExpression = "imp->" . $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute) . ")"; + my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, $getterExpression, "castedThis"); push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n"); - my $value; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $name : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $value = "imp->$getAttributeFunctionName(${namespace}::${contentAttributeName}Attr)" - } else { - $value = "imp->$implGetterFunctionName()"; - } - my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, $value, "castedThis"); if ($codeGenerator->IsSVGAnimatedType($type)) { push(@implContent, " RefPtr<$type> obj = $jsType;\n"); push(@implContent, " JSValue result = toJS(exec, castedThis->globalObject(), obj.get(), imp);\n"); @@ -1734,17 +1723,10 @@ sub GenerateImplementation push(@implContent, " imp->commitChange(podImp, castedThis);\n"); } else { my $nativeValue = JSValueToNative($attribute->signature, "value"); + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + push(@implContent, " ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $name : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - push(@implContent, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, $nativeValue"); - } else { - push(@implContent, " imp->set$implSetterFunctionName($nativeValue"); - } + push(@implContent, " imp->$setterExpressionPrefix$nativeValue"); push(@implContent, ", ec") if @{$attribute->setterExceptions}; push(@implContent, ");\n"); push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions}; @@ -2330,7 +2312,7 @@ sub JSValueToNative return "static_cast<SVGPaint::SVGPaintType>($value.toInt32(exec))" if $type eq "SVGPaintType"; if ($type eq "DOMString") { - return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"}; + return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"} || $signature->extendedAttributes->{"ReflectURL"}; return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}; return "ustringToString($value.toString(exec))"; } @@ -2424,13 +2406,6 @@ sub NativeToJSValue } } - if ($codeGenerator->IsSVGAnimatedType($type)) { - # Some SVGFE*Element.idl use 'operator' as attribute name, rewrite as '_operator' to avoid clashes with C/C++ - $value =~ s/operator\(\)/_operator\(\)/ if ($value =~ /operator/); - $value =~ s/\(\)//; - $value .= "Animated()"; - } - if ($type eq "CSSStyleDeclaration") { $implIncludes{"CSSMutableStyleDeclaration.h"} = 1; } @@ -2766,6 +2741,7 @@ sub GenerateConstructorDefinition my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; my $customConstructFunction = $dataNode->extendedAttributes->{"CustomConstructFunction"}; my $callWith = $dataNode->extendedAttributes->{"CallWith"}; + my $numberOfconstructParameters = $dataNode->extendedAttributes->{"ConstructorParameters"}; push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", 0, &${constructorClassName}Table, 0 };\n\n"); @@ -2773,6 +2749,7 @@ sub GenerateConstructorDefinition push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n"); push(@$outputArray, "{\n"); push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n"); + push(@$outputArray, " putDirect(exec->propertyNames().length, jsNumber(exec, ${numberOfconstructParameters}), ReadOnly | DontDelete | DontEnum);\n") if $numberOfconstructParameters; push(@$outputArray, "}\n\n"); push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index daead72..7d66979 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -3,7 +3,7 @@ # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> -# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> # Copyright (C) 2010 Google Inc. # @@ -793,6 +793,12 @@ sub GenerateHeader push(@headerAttributes, $property) if $public; push(@privateHeaderAttributes, $property) unless $public; } else { + my $attributeConditionalString = GenerateConditionalString($attribute->signature); + if ($attributeConditionalString) { + push(@headerAttributes, "#if ${attributeConditionalString}\n") if $public; + push(@privateHeaderAttributes, "#if ${attributeConditionalString}\n") unless $public; + } + # - GETTER my $getter = "- (" . $attributeType . ")" . $attributeName . $declarationSuffix; push(@headerAttributes, $getter) if $public; @@ -804,6 +810,11 @@ sub GenerateHeader push(@headerAttributes, $setter) if $public; push(@privateHeaderAttributes, $setter) unless $public; } + + if ($attributeConditionalString) { + push(@headerAttributes, "#endif\n") if $public; + push(@privateHeaderAttributes, "#endif\n") unless $public; + } } } @@ -1164,13 +1175,9 @@ sub GenerateImplementation } elsif ($attributeName eq "frame") { # Special case attribute frame to be frameBorders. $attributeInterfaceName .= "Borders"; - } elsif ($attributeName eq "ownerDocument") { - # FIXME: for now special case attribute ownerDocument to call document, this is incorrect - # legacy behavior. (see http://bugs.webkit.org/show_bug.cgi?id=10889) - $attributeName = "document"; - } elsif ($codeGenerator->IsSVGAnimatedType($idlType)) { - # Special case for animated types. - $attributeName .= "Animated"; + } elsif ($attributeName eq "operator") { + # Avoid clash with C++ keyword. + $attributeInterfaceName = "_operator"; } $attributeNames{$attributeInterfaceName} = 1; @@ -1178,23 +1185,14 @@ sub GenerateImplementation # - GETTER my $getterSig = "- ($attributeType)$attributeInterfaceName\n"; - # Some SVGFE*Element.idl use 'operator' as attribute name, rewrite as '_operator' to avoid clashes with C/C++ - $attributeName =~ s/operatorAnimated/_operatorAnimated/ if ($attributeName =~ /operatorAnimated/); - $getterSig =~ s/operator/_operator/ if ($getterSig =~ /operator/); + my $getterExpressionPrefix = $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + + # FIXME: Special case attribute ownerDocument to call document. This makes it return the + # document when called on the document itself. Legacy behavior, see <https://bugs.webkit.org/show_bug.cgi?id=10889>. + $getterExpressionPrefix =~ s/\bownerDocument\b/document/; my $hasGetterException = @{$attribute->getterExceptions}; - my $getterContentHead; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $getterContentHead = "IMPL->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; - } else { - $getterContentHead = "IMPL->" . $codeGenerator->WK_lcfirst($attributeName) . "("; - } + my $getterContentHead = "IMPL->$getterExpressionPrefix"; my $getterContentTail = ")"; # Special case for DOMSVGNumber @@ -1245,8 +1243,6 @@ sub GenerateImplementation } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) { $getterContentHead = "WebCore::String::number(" . $getterContentHead; $getterContentTail .= ")"; - } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $getterContentTail .= ".toInt()"; } elsif ($codeGenerator->IsPodType($idlType) or $idlType eq "Date") { $getterContentHead = "kit($getterContentHead"; $getterContentTail .= ")"; @@ -1271,6 +1267,8 @@ sub GenerateImplementation $getterContent = $getterContentHead . $getterContentTail; } + my $attributeConditionalString = GenerateConditionalString($attribute->signature); + push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString; push(@implContent, $getterSig); push(@implContent, "{\n"); push(@implContent, " $jsContextSetter\n"); @@ -1291,7 +1289,7 @@ sub GenerateImplementation } else { push(@implContent, " return $getterContent;\n"); } - push(@implContent, "}\n\n"); + push(@implContent, "}\n"); # - SETTER if (!$attributeIsReadonly) { @@ -1303,15 +1301,14 @@ sub GenerateImplementation my $argName = "new" . ucfirst($attributeInterfaceName); my $arg = GetObjCTypeGetter($argName, $idlType); - # The definition of ConvertFromString and ConvertToString is flipped for the setter - if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $arg = "WebCore::String::number($arg)"; - } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + # The definition of ConvertToString is flipped for the setter + if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { $arg = "WebCore::String($arg).toInt()"; } my $setterSig = "- (void)$setterName:($attributeType)$argName\n"; + push(@implContent, "\n"); push(@implContent, $setterSig); push(@implContent, "{\n"); push(@implContent, " $jsContextSetter\n"); @@ -1332,23 +1329,18 @@ sub GenerateImplementation push(@implContent, " IMPL->$coreSetterName($arg);\n"); } } else { - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - push(@implContent, " $exceptionInit\n") if $hasSetterException; + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); my $ec = $hasSetterException ? ", ec" : ""; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - push(@implContent, " IMPL->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, $arg$ec);\n"); - } else { - push(@implContent, " IMPL->$coreSetterName($arg$ec);\n"); - } + push(@implContent, " $exceptionInit\n") if $hasSetterException; + push(@implContent, " IMPL->$setterExpressionPrefix$arg$ec);\n"); push(@implContent, " $exceptionRaiseOnError\n") if $hasSetterException; } - push(@implContent, "}\n\n"); + push(@implContent, "}\n"); } + + push(@implContent, "#endif\n") if $attributeConditionalString; + push(@implContent, "\n"); } } diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index e471500..e249caa 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -677,7 +677,7 @@ END my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; if ($getterStringUsesImp && $reflect && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) { # Generate super-compact call for regular attribute getter: - my $contentAttributeName = $reflect eq "1" ? $attrName : $reflect; + my $contentAttributeName = $reflect eq "1" ? lc $attrName : $reflect; my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); $implIncludes{"${namespace}.h"} = 1; push(@implContentDecls, " return getElementStringAttr(info, ${namespace}::${contentAttributeName}Attr);\n"); @@ -708,34 +708,13 @@ END $attrName = $attribute->signature->extendedAttributes->{"v8referenceattr"}; } - my $getterFunc = $codeGenerator->WK_lcfirst($attrName); - - if ($codeGenerator->IsSVGAnimatedType($attribute->signature->type)) { - # Some SVGFE*Element.idl use 'operator' as attribute name; rewrite as '_operator' to avoid clashes with C/C++ - $getterFunc = "_" . $getterFunc if ($attrName =~ /operator/); - $getterFunc .= "Animated"; - } - my $returnType = GetTypeFromSignature($attribute->signature); my $getterString; if ($getterStringUsesImp) { - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? $attrName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $getterString = "imp->$getAttributeFunctionName(${namespace}::${contentAttributeName}Attr"; - } else { - $getterString = "imp->$getterFunc("; - } + $getterString = "imp->" . $codeGenerator->GetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); $getterString .= "ec" if $useExceptions; $getterString .= ")"; - if ($nativeType eq "int" and $attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $getterString .= ".toInt()"; - } } else { $getterString = "impInstance"; } @@ -887,7 +866,7 @@ END my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; if (($reflect || $reflectURL) && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) { # Generate super-compact call for regular attribute setter: - my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? $attrName : ($reflect || $reflectURL); + my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? lc $attrName : ($reflect || $reflectURL); my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); $implIncludes{"${namespace}.h"} = 1; push(@implContentDecls, " setElementStringAttr(info, ${namespace}::${contentAttributeName}Attr, value);\n"); @@ -912,14 +891,7 @@ END push(@implContentDecls, " $nativeType v = " . JSValueToNative($attribute->signature, "value") . ";\n"); } - my $result = ""; - if ($nativeType eq "int" and $attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $result .= "WebCore::String::number("; - } - $result .= "v"; - if ($nativeType eq "int" and $attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $result .= ")"; - } + my $result = "v"; my $returnType = GetTypeFromSignature($attribute->signature); if (IsRefPtrType($returnType)) { $result = "WTF::getPtr(" . $result . ")"; @@ -935,15 +907,8 @@ END if ($implClassName eq "float") { push(@implContentDecls, " *imp = $result;\n"); } else { - my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName); - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? $attrName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, $result"); - } elsif ($attribute->signature->type eq "EventListener") { + if ($attribute->signature->type eq "EventListener") { + my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName); $implIncludes{"V8AbstractEventListener.h"} = 1; push(@implContentDecls, " transferHiddenDependency(info.Holder(), imp->$attrName(), value, V8${interfaceName}::eventListenerCacheIndex);\n"); if ($interfaceName eq "WorkerContext" and $attribute->signature->name eq "onerror") { @@ -954,7 +919,8 @@ END push(@implContentDecls, " imp->set$implSetterFunctionName(V8DOMWrapper::getEventListener(value, true, ListenerFindOrCreate)"); } } else { - push(@implContentDecls, " imp->set$implSetterFunctionName($result"); + my $setterExpressionPrefix = $codeGenerator->SetterExpressionPrefix(\%implIncludes, $interfaceName, $attribute); + push(@implContentDecls, " imp->$setterExpressionPrefix$result"); } push(@implContentDecls, ", ec") if $useExceptions; push(@implContentDecls, ");\n"); @@ -1104,7 +1070,7 @@ END push(@implContentDecls, " return ${name}$overload->{overloadIndex}Callback(args);\n"); } push(@implContentDecls, <<END); - V8Proxy::setDOMException(SYNTAX_ERR); + V8Proxy::throwTypeError(); return notHandledByInterceptor(); END push(@implContentDecls, "}\n\n"); @@ -1283,9 +1249,9 @@ sub GenerateBatchedAttributeData foreach my $attribute (@$attributes) { my $conditionalString = GenerateConditionalString($attribute->signature); - push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; + push(@implContent, "#if ${conditionalString}\n") if $conditionalString; GenerateSingleBatchedAttribute($interfaceName, $attribute, ",", ""); - push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; + push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString; } } @@ -2712,7 +2678,7 @@ sub GetNativeTypeFromSignature my $mode = ""; if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) { $mode = "WithUndefinedOrNullCheck"; - } elsif ($signature->extendedAttributes->{"ConvertNullToNullString"}) { + } elsif ($signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"} || $signature->extendedAttributes->{"ReflectURL"}) { $mode = "WithNullCheck"; } $type .= "<$mode>"; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp index 0b20841..0436e13 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -19,6 +19,9 @@ */ #include "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + #include "WebDOMTestInterface.h" #include "TestInterface.h" @@ -73,3 +76,5 @@ WebDOMTestInterface toWebKit(WebCore::TestInterface* value) { return WebDOMTestInterface(value); } + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h index d0cee5b..4e7af6d 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -23,6 +23,8 @@ #ifndef WebDOMTestInterface_h #define WebDOMTestInterface_h +#if ENABLE(Condition1) || ENABLE(Condition2) + #include <WebDOMObject.h> #include <WebDOMString.h> @@ -50,3 +52,5 @@ WebCore::TestInterface* toWebCore(const WebDOMTestInterface&); WebDOMTestInterface toWebKit(WebCore::TestInterface*); #endif +#endif // ENABLE(Condition1) || ENABLE(Condition2) + diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index e540a57..65bc9f3 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -22,6 +22,7 @@ #include "WebDOMTestObj.h" #include "AtomicString.h" +#include "HTMLNames.h" #include "KURL.h" #include "SerializedScriptValue.h" #include "TestObj.h" @@ -173,33 +174,163 @@ void WebDOMTestObj::setTestObjAttr(const WebDOMTestObj& newTestObjAttr) impl()->setTestObjAttr(toWebCore(newTestObjAttr)); } -int WebDOMTestObj::attrWithException() const +WebDOMString WebDOMTestObj::reflectedStringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); +} + +void WebDOMTestObj::setReflectedStringAttr(const WebDOMString& newReflectedStringAttr) +{ + if (!impl()) + return; + + impl()->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, newReflectedStringAttr); +} + +int WebDOMTestObj::reflectedIntegralAttr() const { if (!impl()) return 0; - return impl()->attrWithException(); + return impl()->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr); } -void WebDOMTestObj::setAttrWithException(int newAttrWithException) +void WebDOMTestObj::setReflectedIntegralAttr(int newReflectedIntegralAttr) { if (!impl()) return; - impl()->setAttrWithException(newAttrWithException); + impl()->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, newReflectedIntegralAttr); } -int WebDOMTestObj::attrWithSetterException() const +bool WebDOMTestObj::reflectedBooleanAttr() const +{ + if (!impl()) + return false; + + return impl()->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr); +} + +void WebDOMTestObj::setReflectedBooleanAttr(bool newReflectedBooleanAttr) +{ + if (!impl()) + return; + + impl()->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, newReflectedBooleanAttr); +} + +WebDOMString WebDOMTestObj::reflectedURLAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); +} + +void WebDOMTestObj::setReflectedURLAttr(const WebDOMString& newReflectedURLAttr) +{ + if (!impl()) + return; + + impl()->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, newReflectedURLAttr); +} + +WebDOMString WebDOMTestObj::reflectedStringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); +} + +void WebDOMTestObj::setReflectedStringAttr(const WebDOMString& newReflectedStringAttr) +{ + if (!impl()) + return; + + impl()->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, newReflectedStringAttr); +} + +int WebDOMTestObj::reflectedCustomIntegralAttr() const +{ + if (!impl()) + return 0; + + return impl()->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr); +} + +void WebDOMTestObj::setReflectedCustomIntegralAttr(int newReflectedCustomIntegralAttr) +{ + if (!impl()) + return; + + impl()->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, newReflectedCustomIntegralAttr); +} + +bool WebDOMTestObj::reflectedCustomBooleanAttr() const +{ + if (!impl()) + return false; + + return impl()->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr); +} + +void WebDOMTestObj::setReflectedCustomBooleanAttr(bool newReflectedCustomBooleanAttr) +{ + if (!impl()) + return; + + impl()->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, newReflectedCustomBooleanAttr); +} + +WebDOMString WebDOMTestObj::reflectedURLAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); +} + +void WebDOMTestObj::setReflectedURLAttr(const WebDOMString& newReflectedURLAttr) +{ + if (!impl()) + return; + + impl()->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedURLAttr); +} + +int WebDOMTestObj::attrWithGetterException() const { if (!impl()) return 0; WebCore::ExceptionCode ec = 0; - int result = impl()->attrWithSetterException(ec); + int result = impl()->attrWithGetterException(ec); webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); return result; } +void WebDOMTestObj::setAttrWithGetterException(int newAttrWithGetterException) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setAttrWithGetterException(newAttrWithGetterException, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +int WebDOMTestObj::attrWithSetterException() const +{ + if (!impl()) + return 0; + + return impl()->attrWithSetterException(); +} + void WebDOMTestObj::setAttrWithSetterException(int newAttrWithSetterException) { if (!impl()) @@ -210,21 +341,42 @@ void WebDOMTestObj::setAttrWithSetterException(int newAttrWithSetterException) webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); } -int WebDOMTestObj::attrWithGetterException() const +WebDOMString WebDOMTestObj::stringAttrWithGetterException() const { if (!impl()) - return 0; + return WebDOMString(); - return impl()->attrWithGetterException(); + WebCore::ExceptionCode ec = 0; + WebDOMString result = impl()->stringAttrWithGetterException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return static_cast<const WebCore::String&>(result); } -void WebDOMTestObj::setAttrWithGetterException(int newAttrWithGetterException) +void WebDOMTestObj::setStringAttrWithGetterException(const WebDOMString& newStringAttrWithGetterException) { if (!impl()) return; WebCore::ExceptionCode ec = 0; - impl()->setAttrWithGetterException(newAttrWithGetterException, ec); + impl()->setStringAttrWithGetterException(newStringAttrWithGetterException, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +WebDOMString WebDOMTestObj::stringAttrWithSetterException() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->stringAttrWithSetterException()); +} + +void WebDOMTestObj::setStringAttrWithSetterException(const WebDOMString& newStringAttrWithSetterException) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setStringAttrWithSetterException(newStringAttrWithSetterException, ec); webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); } @@ -236,6 +388,92 @@ WebDOMString WebDOMTestObj::scriptStringAttr() const return static_cast<const WebCore::String&>(impl()->scriptStringAttr()); } +#if ENABLE(Condition1) +int WebDOMTestObj::conditionalAttr1() const +{ + if (!impl()) + return 0; + + return impl()->conditionalAttr1(); +} + +void WebDOMTestObj::setConditionalAttr1(int newConditionalAttr1) +{ + if (!impl()) + return; + + impl()->setConditionalAttr1(newConditionalAttr1); +} + +#endif +#if ENABLE(Condition1) && ENABLE(Condition2) +int WebDOMTestObj::conditionalAttr2() const +{ + if (!impl()) + return 0; + + return impl()->conditionalAttr2(); +} + +void WebDOMTestObj::setConditionalAttr2(int newConditionalAttr2) +{ + if (!impl()) + return; + + impl()->setConditionalAttr2(newConditionalAttr2); +} + +#endif +#if ENABLE(Condition1) || ENABLE(Condition2) +int WebDOMTestObj::conditionalAttr3() const +{ + if (!impl()) + return 0; + + return impl()->conditionalAttr3(); +} + +void WebDOMTestObj::setConditionalAttr3(int newConditionalAttr3) +{ + if (!impl()) + return; + + impl()->setConditionalAttr3(newConditionalAttr3); +} + +#endif +int WebDOMTestObj::description() const +{ + if (!impl()) + return 0; + + return impl()->description(); +} + +int WebDOMTestObj::id() const +{ + if (!impl()) + return 0; + + return impl()->id(); +} + +void WebDOMTestObj::setId(int newId) +{ + if (!impl()) + return; + + impl()->setId(newId); +} + +WebDOMString WebDOMTestObj::hash() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->hash()); +} + void WebDOMTestObj::voidMethod() { if (!impl()) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index 7bcd988..33bc7fb 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -54,15 +54,43 @@ public: void setStringAttr(const WebDOMString&); WebDOMTestObj testObjAttr() const; void setTestObjAttr(const WebDOMTestObj&); - int attrWithException() const; - void setAttrWithException(int); - int attrWithSetterException() const; - void setAttrWithSetterException(int); + WebDOMString reflectedStringAttr() const; + void setReflectedStringAttr(const WebDOMString&); + int reflectedIntegralAttr() const; + void setReflectedIntegralAttr(int); + bool reflectedBooleanAttr() const; + void setReflectedBooleanAttr(bool); + WebDOMString reflectedURLAttr() const; + void setReflectedURLAttr(const WebDOMString&); + WebDOMString reflectedStringAttr() const; + void setReflectedStringAttr(const WebDOMString&); + int reflectedCustomIntegralAttr() const; + void setReflectedCustomIntegralAttr(int); + bool reflectedCustomBooleanAttr() const; + void setReflectedCustomBooleanAttr(bool); + WebDOMString reflectedURLAttr() const; + void setReflectedURLAttr(const WebDOMString&); int attrWithGetterException() const; void setAttrWithGetterException(int); + int attrWithSetterException() const; + void setAttrWithSetterException(int); + WebDOMString stringAttrWithGetterException() const; + void setStringAttrWithGetterException(const WebDOMString&); + WebDOMString stringAttrWithSetterException() const; + void setStringAttrWithSetterException(const WebDOMString&); int customAttr() const; void setCustomAttr(int); WebDOMString scriptStringAttr() const; + int conditionalAttr1() const; + void setConditionalAttr1(int); + int conditionalAttr2() const; + void setConditionalAttr2(int); + int conditionalAttr3() const; + void setConditionalAttr3(int); + int description() const; + int id() const; + void setId(int); + WebDOMString hash() const; void voidMethod(); void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index a67b6ac..94f4ca5 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -21,6 +21,8 @@ #include <glib-object.h> #include "config.h" +#if ENABLE(DATABASE) + #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> #include "ExceptionCode.h" @@ -55,38 +57,38 @@ gpointer kit(WebCore::TestCallback* obj) gboolean webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestCallback * item = WebKit::core(self); - g_return_val_if_fail (class1param, 0); - WebCore::Class1 * _g_class1param = WebKit::core(class1param); - g_return_val_if_fail (_g_class1param, 0); - gboolean res = item->callbackWithClass1Param(_g_class1param); + g_return_val_if_fail(class1param, 0); + WebCore::Class1 * converted_class1param = WebKit::core(class1param); + g_return_val_if_fail(converted_class1param, 0); + gboolean res = item->callbackWithClass1Param(converted_class1param); return res; } gboolean webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestCallback * item = WebKit::core(self); - g_return_val_if_fail (class2param, 0); - g_return_val_if_fail (str_arg, 0); - WebCore::Class2 * _g_class2param = WebKit::core(class2param); - g_return_val_if_fail (_g_class2param, 0); - WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); - gboolean res = item->callbackWithClass2Param(_g_class2param, _g_str_arg); + g_return_val_if_fail(class2param, 0); + g_return_val_if_fail(str_arg, 0); + WebCore::Class2 * converted_class2param = WebKit::core(class2param); + g_return_val_if_fail(converted_class2param, 0); + WebCore::String converted_str_arg = WebCore::String::fromUTF8(str_arg); + gboolean res = item->callbackWithClass2Param(converted_class2param, converted_str_arg); return res; } glong webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestCallback * item = WebKit::core(self); - g_return_val_if_fail (class3param, 0); - WebCore::Class3 * _g_class3param = WebKit::core(class3param); - g_return_val_if_fail (_g_class3param, 0); - glong res = item->callbackWithNonBoolReturnType(_g_class3param); + g_return_val_if_fail(class3param, 0); + WebCore::Class3 * converted_class3param = WebKit::core(class3param); + g_return_val_if_fail(converted_class3param, 0); + glong res = item->callbackWithNonBoolReturnType(converted_class3param); return res; } @@ -182,3 +184,4 @@ WebKitDOMTestCallback* wrapTestCallback(WebCore::TestCallback* coreObject) return wrapper; } } // namespace WebKit +#endif /* ENABLE(DATABASE) */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index 0d0021d..af22530 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -21,6 +21,8 @@ #include <glib-object.h> #include "config.h" +#if ENABLE(Condition1) || ENABLE(Condition2) + #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> #include "ExceptionCode.h" @@ -138,3 +140,4 @@ WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject) return wrapper; } } // namespace WebKit +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 5dfb255..efb362b 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -24,6 +24,7 @@ #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> #include "ExceptionCode.h" +#include "HTMLNames.h" #include "TestObj.h" #include "WebKitDOMBinding.h" #include "gobject/ConvertToUTF8String.h" @@ -51,7 +52,7 @@ gpointer kit(WebCore::TestObj* obj) void webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->voidMethod(); } @@ -59,20 +60,20 @@ webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) void webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - g_return_if_fail (str_arg); - g_return_if_fail (obj_arg); - WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); - WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); - g_return_if_fail (_g_obj_arg); - item->voidMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); + g_return_if_fail(str_arg); + g_return_if_fail(obj_arg); + WebCore::String converted_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * converted_obj_arg = WebKit::core(obj_arg); + g_return_if_fail(converted_obj_arg); + item->voidMethodWithArgs(int_arg, converted_str_arg, converted_obj_arg); } glong webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->intMethod(); return res; @@ -81,21 +82,21 @@ webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) glong webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - g_return_val_if_fail (str_arg, 0); - g_return_val_if_fail (obj_arg, 0); - WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); - WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); - g_return_val_if_fail (_g_obj_arg, 0); - glong res = item->intMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); + g_return_val_if_fail(str_arg, 0); + g_return_val_if_fail(obj_arg, 0); + WebCore::String converted_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * converted_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail(converted_obj_arg, 0); + glong res = item->intMethodWithArgs(int_arg, converted_str_arg, converted_obj_arg); return res; } WebKitDOMTestObj* webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethod()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); @@ -105,14 +106,14 @@ webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) WebKitDOMTestObj* webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - g_return_val_if_fail (str_arg, 0); - g_return_val_if_fail (obj_arg, 0); - WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); - WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); - g_return_val_if_fail (_g_obj_arg, 0); - PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg)); + g_return_val_if_fail(str_arg, 0); + g_return_val_if_fail(obj_arg, 0); + WebCore::String converted_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * converted_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail(converted_obj_arg, 0); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethodWithArgs(int_arg, converted_str_arg, converted_obj_arg)); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; } @@ -120,14 +121,14 @@ webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, WebKitDOMTestObj* webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - g_return_val_if_fail (str_arg, 0); - g_return_val_if_fail (obj_arg, 0); - WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); - WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); - g_return_val_if_fail (_g_obj_arg, 0); - PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgs(_g_str_arg, _g_obj_arg)); + g_return_val_if_fail(str_arg, 0); + g_return_val_if_fail(obj_arg, 0); + WebCore::String converted_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * converted_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail(converted_obj_arg, 0); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgs(converted_str_arg, converted_obj_arg)); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; } @@ -135,15 +136,15 @@ webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* WebKitDOMTestObj* webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - g_return_val_if_fail (str_arg, 0); - g_return_val_if_fail (obj_arg, 0); - WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); - WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); - g_return_val_if_fail (_g_obj_arg, 0); + g_return_val_if_fail(str_arg, 0); + g_return_val_if_fail(obj_arg, 0); + WebCore::String converted_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * converted_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail(converted_obj_arg, 0); WebCore::ExceptionCode ec = 0; - PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgsAndThrows(_g_str_arg, _g_obj_arg, ec)); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgsAndThrows(converted_str_arg, converted_obj_arg, ec)); if (ec) { WebCore::ExceptionCodeDescription ecdesc; WebCore::getExceptionCodeDescription(ec, ecdesc); @@ -156,18 +157,18 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* s void webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - g_return_if_fail (serialized_arg); - WebCore::SerializedScriptValue * _g_serialized_arg = WebKit::core(serialized_arg); - g_return_if_fail (_g_serialized_arg); - item->serializedValue(_g_serialized_arg); + g_return_if_fail(serialized_arg); + WebCore::SerializedScriptValue * converted_serialized_arg = WebKit::core(serialized_arg); + g_return_if_fail(converted_serialized_arg); + item->serializedValue(converted_serialized_arg); } void webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->methodWithException(ec); @@ -187,7 +188,7 @@ webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error void webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrame(); } @@ -195,7 +196,7 @@ webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) void webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndArg(int_arg); } @@ -203,7 +204,7 @@ webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int void webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndOptionalArg(int_arg, optional_arg); } @@ -211,7 +212,7 @@ webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, void webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGesture(int_arg); } @@ -219,7 +220,7 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, void webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg); } @@ -227,7 +228,7 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* s void webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withScriptStateVoid(); } @@ -235,7 +236,7 @@ webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); @@ -245,7 +246,7 @@ webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) void webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->withScriptStateVoidException(ec); @@ -259,7 +260,7 @@ webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GEr WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObjException(ec)); @@ -275,7 +276,7 @@ webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GErr void webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->withScriptExecutionContext(); } @@ -283,7 +284,7 @@ webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self) void webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->methodWithOptionalArg(opt); } @@ -291,7 +292,7 @@ webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt) void webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt); } @@ -299,7 +300,7 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestO void webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2); } @@ -307,7 +308,7 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOM glong webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->readOnlyIntAttr(); return res; @@ -316,7 +317,7 @@ webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) gchar* webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->readOnlyStringAttr()); return res; @@ -325,7 +326,7 @@ webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) WebKitDOMTestObj* webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->readOnlyTestObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); @@ -335,7 +336,7 @@ webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self) glong webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->intAttr(); return res; @@ -344,7 +345,7 @@ webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->setIntAttr(value); } @@ -352,7 +353,7 @@ webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) gint64 webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); gint64 res = item->longLongAttr(); return res; @@ -361,7 +362,7 @@ webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->setLongLongAttr(value); } @@ -369,7 +370,7 @@ webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value) guint64 webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); guint64 res = item->unsignedLongLongAttr(); return res; @@ -378,7 +379,7 @@ webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->setUnsignedLongLongAttr(value); } @@ -386,7 +387,7 @@ webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 gchar* webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->stringAttr()); return res; @@ -395,17 +396,17 @@ webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - g_return_if_fail (value); - WebCore::String _g_value = WebCore::String::fromUTF8(value); - item->setStringAttr(_g_value); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); + item->setStringAttr(converted_value); } WebKitDOMTestObj* webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->testObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); @@ -415,38 +416,165 @@ webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - g_return_if_fail (value); - WebCore::TestObj * _g_value = WebKit::core(value); - g_return_if_fail (_g_value); - item->setTestObjAttr(_g_value); + g_return_if_fail(value); + WebCore::TestObj * converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + item->setTestObjAttr(converted_value); +} + +gchar* +webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); + return res; +} + +void +webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, gchar* value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); + item->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, converted_value); } glong -webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self) +webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr); + return res; +} + +void +webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, value); +} + +gboolean +webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gboolean res = item->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr); + return res; +} + +void +webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean value) { - g_return_val_if_fail (self, 0); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - glong res = item->attrWithException(); + item->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value); +} + +gchar* +webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); return res; } void -webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value) +webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - item->setAttrWithException(value); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); + item->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, converted_value); +} + +gchar* +webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); + return res; +} + +void +webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, gchar* value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); + item->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, converted_value); } glong -webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error) +webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr); + return res; +} + +void +webkit_dom_test_obj_set_reflected_custom_integral_attr(WebKitDOMTestObj* self, glong value) { - g_return_val_if_fail (self, 0); + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, value); +} + +gboolean +webkit_dom_test_obj_get_reflected_custom_boolean_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gboolean res = item->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr); + return res; +} + +void +webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gboolean value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value); +} + +gchar* +webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); + return res; +} + +void +webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); + item->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, converted_value); +} + +glong +webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error) +{ + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; - glong res = item->attrWithSetterException(ec); + glong res = item->attrWithGetterException(ec); if (ec) { WebCore::ExceptionCodeDescription ecdesc; WebCore::getExceptionCodeDescription(ec, ecdesc); @@ -456,9 +584,32 @@ webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GErro } void +webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + WebCore::ExceptionCode ec = 0; + item->setAttrWithGetterException(value, ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } +} + +glong +webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->attrWithSetterException(); + return res; +} + +void webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->setAttrWithSetterException(value, ec); @@ -469,22 +620,50 @@ webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong } } -glong -webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self) +gchar* +webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - glong res = item->attrWithGetterException(); + WebCore::ExceptionCode ec = 0; + gchar* res = convertToUTF8String(item->stringAttrWithGetterException(ec)); return res; } void -webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error) +webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, gchar* value, GError **error) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); WebCore::ExceptionCode ec = 0; - item->setAttrWithGetterException(value, ec); + item->setStringAttrWithGetterException(converted_value, ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } +} + +gchar* +webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->stringAttrWithSetterException()); + return res; +} + +void +webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, gchar* value, GError **error) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::String converted_value = WebCore::String::fromUTF8(value); + WebCore::ExceptionCode ec = 0; + item->setStringAttrWithSetterException(converted_value, ec); if (ec) { WebCore::ExceptionCodeDescription ecdesc; WebCore::getExceptionCodeDescription(ec, ecdesc); @@ -495,16 +674,79 @@ webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong gchar* webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->scriptStringAttr()); return res; } +#if ENABLE(Condition1) +glong +webkit_dom_test_obj_get_conditional_attr1(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->conditionalAttr1(); + return res; +} +#endif /* ENABLE(Condition1) */ + +#if ENABLE(Condition1) +void +webkit_dom_test_obj_set_conditional_attr1(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setConditionalAttr1(value); +} +#endif /* ENABLE(Condition1) */ + +#if ENABLE(Condition1) && ENABLE(Condition2) +glong +webkit_dom_test_obj_get_conditional_attr2(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->conditionalAttr2(); + return res; +} +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ + +#if ENABLE(Condition1) && ENABLE(Condition2) +void +webkit_dom_test_obj_set_conditional_attr2(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setConditionalAttr2(value); +} +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ + +#if ENABLE(Condition1) || ENABLE(Condition2) +glong +webkit_dom_test_obj_get_conditional_attr3(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->conditionalAttr3(); + return res; +} +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + +#if ENABLE(Condition1) || ENABLE(Condition2) +void +webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setConditionalAttr3(value); +} +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + glong webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->description(); return res; @@ -513,7 +755,7 @@ webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) glong webkit_dom_test_obj_get_id(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->id(); return res; @@ -522,7 +764,7 @@ webkit_dom_test_obj_get_id(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) { - g_return_if_fail (self); + g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); item->setId(value); } @@ -530,7 +772,7 @@ webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) gchar* webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) { - g_return_val_if_fail (self, 0); + g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->hash()); return res; @@ -562,11 +804,29 @@ enum { PROP_UNSIGNED_LONG_LONG_ATTR, PROP_STRING_ATTR, PROP_TEST_OBJ_ATTR, - PROP_ATTR_WITH_EXCEPTION, - PROP_ATTR_WITH_SETTER_EXCEPTION, + PROP_REFLECTED_STRING_ATTR, + PROP_REFLECTED_INTEGRAL_ATTR, + PROP_REFLECTED_BOOLEAN_ATTR, + PROP_REFLECTED_URL_ATTR, + PROP_REFLECTED_STRING_ATTR, + PROP_REFLECTED_CUSTOM_INTEGRAL_ATTR, + PROP_REFLECTED_CUSTOM_BOOLEAN_ATTR, + PROP_REFLECTED_URL_ATTR, PROP_ATTR_WITH_GETTER_EXCEPTION, + PROP_ATTR_WITH_SETTER_EXCEPTION, + PROP_STRING_ATTR_WITH_GETTER_EXCEPTION, + PROP_STRING_ATTR_WITH_SETTER_EXCEPTION, PROP_CUSTOM_ATTR, PROP_SCRIPT_STRING_ATTR, +#if ENABLE(Condition1) + PROP_CONDITIONAL_ATTR1, +#endif /* ENABLE(Condition1) */ +#if ENABLE(Condition1) && ENABLE(Condition2) + PROP_CONDITIONAL_ATTR2, +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ +#if ENABLE(Condition1) || ENABLE(Condition2) + PROP_CONDITIONAL_ATTR3, +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ PROP_DESCRIPTION, PROP_ID, PROP_HASH, @@ -609,9 +869,50 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value))); break; } - case PROP_ATTR_WITH_EXCEPTION: + case PROP_REFLECTED_STRING_ATTR: + { + coreSelf->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, WebCore::String::fromUTF8(g_value_get_string(value))); + break; + } + case PROP_REFLECTED_INTEGRAL_ATTR: + { + coreSelf->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, (g_value_get_long(value))); + break; + } + case PROP_REFLECTED_BOOLEAN_ATTR: + { + coreSelf->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, (g_value_get_boolean(value))); + break; + } + case PROP_REFLECTED_URL_ATTR: + { + coreSelf->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, WebCore::String::fromUTF8(g_value_get_string(value))); + break; + } + case PROP_REFLECTED_STRING_ATTR: + { + coreSelf->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, WebCore::String::fromUTF8(g_value_get_string(value))); + break; + } + case PROP_REFLECTED_CUSTOM_INTEGRAL_ATTR: + { + coreSelf->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, (g_value_get_long(value))); + break; + } + case PROP_REFLECTED_CUSTOM_BOOLEAN_ATTR: { - coreSelf->setAttrWithException((g_value_get_long(value))); + coreSelf->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, (g_value_get_boolean(value))); + break; + } + case PROP_REFLECTED_URL_ATTR: + { + coreSelf->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, WebCore::String::fromUTF8(g_value_get_string(value))); + break; + } + case PROP_ATTR_WITH_GETTER_EXCEPTION: + { + WebCore::ExceptionCode ec = 0; + coreSelf->setAttrWithGetterException((g_value_get_long(value)), ec); break; } case PROP_ATTR_WITH_SETTER_EXCEPTION: @@ -620,12 +921,39 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setAttrWithSetterException((g_value_get_long(value)), ec); break; } - case PROP_ATTR_WITH_GETTER_EXCEPTION: + case PROP_STRING_ATTR_WITH_GETTER_EXCEPTION: { WebCore::ExceptionCode ec = 0; - coreSelf->setAttrWithGetterException((g_value_get_long(value)), ec); + coreSelf->setStringAttrWithGetterException(WebCore::String::fromUTF8(g_value_get_string(value)), ec); + break; + } + case PROP_STRING_ATTR_WITH_SETTER_EXCEPTION: + { + WebCore::ExceptionCode ec = 0; + coreSelf->setStringAttrWithSetterException(WebCore::String::fromUTF8(g_value_get_string(value)), ec); + break; + } +#if ENABLE(Condition1) + case PROP_CONDITIONAL_ATTR1: + { + coreSelf->setConditionalAttr1((g_value_get_long(value))); break; } +#endif /* ENABLE(Condition1) */ +#if ENABLE(Condition1) && ENABLE(Condition2) + case PROP_CONDITIONAL_ATTR2: + { + coreSelf->setConditionalAttr2((g_value_get_long(value))); + break; + } +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ +#if ENABLE(Condition1) || ENABLE(Condition2) + case PROP_CONDITIONAL_ATTR3: + { + coreSelf->setConditionalAttr3((g_value_get_long(value))); + break; + } +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ case PROP_ID: { coreSelf->setId((g_value_get_long(value))); @@ -685,20 +1013,66 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_set_object(value, WebKit::kit(ptr.get())); break; } - case PROP_ATTR_WITH_EXCEPTION: + case PROP_REFLECTED_STRING_ATTR: { - g_value_set_long(value, coreSelf->attrWithException()); + g_value_take_string(value, convertToUTF8String(coreSelf->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr))); + break; + } + case PROP_REFLECTED_INTEGRAL_ATTR: + { + g_value_set_long(value, coreSelf->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); + break; + } + case PROP_REFLECTED_BOOLEAN_ATTR: + { + g_value_set_boolean(value, coreSelf->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr)); + break; + } + case PROP_REFLECTED_URL_ATTR: + { + g_value_take_string(value, convertToUTF8String(coreSelf->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr))); + break; + } + case PROP_REFLECTED_STRING_ATTR: + { + g_value_take_string(value, convertToUTF8String(coreSelf->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr))); + break; + } + case PROP_REFLECTED_CUSTOM_INTEGRAL_ATTR: + { + g_value_set_long(value, coreSelf->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); + break; + } + case PROP_REFLECTED_CUSTOM_BOOLEAN_ATTR: + { + g_value_set_boolean(value, coreSelf->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr)); + break; + } + case PROP_REFLECTED_URL_ATTR: + { + g_value_take_string(value, convertToUTF8String(coreSelf->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr))); + break; + } + case PROP_ATTR_WITH_GETTER_EXCEPTION: + { + WebCore::ExceptionCode ec = 0; + g_value_set_long(value, coreSelf->attrWithGetterException(ec)); break; } case PROP_ATTR_WITH_SETTER_EXCEPTION: { + g_value_set_long(value, coreSelf->attrWithSetterException()); + break; + } + case PROP_STRING_ATTR_WITH_GETTER_EXCEPTION: + { WebCore::ExceptionCode ec = 0; - g_value_set_long(value, coreSelf->attrWithSetterException(ec)); + g_value_take_string(value, convertToUTF8String(coreSelf->stringAttrWithGetterException(ec))); break; } - case PROP_ATTR_WITH_GETTER_EXCEPTION: + case PROP_STRING_ATTR_WITH_SETTER_EXCEPTION: { - g_value_set_long(value, coreSelf->attrWithGetterException()); + g_value_take_string(value, convertToUTF8String(coreSelf->stringAttrWithSetterException())); break; } case PROP_SCRIPT_STRING_ATTR: @@ -706,6 +1080,27 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); break; } +#if ENABLE(Condition1) + case PROP_CONDITIONAL_ATTR1: + { + g_value_set_long(value, coreSelf->conditionalAttr1()); + break; + } +#endif /* ENABLE(Condition1) */ +#if ENABLE(Condition1) && ENABLE(Condition2) + case PROP_CONDITIONAL_ATTR2: + { + g_value_set_long(value, coreSelf->conditionalAttr2()); + break; + } +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ +#if ENABLE(Condition1) || ENABLE(Condition2) + case PROP_CONDITIONAL_ATTR3: + { + g_value_set_long(value, coreSelf->conditionalAttr3()); + break; + } +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ case PROP_DESCRIPTION: { g_value_set_long(value, coreSelf->description()); @@ -800,24 +1195,66 @@ G_MAXUINT64, /* min */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, - PROP_ATTR_WITH_EXCEPTION, - g_param_spec_long("attr-with-exception", /* name */ - "test_obj_attr-with-exception", /* short description */ - "read-write glong TestObj.attr-with-exception", /* longer - could do with some extra doc stuff here */ + PROP_REFLECTED_STRING_ATTR, + g_param_spec_string("reflected-string-attr", /* name */ + "test_obj_reflected-string-attr", /* short description */ + "read-write gchar* TestObj.reflected-string-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_REFLECTED_INTEGRAL_ATTR, + g_param_spec_long("reflected-integral-attr", /* name */ + "test_obj_reflected-integral-attr", /* short description */ + "read-write glong TestObj.reflected-integral-attr", /* longer - could do with some extra doc stuff here */ G_MINLONG, /* min */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, - PROP_ATTR_WITH_SETTER_EXCEPTION, - g_param_spec_long("attr-with-setter-exception", /* name */ - "test_obj_attr-with-setter-exception", /* short description */ - "read-write glong TestObj.attr-with-setter-exception", /* longer - could do with some extra doc stuff here */ + PROP_REFLECTED_BOOLEAN_ATTR, + g_param_spec_boolean("reflected-boolean-attr", /* name */ + "test_obj_reflected-boolean-attr", /* short description */ + "read-write gboolean TestObj.reflected-boolean-attr", /* longer - could do with some extra doc stuff here */ + FALSE, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_REFLECTED_URL_ATTR, + g_param_spec_string("reflected-url-attr", /* name */ + "test_obj_reflected-url-attr", /* short description */ + "read-write gchar* TestObj.reflected-url-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_REFLECTED_STRING_ATTR, + g_param_spec_string("reflected-string-attr", /* name */ + "test_obj_reflected-string-attr", /* short description */ + "read-write gchar* TestObj.reflected-string-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_REFLECTED_CUSTOM_INTEGRAL_ATTR, + g_param_spec_long("reflected-custom-integral-attr", /* name */ + "test_obj_reflected-custom-integral-attr", /* short description */ + "read-write glong TestObj.reflected-custom-integral-attr", /* longer - could do with some extra doc stuff here */ G_MINLONG, /* min */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, + PROP_REFLECTED_CUSTOM_BOOLEAN_ATTR, + g_param_spec_boolean("reflected-custom-boolean-attr", /* name */ + "test_obj_reflected-custom-boolean-attr", /* short description */ + "read-write gboolean TestObj.reflected-custom-boolean-attr", /* longer - could do with some extra doc stuff here */ + FALSE, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_REFLECTED_URL_ATTR, + g_param_spec_string("reflected-url-attr", /* name */ + "test_obj_reflected-url-attr", /* short description */ + "read-write gchar* TestObj.reflected-url-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_GETTER_EXCEPTION, g_param_spec_long("attr-with-getter-exception", /* name */ "test_obj_attr-with-getter-exception", /* short description */ @@ -827,12 +1264,68 @@ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, + PROP_ATTR_WITH_SETTER_EXCEPTION, + g_param_spec_long("attr-with-setter-exception", /* name */ + "test_obj_attr-with-setter-exception", /* short description */ + "read-write glong TestObj.attr-with-setter-exception", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_STRING_ATTR_WITH_GETTER_EXCEPTION, + g_param_spec_string("string-attr-with-getter-exception", /* name */ + "test_obj_string-attr-with-getter-exception", /* short description */ + "read-write gchar* TestObj.string-attr-with-getter-exception", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_STRING_ATTR_WITH_SETTER_EXCEPTION, + g_param_spec_string("string-attr-with-setter-exception", /* name */ + "test_obj_string-attr-with-setter-exception", /* short description */ + "read-write gchar* TestObj.string-attr-with-setter-exception", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, PROP_SCRIPT_STRING_ATTR, g_param_spec_string("script-string-attr", /* name */ "test_obj_script-string-attr", /* short description */ "read-only gchar* TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); +#if ENABLE(Condition1) + g_object_class_install_property(gobjectClass, + PROP_CONDITIONAL_ATTR1, + g_param_spec_long("conditional-attr1", /* name */ + "test_obj_conditional-attr1", /* short description */ + "read-write glong TestObj.conditional-attr1", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); +#endif /* ENABLE(Condition1) */ +#if ENABLE(Condition1) && ENABLE(Condition2) + g_object_class_install_property(gobjectClass, + PROP_CONDITIONAL_ATTR2, + g_param_spec_long("conditional-attr2", /* name */ + "test_obj_conditional-attr2", /* short description */ + "read-write glong TestObj.conditional-attr2", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ +#if ENABLE(Condition1) || ENABLE(Condition2) + g_object_class_install_property(gobjectClass, + PROP_CONDITIONAL_ATTR3, + g_param_spec_long("conditional-attr3", /* name */ + "test_obj_conditional-attr3", /* short description */ + "read-write glong TestObj.conditional-attr3", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ g_object_class_install_property(gobjectClass, PROP_DESCRIPTION, g_param_spec_long("description", /* name */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index ef5ccb8..8dcd8c3 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -160,27 +160,111 @@ webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); +WEBKIT_API gchar* +webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, gchar* value); + WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self); +webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong value); + +WEBKIT_API gboolean +webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean value); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value); +webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, gchar* value); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error); +webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error); +webkit_dom_test_obj_set_reflected_custom_integral_attr(WebKitDOMTestObj* self, glong value); + +WEBKIT_API gboolean +webkit_dom_test_obj_get_reflected_custom_boolean_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gboolean value); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self); +webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API void webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error); +WEBKIT_API glong +webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error); + +WEBKIT_API void +webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, gchar* value, GError **error); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, gchar* value, GError **error); + WEBKIT_API gchar* webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self); +#if ENABLE(Condition1) +WEBKIT_API glong +webkit_dom_test_obj_get_conditional_attr1(WebKitDOMTestObj* self); +#endif /* ENABLE(Condition1) */ + +#if ENABLE(Condition1) +WEBKIT_API void +webkit_dom_test_obj_set_conditional_attr1(WebKitDOMTestObj* self, glong value); +#endif /* ENABLE(Condition1) */ + +#if ENABLE(Condition1) && ENABLE(Condition2) +WEBKIT_API glong +webkit_dom_test_obj_get_conditional_attr2(WebKitDOMTestObj* self); +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ + +#if ENABLE(Condition1) && ENABLE(Condition2) +WEBKIT_API void +webkit_dom_test_obj_set_conditional_attr2(WebKitDOMTestObj* self, glong value); +#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ + +#if ENABLE(Condition1) || ENABLE(Condition2) +WEBKIT_API glong +webkit_dom_test_obj_get_conditional_attr3(WebKitDOMTestObj* self); +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + +#if ENABLE(Condition1) || ENABLE(Condition2) +WEBKIT_API void +webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value); +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + WEBKIT_API glong webkit_dom_test_obj_get_description(WebKitDOMTestObj* self); diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 693a48b..8e71df1 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -19,6 +19,9 @@ */ #include "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + #include "JSTestInterface.h" #include "TestInterface.h" @@ -61,39 +64,30 @@ static const HashTableValue JSTestInterfaceConstructorTableValues[1] = static JSC_CONST_HASHTABLE HashTable JSTestInterfaceConstructorTable = { 1, 0, JSTestInterfaceConstructorTableValues, 0 }; class JSTestInterfaceConstructor : public DOMConstructorObject { public: - JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject) + JSTestInterfaceConstructor(JSC::ExecState*, JSDOMGlobalObject*); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - putDirect(exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); } - virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); - virtual const ClassInfo* classInfo() const { return &s_info; } - static const ClassInfo s_info; - - static PassRefPtr<Structure> createStructure(JSValue proto) - { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); - } - protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; - static EncodedJSValue JSC_HOST_CALL constructTestInterface(ExecState* exec) - { - ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext(); - if (!context) - return throwVMError(exec, createReferenceError(exec, "Reference error")); - return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context)))); - } - virtual ConstructType getConstructData(ConstructData& constructData) - { - constructData.native.function = constructTestInterface; - return ConstructTypeHost; - } + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; + static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestInterface(JSC::ExecState*); + virtual JSC::ConstructType getConstructData(JSC::ConstructData&); }; const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", 0, &JSTestInterfaceConstructorTable, 0 }; +JSTestInterfaceConstructor::JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + bool JSTestInterfaceConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot<JSTestInterfaceConstructor, DOMObject>(exec, &JSTestInterfaceConstructorTable, this, propertyName, slot); @@ -104,6 +98,20 @@ bool JSTestInterfaceConstructor::getOwnPropertyDescriptor(ExecState* exec, const return getStaticValueDescriptor<JSTestInterfaceConstructor, DOMObject>(exec, &JSTestInterfaceConstructorTable, this, propertyName, descriptor); } +EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::constructJSTestInterface(ExecState* exec) +{ + ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext(); + if (!context) + return throwVMError(exec, createReferenceError(exec, "Reference error")); + return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context)))); +} + +ConstructType JSTestInterfaceConstructor::getConstructData(ConstructData& constructData) +{ + constructData.native.function = constructJSTestInterface; + return ConstructTypeHost; +} + /* Hash table for prototype */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -173,3 +181,5 @@ TestInterface* toTestInterface(JSC::JSValue value) } } + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/WebCore/bindings/scripts/test/JS/JSTestInterface.h index 23b183b..09d7d7c 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -21,6 +21,8 @@ #ifndef JSTestInterface_h #define JSTestInterface_h +#if ENABLE(Condition1) || ENABLE(Condition2) + #include "JSDOMBinding.h" #include <runtime/JSGlobalObject.h> #include <runtime/JSObjectWithGlobalObject.h> @@ -79,4 +81,6 @@ JSC::JSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC } // namespace WebCore +#endif // ENABLE(Condition1) || ENABLE(Condition2) + #endif diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 09b69cd..360782d 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "JSTestObj.h" +#include "HTMLNames.h" #include "JSEventListener.h" #include "JSTestObj.h" #include "JSlog.h" @@ -46,7 +47,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[18] = +static const HashTableValue JSTestObjTableValues[30] = { { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -56,11 +57,29 @@ static const HashTableValue JSTestObjTableValues[18] = { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, { "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) }, { "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) }, - { "attrWithException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithException), (intptr_t)setJSTestObjAttrWithException THUNK_GENERATOR(0) }, - { "attrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException THUNK_GENERATOR(0) }, + { "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr THUNK_GENERATOR(0) }, + { "reflectedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedIntegralAttr), (intptr_t)setJSTestObjReflectedIntegralAttr THUNK_GENERATOR(0) }, + { "reflectedBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedBooleanAttr), (intptr_t)setJSTestObjReflectedBooleanAttr THUNK_GENERATOR(0) }, + { "reflectedURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedURLAttr), (intptr_t)setJSTestObjReflectedURLAttr THUNK_GENERATOR(0) }, + { "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr THUNK_GENERATOR(0) }, + { "reflectedCustomIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomIntegralAttr), (intptr_t)setJSTestObjReflectedCustomIntegralAttr THUNK_GENERATOR(0) }, + { "reflectedCustomBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomBooleanAttr), (intptr_t)setJSTestObjReflectedCustomBooleanAttr THUNK_GENERATOR(0) }, + { "reflectedURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedURLAttr), (intptr_t)setJSTestObjReflectedURLAttr THUNK_GENERATOR(0) }, { "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) }, + { "attrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException THUNK_GENERATOR(0) }, + { "stringAttrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithGetterException), (intptr_t)setJSTestObjStringAttrWithGetterException THUNK_GENERATOR(0) }, + { "stringAttrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithSetterException), (intptr_t)setJSTestObjStringAttrWithSetterException THUNK_GENERATOR(0) }, { "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) }, { "scriptStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, +#if ENABLE(Condition1) + { "conditionalAttr1", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionalAttr1), (intptr_t)setJSTestObjConditionalAttr1 THUNK_GENERATOR(0) }, +#endif +#if ENABLE(Condition1) && ENABLE(Condition2) + { "conditionalAttr2", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionalAttr2), (intptr_t)setJSTestObjConditionalAttr2 THUNK_GENERATOR(0) }, +#endif +#if ENABLE(Condition1) || ENABLE(Condition2) + { "conditionalAttr3", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionalAttr3), (intptr_t)setJSTestObjConditionalAttr3 THUNK_GENERATOR(0) }, +#endif { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0 THUNK_GENERATOR(0) }, { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId THUNK_GENERATOR(0) }, { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -69,7 +88,7 @@ static const HashTableValue JSTestObjTableValues[18] = }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 65, 63, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 69, 63, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -86,27 +105,28 @@ static const HashTableValue JSTestObjConstructorTableValues[1] = static JSC_CONST_HASHTABLE HashTable JSTestObjConstructorTable = { 1, 0, JSTestObjConstructorTableValues, 0 }; class JSTestObjConstructor : public DOMConstructorObject { public: - JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSTestObjConstructor::createStructure(globalObject->objectPrototype()), globalObject) + JSTestObjConstructor(JSC::ExecState*, JSDOMGlobalObject*); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); } - virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); - virtual const ClassInfo* classInfo() const { return &s_info; } - static const ClassInfo s_info; - - static PassRefPtr<Structure> createStructure(JSValue proto) - { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); - } - protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; }; const ClassInfo JSTestObjConstructor::s_info = { "TestObjConstructor", 0, &JSTestObjConstructorTable, 0 }; +JSTestObjConstructor::JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSTestObjConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + bool JSTestObjConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot<JSTestObjConstructor, DOMObject>(exec, &JSTestObjConstructorTable, this, propertyName, slot); @@ -277,31 +297,113 @@ JSValue jsTestObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier return result; } -JSValue jsTestObjAttrWithException(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue jsTestObjReflectedStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); + return result; +} + +JSValue jsTestObjReflectedIntegralAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); + return result; +} + +JSValue jsTestObjReflectedBooleanAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr)); + return result; +} + +JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); + return result; +} + +JSValue jsTestObjReflectedStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); + return result; +} + +JSValue jsTestObjReflectedCustomIntegralAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); + return result; +} + +JSValue jsTestObjReflectedCustomBooleanAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr)); + return result; +} + +JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->attrWithException()); + JSValue result = jsString(exec, imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); + return result; +} + +JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + ExceptionCode ec = 0; + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSC::JSValue result = jsNumber(exec, imp->attrWithGetterException(ec)); + setDOMException(exec, ec); return result; } JSValue jsTestObjAttrWithSetterException(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->attrWithSetterException()); + return result; +} + +JSValue jsTestObjStringAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); ExceptionCode ec = 0; TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSC::JSValue result = jsNumber(exec, imp->attrWithSetterException(ec)); + JSC::JSValue result = jsString(exec, imp->stringAttrWithGetterException(ec)); setDOMException(exec, ec); return result; } -JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue jsTestObjStringAttrWithSetterException(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->attrWithGetterException()); + JSValue result = jsString(exec, imp->stringAttrWithSetterException()); return result; } @@ -320,6 +422,39 @@ JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Ident return result; } +#if ENABLE(Condition1) +JSValue jsTestObjConditionalAttr1(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->conditionalAttr1()); + return result; +} +#endif + +#if ENABLE(Condition1) && ENABLE(Condition2) +JSValue jsTestObjConditionalAttr2(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->conditionalAttr2()); + return result; +} +#endif + +#if ENABLE(Condition1) || ENABLE(Condition2) +JSValue jsTestObjConditionalAttr3(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->conditionalAttr3()); + return result; +} +#endif + JSValue jsTestObjDescription(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -392,11 +527,69 @@ void setJSTestObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue valu imp->setTestObjAttr(toTestObj(value)); } -void setJSTestObjAttrWithException(ExecState* exec, JSObject* thisObject, JSValue value) +void setJSTestObjReflectedStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - imp->setAttrWithException(value.toInt32(exec)); + imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSTestObjReflectedIntegralAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, value.toInt32(exec)); +} + +void setJSTestObjReflectedBooleanAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean(exec)); +} + +void setJSTestObjReflectedURLAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSTestObjReflectedStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSTestObjReflectedCustomIntegralAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, value.toInt32(exec)); +} + +void setJSTestObjReflectedCustomBooleanAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean(exec)); +} + +void setJSTestObjReflectedURLAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + imp->setAttrWithGetterException(value.toInt32(exec), ec); + setDOMException(exec, ec); } void setJSTestObjAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value) @@ -408,12 +601,21 @@ void setJSTestObjAttrWithSetterException(ExecState* exec, JSObject* thisObject, setDOMException(exec, ec); } -void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value) +void setJSTestObjStringAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - imp->setAttrWithGetterException(value.toInt32(exec), ec); + imp->setStringAttrWithGetterException(ustringToString(value.toString(exec)), ec); + setDOMException(exec, ec); +} + +void setJSTestObjStringAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + imp->setStringAttrWithSetterException(ustringToString(value.toString(exec)), ec); setDOMException(exec, ec); } @@ -422,6 +624,33 @@ void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value); } +#if ENABLE(Condition1) +void setJSTestObjConditionalAttr1(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setConditionalAttr1(value.toInt32(exec)); +} +#endif + +#if ENABLE(Condition1) && ENABLE(Condition2) +void setJSTestObjConditionalAttr2(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setConditionalAttr2(value.toInt32(exec)); +} +#endif + +#if ENABLE(Condition1) || ENABLE(Condition2) +void setJSTestObjConditionalAttr3(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setConditionalAttr3(value.toInt32(exec)); +} +#endif + void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -875,7 +1104,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -889,7 +1118,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecSta return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -910,7 +1139,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecSta return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -923,7 +1152,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecSta return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) @@ -938,15 +1167,15 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecSta EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { - if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) + if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || exec->argument(0).isObject() && asObject(exec->argument(0))->inherits(&JSTestObj::s_info)) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod1(exec); - if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info))) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)))) + if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isObject() && asObject(exec->argument(0))->inherits(&JSTestObj::s_info))) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || exec->argument(0).isObject() && asObject(exec->argument(0))->inherits(&JSTestObj::s_info)))) return jsTestObjPrototypeFunctionOverloadedMethod2(exec); if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isUndefined() || exec->argument(0).isString() || exec->argument(0).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod3(exec); if (exec->argumentCount() == 1) return jsTestObjPrototypeFunctionOverloadedMethod4(exec); - return throwTypeError(exec); + return throwVMTypeError(exec); } JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index dd84005..3b21c85 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -130,15 +130,39 @@ JSC::JSValue jsTestObjStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Ident void setJSTestObjStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjTestObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsTestObjAttrWithException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -void setJSTestObjAttrWithException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -void setJSTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedIntegralAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedCustomIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedCustomIntegralAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedCustomBooleanAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedCustomBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjStringAttrWithGetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjStringAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjStringAttrWithSetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjStringAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjCustomAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjScriptStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjConditionalAttr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjConditionalAttr1(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjConditionalAttr2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjConditionalAttr2(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjConditionalAttr3(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjConditionalAttr3(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm index 8fd7791..ab59333 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm @@ -25,6 +25,9 @@ */ #import "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + #import "DOMInternal.h" #import "DOMTestInterface.h" @@ -85,3 +88,5 @@ DOMTestInterface *kit(WebCore::TestInterface* value) addDOMWrapper(wrapper, value); return [wrapper autorelease]; } + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 6b50246..d8862da 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -47,15 +47,45 @@ - (void)setStringAttr:(NSString *)newStringAttr; - (DOMTestObj *)testObjAttr; - (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr; -- (int)attrWithException; -- (void)setAttrWithException:(int)newAttrWithException; -- (int)attrWithSetterException; -- (void)setAttrWithSetterException:(int)newAttrWithSetterException; +- (NSString *)reflectedStringAttr; +- (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr; +- (int)reflectedIntegralAttr; +- (void)setReflectedIntegralAttr:(int)newReflectedIntegralAttr; +- (BOOL)reflectedBooleanAttr; +- (void)setReflectedBooleanAttr:(BOOL)newReflectedBooleanAttr; +- (NSString *)reflectedURLAttr; +- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr; +- (NSString *)reflectedStringAttr; +- (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr; +- (int)reflectedCustomIntegralAttr; +- (void)setReflectedCustomIntegralAttr:(int)newReflectedCustomIntegralAttr; +- (BOOL)reflectedCustomBooleanAttr; +- (void)setReflectedCustomBooleanAttr:(BOOL)newReflectedCustomBooleanAttr; +- (NSString *)reflectedURLAttr; +- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr; - (int)attrWithGetterException; - (void)setAttrWithGetterException:(int)newAttrWithGetterException; +- (int)attrWithSetterException; +- (void)setAttrWithSetterException:(int)newAttrWithSetterException; +- (NSString *)stringAttrWithGetterException; +- (void)setStringAttrWithGetterException:(NSString *)newStringAttrWithGetterException; +- (NSString *)stringAttrWithSetterException; +- (void)setStringAttrWithSetterException:(NSString *)newStringAttrWithSetterException; - (int)customAttr; - (void)setCustomAttr:(int)newCustomAttr; - (NSString *)scriptStringAttr; +#if ENABLE(Condition1) +- (int)conditionalAttr1; +- (void)setConditionalAttr1:(int)newConditionalAttr1; +#endif +#if ENABLE(Condition1) && ENABLE(Condition2) +- (int)conditionalAttr2; +- (void)setConditionalAttr2:(int)newConditionalAttr2; +#endif +#if ENABLE(Condition1) || ENABLE(Condition2) +- (int)conditionalAttr3; +- (void)setConditionalAttr3:(int)newConditionalAttr3; +#endif - (int)descriptionName; - (int)idName; - (void)setIdName:(int)newIdName; diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index e57ed87..9bbbf14 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -39,6 +39,7 @@ #import "DOMlogInternal.h" #import "EventListener.h" #import "ExceptionHandlers.h" +#import "HTMLNames.h" #import "JSMainThreadExecState.h" #import "KURL.h" #import "ObjCEventListener.h" @@ -151,27 +152,125 @@ IMPL->setTestObjAttr(core(newTestObjAttr)); } -- (int)attrWithException +- (NSString *)reflectedStringAttr { WebCore::JSMainThreadNullState state; - return IMPL->attrWithException(); + return IMPL->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr); } -- (void)setAttrWithException:(int)newAttrWithException +- (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr { WebCore::JSMainThreadNullState state; - IMPL->setAttrWithException(newAttrWithException); + IMPL->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, newReflectedStringAttr); } -- (int)attrWithSetterException +- (int)reflectedIntegralAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr); +} + +- (void)setReflectedIntegralAttr:(int)newReflectedIntegralAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, newReflectedIntegralAttr); +} + +- (BOOL)reflectedBooleanAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr); +} + +- (void)setReflectedBooleanAttr:(BOOL)newReflectedBooleanAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, newReflectedBooleanAttr); +} + +- (NSString *)reflectedURLAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr); +} + +- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, newReflectedURLAttr); +} + +- (NSString *)reflectedStringAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr); +} + +- (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, newReflectedStringAttr); +} + +- (int)reflectedCustomIntegralAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr); +} + +- (void)setReflectedCustomIntegralAttr:(int)newReflectedCustomIntegralAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, newReflectedCustomIntegralAttr); +} + +- (BOOL)reflectedCustomBooleanAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr); +} + +- (void)setReflectedCustomBooleanAttr:(BOOL)newReflectedCustomBooleanAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, newReflectedCustomBooleanAttr); +} + +- (NSString *)reflectedURLAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr); +} + +- (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedURLAttr); +} + +- (int)attrWithGetterException { WebCore::JSMainThreadNullState state; WebCore::ExceptionCode ec = 0; - int result = IMPL->attrWithSetterException(ec); + int result = IMPL->attrWithGetterException(ec); WebCore::raiseOnDOMError(ec); return result; } +- (void)setAttrWithGetterException:(int)newAttrWithGetterException +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + IMPL->setAttrWithGetterException(newAttrWithGetterException, ec); + WebCore::raiseOnDOMError(ec); +} + +- (int)attrWithSetterException +{ + WebCore::JSMainThreadNullState state; + return IMPL->attrWithSetterException(); +} + - (void)setAttrWithSetterException:(int)newAttrWithSetterException { WebCore::JSMainThreadNullState state; @@ -180,17 +279,34 @@ WebCore::raiseOnDOMError(ec); } -- (int)attrWithGetterException +- (NSString *)stringAttrWithGetterException { WebCore::JSMainThreadNullState state; - return IMPL->attrWithGetterException(); + WebCore::ExceptionCode ec = 0; + NSString *result = IMPL->stringAttrWithGetterException(ec); + WebCore::raiseOnDOMError(ec); + return result; } -- (void)setAttrWithGetterException:(int)newAttrWithGetterException +- (void)setStringAttrWithGetterException:(NSString *)newStringAttrWithGetterException { WebCore::JSMainThreadNullState state; WebCore::ExceptionCode ec = 0; - IMPL->setAttrWithGetterException(newAttrWithGetterException, ec); + IMPL->setStringAttrWithGetterException(newStringAttrWithGetterException, ec); + WebCore::raiseOnDOMError(ec); +} + +- (NSString *)stringAttrWithSetterException +{ + WebCore::JSMainThreadNullState state; + return IMPL->stringAttrWithSetterException(); +} + +- (void)setStringAttrWithSetterException:(NSString *)newStringAttrWithSetterException +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + IMPL->setStringAttrWithSetterException(newStringAttrWithSetterException, ec); WebCore::raiseOnDOMError(ec); } @@ -212,6 +328,48 @@ return IMPL->scriptStringAttr(); } +#if ENABLE(Condition1) +- (int)conditionalAttr1 +{ + WebCore::JSMainThreadNullState state; + return IMPL->conditionalAttr1(); +} + +- (void)setConditionalAttr1:(int)newConditionalAttr1 +{ + WebCore::JSMainThreadNullState state; + IMPL->setConditionalAttr1(newConditionalAttr1); +} +#endif + +#if ENABLE(Condition1) && ENABLE(Condition2) +- (int)conditionalAttr2 +{ + WebCore::JSMainThreadNullState state; + return IMPL->conditionalAttr2(); +} + +- (void)setConditionalAttr2:(int)newConditionalAttr2 +{ + WebCore::JSMainThreadNullState state; + IMPL->setConditionalAttr2(newConditionalAttr2); +} +#endif + +#if ENABLE(Condition1) || ENABLE(Condition2) +- (int)conditionalAttr3 +{ + WebCore::JSMainThreadNullState state; + return IMPL->conditionalAttr3(); +} + +- (void)setConditionalAttr3:(int)newConditionalAttr3 +{ + WebCore::JSMainThreadNullState state; + IMPL->setConditionalAttr3(newConditionalAttr3); +} +#endif + - (int)descriptionName { WebCore::JSMainThreadNullState state; diff --git a/WebCore/bindings/scripts/test/TestInterface.idl b/WebCore/bindings/scripts/test/TestInterface.idl index 5a8b008..1f0aa18 100644 --- a/WebCore/bindings/scripts/test/TestInterface.idl +++ b/WebCore/bindings/scripts/test/TestInterface.idl @@ -30,6 +30,7 @@ // changes in its ouput. module test { interface [ + Conditional=Condition1|Condition2, CanBeConstructed, CallWith=ScriptExecutionContext ] TestInterface { diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index 1cb004c..ef4db10 100644 --- a/WebCore/bindings/scripts/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -40,6 +40,16 @@ module test { attribute DOMString stringAttr; attribute TestObj testObjAttr; + // Reflected DOM attributes + attribute [Reflect] DOMString reflectedStringAttr; + attribute [Reflect] long reflectedIntegralAttr; + attribute [Reflect] boolean reflectedBooleanAttr; + attribute [ReflectURL] DOMString reflectedURLAttr; + attribute [Reflect=customContentStringAttr] DOMString reflectedStringAttr; + attribute [Reflect=customContentIntegralAttr] long reflectedCustomIntegralAttr; + attribute [Reflect=customContentBooleanAttr] boolean reflectedCustomBooleanAttr; + attribute [ReflectURL=customContentURLAttr] DOMString reflectedURLAttr; + // Methods void voidMethod(); void voidMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); @@ -55,10 +65,11 @@ module test { void serializedValue(in SerializedScriptValue serializedArg); // Exceptions - void methodWithException() raises(DOMException); - attribute long attrWithException raises(DOMException); - attribute long attrWithSetterException getter raises(DOMException); - attribute long attrWithGetterException setter raises(DOMException); + void methodWithException() raises(DOMException); + attribute long attrWithGetterException getter raises(DOMException); + attribute long attrWithSetterException setter raises(DOMException); + attribute DOMString stringAttrWithGetterException getter raises(DOMException); + attribute DOMString stringAttrWithSetterException setter raises(DOMException); // 'Custom' extended attribute attribute [Custom] long customAttr; @@ -97,6 +108,11 @@ module test { // 'ConvertScriptString' extended attribute readonly attribute [ConvertScriptString] DOMString scriptStringAttr; + // 'Conditional' extended attribute + attribute [Conditional=Condition1] long conditionalAttr1; + attribute [Conditional=Condition1&Condition2] long conditionalAttr2; + attribute [Conditional=Condition1|Condition2] long conditionalAttr3; + #if defined(TESTING_V8) || defined(TESTING_JS) // Overloads void overloadedMethod(in TestObj objArg, in DOMString strArg); diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index fef199a..eff4ebd 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -28,6 +28,7 @@ #include "V8Class2.h" #include "V8CustomVoidCallback.h" #include "V8DOMString.h" +#include "V8Proxy.h" #include <wtf/Assertions.h> diff --git a/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index f0bfb86..340dca7 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -21,6 +21,8 @@ #include "config.h" #include "V8TestInterface.h" +#if ENABLE(Condition1) || ENABLE(Condition2) + #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" #include "V8BindingState.h" @@ -113,3 +115,5 @@ void V8TestInterface::derefObject(void* object) } } // namespace WebCore + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/WebCore/bindings/scripts/test/V8/V8TestInterface.h b/WebCore/bindings/scripts/test/V8/V8TestInterface.h index ce1310e..d2192ca 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestInterface.h +++ b/WebCore/bindings/scripts/test/V8/V8TestInterface.h @@ -18,6 +18,8 @@ Boston, MA 02111-1307, USA. */ +#if ENABLE(Condition1) || ENABLE(Condition2) + #ifndef V8TestInterface_h #define V8TestInterface_h @@ -48,3 +50,5 @@ v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface >); } #endif // V8TestInterface_h +#endif // ENABLE(Condition1) || ENABLE(Condition2) + diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 69c57bb..4a54ae3 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -22,6 +22,7 @@ #include "V8TestObj.h" #include "ExceptionCode.h" +#include "HTMLNames.h" #include "RuntimeEnabledFeatures.h" #include "ScriptCallStack.h" #include "SerializedScriptValue.h" @@ -151,28 +152,140 @@ static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Valu return; } -static v8::Handle<v8::Value> attrWithExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.attrWithException._get"); + INC_STATS("DOM.TestObj.reflectedStringAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8::Integer::New(imp->attrWithException()); + return v8String(imp->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); } -static void attrWithExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.attrWithException._set"); + INC_STATS("DOM.TestObj.reflectedStringAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + V8Parameter<WithNullCheck> v = value; + imp->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, v); + return; +} + +static v8::Handle<v8::Value> reflectedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedIntegralAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); +} + +static void reflectedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedIntegralAttr._set"); TestObj* imp = V8TestObj::toNative(info.Holder()); int v = toInt32(value); - imp->setAttrWithException(v); + imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v); return; } -static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> reflectedBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.attrWithSetterException._get"); + INC_STATS("DOM.TestObj.reflectedBooleanAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr)); +} + +static void reflectedBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedBooleanAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + bool v = value->BooleanValue(); + imp->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, v); + return; +} + +static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedURLAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8String(imp->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); +} + +static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedURLAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + V8Parameter<WithNullCheck> v = value; + imp->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, v); + return; +} + +static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedStringAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8String(imp->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); +} + +static void reflectedStringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedStringAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + V8Parameter<WithNullCheck> v = value; + imp->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, v); + return; +} + +static v8::Handle<v8::Value> reflectedCustomIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); +} + +static void reflectedCustomIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedCustomIntegralAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v); + return; +} + +static v8::Handle<v8::Value> reflectedCustomBooleanAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr)); +} + +static void reflectedCustomBooleanAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedCustomBooleanAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + bool v = value->BooleanValue(); + imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v); + return; +} + +static v8::Handle<v8::Value> reflectedURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedURLAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8String(imp->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); +} + +static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.reflectedURLAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + V8Parameter<WithNullCheck> v = value; + imp->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, v); + return; +} + +static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.attrWithGetterException._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); ExceptionCode ec = 0; - int v = imp->attrWithSetterException(ec); + int v = imp->attrWithGetterException(ec); if (UNLIKELY(ec)) { V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); @@ -180,6 +293,25 @@ static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::Str return v8::Integer::New(v); } +static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.attrWithGetterException._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + ExceptionCode ec = 0; + imp->setAttrWithGetterException(v, ec); + if (UNLIKELY(ec)) + V8Proxy::setDOMException(ec); + return; +} + +static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.attrWithSetterException._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->attrWithSetterException()); +} + static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.attrWithSetterException._set"); @@ -192,20 +324,45 @@ static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Lo return; } -static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> stringAttrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.attrWithGetterException._get"); + INC_STATS("DOM.TestObj.stringAttrWithGetterException._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8::Integer::New(imp->attrWithGetterException()); + ExceptionCode ec = 0; + String v = imp->stringAttrWithGetterException(ec); + if (UNLIKELY(ec)) { + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); + } + return v8String(v); } -static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +static void stringAttrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestObj.attrWithGetterException._set"); + INC_STATS("DOM.TestObj.stringAttrWithGetterException._set"); TestObj* imp = V8TestObj::toNative(info.Holder()); - int v = toInt32(value); + V8Parameter<> v = value; ExceptionCode ec = 0; - imp->setAttrWithGetterException(v, ec); + imp->setStringAttrWithGetterException(v, ec); + if (UNLIKELY(ec)) + V8Proxy::setDOMException(ec); + return; +} + +static v8::Handle<v8::Value> stringAttrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.stringAttrWithSetterException._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8String(imp->stringAttrWithSetterException()); +} + +static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.stringAttrWithSetterException._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + V8Parameter<> v = value; + ExceptionCode ec = 0; + imp->setStringAttrWithSetterException(v, ec); if (UNLIKELY(ec)) V8Proxy::setDOMException(ec); return; @@ -218,6 +375,78 @@ static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> na return v8StringOrNull(imp->scriptStringAttr()); } +#if ENABLE(Condition1) + +static v8::Handle<v8::Value> conditionalAttr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.conditionalAttr1._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->conditionalAttr1()); +} + +#endif // ENABLE(Condition1) + +#if ENABLE(Condition1) + +static void conditionalAttr1AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.conditionalAttr1._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setConditionalAttr1(v); + return; +} + +#endif // ENABLE(Condition1) + +#if ENABLE(Condition1) && ENABLE(Condition2) + +static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.conditionalAttr2._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->conditionalAttr2()); +} + +#endif // ENABLE(Condition1) && ENABLE(Condition2) + +#if ENABLE(Condition1) && ENABLE(Condition2) + +static void conditionalAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.conditionalAttr2._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setConditionalAttr2(v); + return; +} + +#endif // ENABLE(Condition1) && ENABLE(Condition2) + +#if ENABLE(Condition1) || ENABLE(Condition2) + +static v8::Handle<v8::Value> conditionalAttr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.conditionalAttr3._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->conditionalAttr3()); +} + +#endif // ENABLE(Condition1) || ENABLE(Condition2) + +#if ENABLE(Condition1) || ENABLE(Condition2) + +static void conditionalAttr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.conditionalAttr3._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setConditionalAttr3(v); + return; +} + +#endif // ENABLE(Condition1) || ENABLE(Condition2) + static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.description._get"); @@ -643,7 +872,7 @@ static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args) return overloadedMethod3Callback(args); if (args.Length() == 1) return overloadedMethod4Callback(args); - V8Proxy::setDOMException(SYNTAX_ERR); + V8Proxy::throwTypeError(); return notHandledByInterceptor(); } @@ -666,16 +895,46 @@ static const BatchedAttribute TestObjAttrs[] = { {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '') {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'attrWithException' (Type: 'attribute' ExtAttr: '') - {"attrWithException", TestObjInternal::attrWithExceptionAttrGetter, TestObjInternal::attrWithExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '') - {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect') + {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') + {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect') + {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'ReflectURL') + {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect') + {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') + {"reflectedCustomIntegralAttr", TestObjInternal::reflectedCustomIntegralAttrAttrGetter, TestObjInternal::reflectedCustomIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedCustomBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect') + {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'ReflectURL') + {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '') {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '') + {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'stringAttrWithGetterException' (Type: 'attribute' ExtAttr: '') + {"stringAttrWithGetterException", TestObjInternal::stringAttrWithGetterExceptionAttrGetter, TestObjInternal::stringAttrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'stringAttrWithSetterException' (Type: 'attribute' ExtAttr: '') + {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom') {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString') {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#if ENABLE(Condition1) + // Attribute 'conditionalAttr1' (Type: 'attribute' ExtAttr: 'Conditional') + {"conditionalAttr1", TestObjInternal::conditionalAttr1AttrGetter, TestObjInternal::conditionalAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition1) +#if ENABLE(Condition1) && ENABLE(Condition2) + // Attribute 'conditionalAttr2' (Type: 'attribute' ExtAttr: 'Conditional') + {"conditionalAttr2", TestObjInternal::conditionalAttr2AttrGetter, TestObjInternal::conditionalAttr2AttrSetter, 0 /* no data */, 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 'conditionalAttr3' (Type: 'attribute' ExtAttr: 'Conditional') + {"conditionalAttr3", TestObjInternal::conditionalAttr3AttrGetter, TestObjInternal::conditionalAttr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +#endif // ENABLE(Condition1) || ENABLE(Condition2) // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '') {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'id' (Type: 'attribute' ExtAttr: '') diff --git a/WebCore/bindings/v8/JavaScriptCallFrame.cpp b/WebCore/bindings/v8/JavaScriptCallFrame.cpp index 049321b..20bf378 100644 --- a/WebCore/bindings/v8/JavaScriptCallFrame.cpp +++ b/WebCore/bindings/v8/JavaScriptCallFrame.cpp @@ -85,7 +85,7 @@ String JavaScriptCallFrame::functionName() const v8::HandleScope handleScope; v8::Context::Scope contextScope(m_debuggerContext.get()); v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("functionName")); - return toWebCoreString(result); + return toWebCoreStringWithNullOrUndefinedCheck(result); } v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp index af0933f..15382ad 100644 --- a/WebCore/bindings/v8/NPV8Object.cpp +++ b/WebCore/bindings/v8/NPV8Object.cpp @@ -57,7 +57,7 @@ namespace WebCore { WrapperTypeInfo* npObjectTypeInfo() { - static WrapperTypeInfo typeInfo = { 0, 0, false }; + static WrapperTypeInfo typeInfo = { 0, 0, 0 }; return &typeInfo; } diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index d3ec33f..6f17373 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -34,6 +34,7 @@ #include "PlatformBridge.h" #include "Document.h" +#include "DocumentParser.h" #include "DOMWindow.h" #include "Event.h" #include "EventListener.h" @@ -258,9 +259,18 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode, Shoul return ScriptValue(object); } -void ScriptController::setEventHandlerLineNumber(int lineNumber) +int ScriptController::eventHandlerLineNumber() const { - m_proxy->setEventHandlerLineNumber(lineNumber); + if (DocumentParser* parser = m_frame->document()->parser()) + return parser->lineNumber(); + return 0; +} + +int ScriptController::eventHandlerColumnNumber() const +{ + if (DocumentParser* parser = m_frame->document()->parser()) + return parser->columnNumber(); + return 0; } void ScriptController::finishedWithEvent(Event* event) diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h index 5d4b83e..3187180 100644 --- a/WebCore/bindings/v8/ScriptController.h +++ b/WebCore/bindings/v8/ScriptController.h @@ -153,7 +153,9 @@ public: static void gcUnprotectJSWrapper(void*); void finishedWithEvent(Event*); - void setEventHandlerLineNumber(int lineNumber); + + int eventHandlerLineNumber() const; + int eventHandlerColumnNumber() const; void setProcessingTimerCallback(bool processingTimerCallback) { m_processingTimerCallback = processingTimerCallback; } // FIXME: Currently we don't use the parameter world at all. diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp index 39e409e..38fcd8a 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -72,6 +72,7 @@ ScriptDebugServer& ScriptDebugServer::shared() ScriptDebugServer::ScriptDebugServer() : m_pauseOnExceptionsState(DontPauseOnExceptions) , m_pausedPage(0) + , m_enabled(true) { } @@ -83,6 +84,8 @@ void ScriptDebugServer::setDebuggerScriptSource(const String& scriptSource) void ScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page) { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) + if (!m_enabled) + return; v8::HandleScope scope; v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); v8::Context::Scope contextScope(debuggerContext); @@ -301,9 +304,14 @@ PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame() return m_currentCallFrame; } +void ScriptDebugServer::setEnabled(bool value) +{ + m_enabled = value; +} + bool ScriptDebugServer::isDebuggerAlwaysEnabled() { - return true; + return m_enabled; } #if ENABLE(V8_SCRIPT_DEBUG_SERVER) @@ -335,6 +343,12 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); dispatchDidParseSource(listener, object); } else if (event == v8::Break || event == v8::Exception) { + if (event == v8::Exception) { + v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); + // Stack trace is empty in case of syntax error. Silently continue execution in such cases. + if (!stackTrace->GetFrameCount()) + return; + } m_executionState.set(eventDetails.GetExecutionState()); m_pausedPage = frame->page(); ScriptState* currentCallFrameState = mainWorldScriptState(frame); diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h index 9439c16..b46f673 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.h +++ b/WebCore/bindings/v8/ScriptDebugServer.h @@ -94,6 +94,7 @@ public: PassRefPtr<JavaScriptCallFrame> currentCallFrame(); + void setEnabled(bool); bool isDebuggerAlwaysEnabled(); private: @@ -119,6 +120,7 @@ private: OwnHandle<v8::Object> m_executionState; OwnPtr<ClientMessageLoop> m_clientMessageLoop; Page* m_pausedPage; + bool m_enabled; }; } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp index 57a2824..63e7dff 100644 --- a/WebCore/bindings/v8/ScriptEventListener.cpp +++ b/WebCore/bindings/v8/ScriptEventListener.cpp @@ -64,11 +64,8 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, Attribu return 0; } - if (frame->document()->parser()) { - // FIXME: Change to use script->eventHandlerLineNumber() when implemented. - lineNumber = frame->document()->parser()->lineNumber(); - columnNumber = frame->document()->parser()->columnNumber(); - } + lineNumber = scriptController->eventHandlerLineNumber(); + columnNumber = scriptController->eventHandlerColumnNumber(); sourceURL = node->document()->url().string(); } @@ -97,11 +94,8 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri return 0; } - if (frame->document()->parser()) { - // FIXME: Change to use script->eventHandlerLineNumber() when implemented. - lineNumber = frame->document()->parser()->lineNumber(); - columnNumber = frame->document()->parser()->columnNumber(); - } + lineNumber = scriptController->eventHandlerLineNumber(); + columnNumber = scriptController->eventHandlerColumnNumber(); sourceURL = frame->document()->url().string(); return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld)); } diff --git a/WebCore/bindings/v8/ScriptProfiler.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp index ab0b9fe..4891892 100644 --- a/WebCore/bindings/v8/ScriptProfiler.cpp +++ b/WebCore/bindings/v8/ScriptProfiler.cpp @@ -52,4 +52,11 @@ PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& return profile ? ScriptProfile::create(profile) : 0; } +void ScriptProfiler::takeHeapSnapshot() +{ + v8::V8::ResumeProfilerEx(v8::PROFILER_MODULE_HEAP_SNAPSHOT + | v8::PROFILER_MODULE_HEAP_STATS + | v8::PROFILER_MODULE_JS_CONSTRUCTORS); +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptProfiler.h b/WebCore/bindings/v8/ScriptProfiler.h index c02cc32..aff3ce7 100644 --- a/WebCore/bindings/v8/ScriptProfiler.h +++ b/WebCore/bindings/v8/ScriptProfiler.h @@ -43,6 +43,7 @@ class ScriptProfiler : public Noncopyable { public: static void start(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); + static void takeHeapSnapshot(); }; } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptSourceCode.h b/WebCore/bindings/v8/ScriptSourceCode.h index 5c16168..dbc9d5e 100644 --- a/WebCore/bindings/v8/ScriptSourceCode.h +++ b/WebCore/bindings/v8/ScriptSourceCode.h @@ -31,6 +31,7 @@ #ifndef ScriptSourceCode_h #define ScriptSourceCode_h +#include "CachedResourceHandle.h" #include "CachedScript.h" #include "KURL.h" #include "PlatformString.h" @@ -41,6 +42,7 @@ class ScriptSourceCode { public: ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1) : m_source(source) + , m_cachedScript(0) , m_url(url) , m_startLine(startLine) { @@ -50,6 +52,7 @@ public: // Not sure if that matters. ScriptSourceCode(CachedScript* cs) : m_source(cs->script()) + , m_cachedScript(cs) , m_url(ParsedURLString, cs->url()) , m_startLine(1) { @@ -58,11 +61,13 @@ public: bool isEmpty() const { return m_source.isEmpty(); } const String& source() const { return m_source; } + CachedScript* cachedScript() const { return m_cachedScript.get(); } const KURL& url() const { return m_url; } int startLine() const { return m_startLine; } private: String m_source; + CachedResourceHandle<CachedScript> m_cachedScript; KURL m_url; int m_startLine; }; diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp index 02d62db..3aca3c1 100755 --- a/WebCore/bindings/v8/ScriptValue.cpp +++ b/WebCore/bindings/v8/ScriptValue.cpp @@ -63,7 +63,7 @@ bool ScriptValue::getString(String& result) const String ScriptValue::toString(ScriptState*) const { - return toWebCoreStringWithNullCheck(m_value); + return toWebCoreString(m_value); } } // namespace WebCore diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp index 97805c0..1272fd4 100644 --- a/WebCore/bindings/v8/V8Binding.cpp +++ b/WebCore/bindings/v8/V8Binding.cpp @@ -442,25 +442,29 @@ static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parame stringImpl->deref(); } -v8::Local<v8::String> v8ExternalString(const String& string) +RefPtr<StringImpl> lastStringImpl = 0; +v8::Persistent<v8::String> lastV8String; + +v8::Local<v8::String> v8ExternalStringSlow(StringImpl* stringImpl) { - StringImpl* stringImpl = string.impl(); - if (!stringImpl || !stringImpl->length()) + if (!stringImpl->length()) return v8::String::Empty(); if (!stringImplCacheEnabled) - return makeExternalString(string); + return makeExternalString(String(stringImpl)); StringCache& stringCache = getStringCache(); v8::String* cachedV8String = stringCache.get(stringImpl); - if (cachedV8String) - { + if (cachedV8String) { v8::Persistent<v8::String> handle(cachedV8String); - if (!handle.IsNearDeath() && !handle.IsEmpty()) + if (!handle.IsNearDeath() && !handle.IsEmpty()) { + lastStringImpl = stringImpl; + lastV8String = handle; return v8::Local<v8::String>::New(handle); + } } - v8::Local<v8::String> newString = makeExternalString(string); + v8::Local<v8::String> newString = makeExternalString(String(stringImpl)); if (newString.IsEmpty()) return newString; @@ -472,6 +476,9 @@ v8::Local<v8::String> v8ExternalString(const String& string) wrapper.MakeWeak(stringImpl, cachedStringCallback); stringCache.set(stringImpl, *wrapper); + lastStringImpl = stringImpl; + lastV8String = wrapper; + return newString; } diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h index 696cd1a..9eebf51 100644 --- a/WebCore/bindings/v8/V8Binding.h +++ b/WebCore/bindings/v8/V8Binding.h @@ -81,10 +81,30 @@ namespace WebCore { AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value>); AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value> value); + // Note: RefPtr is a must as we cache by StringImpl* equality, not identity + // hence lastStringImpl might be not a key of the cache (in sense of identity) + // and hence it's not refed on addition. + extern RefPtr<StringImpl> lastStringImpl; + extern v8::Persistent<v8::String> lastV8String; + v8::Local<v8::String> v8ExternalStringSlow(StringImpl* stringImpl); + // Return a V8 external string that shares the underlying buffer with the given // WebCore string. The reference counting mechanism is used to keep the // underlying buffer alive while the string is still live in the V8 engine. - v8::Local<v8::String> v8ExternalString(const String&); + inline v8::Local<v8::String> v8ExternalString(const String& string) + { + StringImpl* stringImpl = string.impl(); + if (!stringImpl) + return v8::String::Empty(); + + if (lastStringImpl.get() == stringImpl) { + ASSERT(!lastV8String.IsNearDeath()); + ASSERT(!lastV8String.IsEmpty()); + return v8::Local<v8::String>::New(lastV8String); + } + + return v8ExternalStringSlow(stringImpl); + } // Convert a string to a V8 string. inline v8::Handle<v8::String> v8String(const String& string) diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp index 5611199..c27e1d5 100644 --- a/WebCore/bindings/v8/V8GCController.cpp +++ b/WebCore/bindings/v8/V8GCController.cpp @@ -39,6 +39,7 @@ #include "HTMLNames.h" #include "MessagePort.h" #include "SVGElement.h" +#include "V8Binding.h" #include "V8DOMMap.h" #include "V8MessagePort.h" #include "V8Proxy.h" @@ -359,6 +360,10 @@ void V8GCController::gcPrologue() ObjectGrouperVisitor objectGrouperVisitor; visitDOMNodesInCurrentThread(&objectGrouperVisitor); objectGrouperVisitor.applyGrouping(); + + // Clean single element cache for string conversions. + lastStringImpl = 0; + lastV8String.Clear(); } class GCEpilogueVisitor : public DOMWrapperMap<void>::Visitor { diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 7a5df96..a8473be 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -32,6 +32,7 @@ #include "V8Proxy.h" #include "CSSMutableStyleDeclaration.h" +#include "CachedMetadata.h" #include "DateExtension.h" #include "DocumentLoader.h" #include "Frame.h" @@ -55,6 +56,7 @@ #include "V8HiddenPropertyName.h" #include "V8IsolatedContext.h" #include "V8RangeException.h" +#include "V8SQLException.h" #include "V8XMLHttpRequestException.h" #include "V8XPathException.h" #include "WorkerContext.h" @@ -69,6 +71,7 @@ #include <utility> #include <wtf/Assertions.h> #include <wtf/OwnArrayPtr.h> +#include <wtf/OwnPtr.h> #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/UnusedParam.h> @@ -240,6 +243,7 @@ V8Proxy::~V8Proxy() windowShell()->destroyGlobal(); } +<<<<<<< HEAD v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine) #ifdef ANDROID_INSTRUMENT { @@ -251,12 +255,15 @@ v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const v8::Handle<v8::Script> V8Proxy::compileScriptInternal(v8::Handle<v8::String> code, const String& fileName, int baseLine) #endif +======= +v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* scriptData) +>>>>>>> webkit.org at r61871 { const uint16_t* fileNameString = fromWebCoreString(fileName); v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length()); v8::Handle<v8::Integer> line = v8::Integer::New(baseLine); v8::ScriptOrigin origin(name, line); - v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin); + v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData); return script; } @@ -355,6 +362,28 @@ bool V8Proxy::setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetCont return true; } +PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript) +{ + // A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from + // the CachedScript. If the format changes, this ID should be changed too. + static const unsigned dataTypeID = 0xECC13BD7; + + // Very small scripts are not worth the effort to preparse. + static const int minPreparseLength = 1024; + + if (!cachedScript || code->Length() < minPreparseLength) + return 0; + + CachedMetadata* cachedMetadata = cachedScript->cachedMetadata(dataTypeID); + if (cachedMetadata) + return v8::ScriptData::New(cachedMetadata->data(), cachedMetadata->size()); + + OwnPtr<v8::ScriptData> scriptData(v8::ScriptData::PreCompile(code)); + cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->Length()); + + return scriptData.release(); +} + v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* node) { ASSERT(v8::Context::InContext()); @@ -380,10 +409,11 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod #if PLATFORM(CHROMIUM) PlatformBridge::traceEventBegin("v8.compile", node, ""); #endif + OwnPtr<v8::ScriptData> scriptData = precompileScript(code, source.cachedScript()); // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at // 1, whereas v8 starts at 0. - v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1); + v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1, scriptData.get()); #if PLATFORM(CHROMIUM) PlatformBridge::traceEventEnd("v8.compile", node, ""); @@ -711,6 +741,11 @@ void V8Proxy::setDOMException(int exceptionCode) exception = toV8(XPathException::create(description)); break; #endif +#if ENABLE(DATABASE) + case SQLExceptionType: + exception = toV8(SQLException::create(description)); + break; +#endif default: ASSERT_NOT_REACHED(); } @@ -738,6 +773,16 @@ v8::Handle<v8::Value> V8Proxy::throwError(ErrorType type, const char* message) } } +v8::Handle<v8::Value> V8Proxy::throwTypeError() +{ + return throwError(TypeError, "Type error"); +} + +v8::Handle<v8::Value> V8Proxy::throwSyntaxError() +{ + return throwError(SyntaxError, "Syntax error"); +} + v8::Local<v8::Context> V8Proxy::context(Frame* frame) { v8::Local<v8::Context> context = V8Proxy::mainWorldContext(frame); diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h index cd2ddad..ec9352c 100644 --- a/WebCore/bindings/v8/V8Proxy.h +++ b/WebCore/bindings/v8/V8Proxy.h @@ -53,6 +53,7 @@ namespace WebCore { + class CachedScript; class DOMWindow; class Frame; class Node; @@ -201,7 +202,6 @@ namespace WebCore { } #endif - void setEventHandlerLineNumber(int lineNumber) { m_handlerLineNumber = lineNumber; } void finishedWithEvent(Event*) { } // Evaluate JavaScript in a new isolated world. The script gets its own @@ -289,7 +289,7 @@ namespace WebCore { static v8::Handle<v8::Value> checkNewLegal(const v8::Arguments&); - static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine); + static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* = 0); #ifdef ANDROID_INSTRUMENT static v8::Handle<v8::Script> compileScriptInternal(v8::Handle<v8::String> code, const String& fileName, int baseLine); @@ -302,6 +302,10 @@ namespace WebCore { // Schedule an error object to be thrown. static v8::Handle<v8::Value> throwError(ErrorType, const char* message); + // Helpers for throwing syntax and type errors with predefined messages. + static v8::Handle<v8::Value> throwTypeError(); + static v8::Handle<v8::Value> throwSyntaxError(); + template <typename T> static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&, WrapperTypeInfo*); @@ -345,6 +349,8 @@ namespace WebCore { void resetIsolatedWorlds(); + PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*); + // Returns false when we're out of memory in V8. bool setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext); @@ -361,13 +367,15 @@ namespace WebCore { static const char* svgExceptionName(int exceptionCode); #endif +#if ENABLE(DATABASE) + static const char* sqlExceptionName(int exceptionCode); +#endif + Frame* m_frame; // For the moment, we have one of these. Soon we will have one per DOMWrapperWorld. RefPtr<V8DOMWindowShell> m_windowShell; - int m_handlerLineNumber; - // True for <a href="javascript:foo()"> and false for <script>foo()</script>. // Only valid during execution. bool m_inlineCode; diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp index 3e48f4b..501e5a2 100644 --- a/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp @@ -45,7 +45,7 @@ v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& ar INC_STATS("DOM.ArrayBuffer.Constructor"); if (!args.IsConstructCall()) - return throwError("DOM object constructor cannot be called as a function."); + return throwError("DOM object constructor cannot be called as a function.", V8Proxy::SyntaxError); // If we return a previously constructed ArrayBuffer, // e.g. from the call to ArrayBufferView.buffer, this code is called @@ -61,22 +61,15 @@ v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& ar // ArrayBuffer(n) where n is an integer: // -- create an empty buffer of n bytes - int argLen = args.Length(); - if (argLen > 1) - return throwError("Wrong number of arguments specified to constructor (requires 1)"); - - int len = 0; - if (argLen > 0) { - if (!args[0]->IsInt32()) - return throwError("Argument to ArrayBuffer constructor was not an integer"); - len = toInt32(args[0]); - } - - RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(len, 1); - if (!buffer.get()) { - V8Proxy::setDOMException(INDEX_SIZE_ERR); - return v8::Undefined(); - } + int argLength = args.Length(); + int length = 0; + if (argLength > 0) + length = toInt32(args[0]); // NaN/+inf/-inf returns 0, this is intended by WebIDL + RefPtr<ArrayBuffer> buffer; + if (length >= 0) + buffer = ArrayBuffer::create(static_cast<unsigned>(length), 1); + if (!buffer.get()) + return throwError("ArrayBuffer size is not a small enough positive integer.", V8Proxy::RangeError); // Transform the holder into a wrapper object for the array. V8DOMWrapper::setDOMWrapper(args.Holder(), &info, buffer.get()); return toV8(buffer.release(), args.Holder()); diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h index cc34778..1c5d731 100644 --- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -68,6 +68,12 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType // "buf", starting at the specified offset, for the given // length + if (args[0]->IsNull()) { + // Invalid first argument + // FIXME: use forthcoming V8Proxy::throwTypeError(). + return V8Proxy::throwError(V8Proxy::TypeError, "Type error"); + } + // See whether the first argument is a ArrayBuffer. if (V8ArrayBuffer::HasInstance(args[0])) { ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject()); @@ -88,8 +94,10 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType } RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length); - if (!array) - return throwError("Out-of-range offset and/or length"); + if (!array) { + V8Proxy::setDOMException(INDEX_SIZE_ERR); + return notHandledByInterceptor(); + } // Transform the holder into a wrapper object for the array. V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get()); args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); @@ -98,22 +106,29 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType uint32_t len = 0; v8::Handle<v8::Object> srcArray; + bool doInstantiation = false; - if (args[0]->IsInt32()) { - len = toUInt32(args[0]); - } else if (args[0]->IsObject()) { + if (args[0]->IsObject()) { srcArray = args[0]->ToObject(); if (srcArray.IsEmpty()) return throwError("Could not convert argument 0 to an array"); len = toUInt32(srcArray->Get(v8::String::New("length"))); - } else - return throwError("Could not convert argument 0 to either a number or an array"); - - RefPtr<ArrayClass> array = ArrayClass::create(len); - if (!array.get()) { - V8Proxy::setDOMException(INDEX_SIZE_ERR); - return v8::Undefined(); + doInstantiation = true; + } else { + bool ok = false; + int32_t tempLength = toInt32(args[0], ok); // NaN/+inf/-inf returns 0, this is intended by WebIDL + if (ok && tempLength >= 0) { + len = static_cast<uint32_t>(tempLength); + doInstantiation = true; + } } + + RefPtr<ArrayClass> array; + if (doInstantiation) + array = ArrayClass::create(len); + if (!array.get()) + return throwError("ArrayBufferView size is not a small enough positive integer.", V8Proxy::RangeError); + if (!srcArray.IsEmpty()) { // Need to copy the incoming array into the newly created ArrayBufferView. for (unsigned i = 0; i < len; i++) { diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp index df16501..7a0a545 100644 --- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp @@ -44,7 +44,7 @@ namespace WebCore { -WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, 0, false }; +WrapperTypeInfo V8HTMLAudioElementConstructor::info = { V8HTMLAudioElementConstructor::GetTemplate, 0, 0 }; static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args) { diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h index 8bc5f2c..8bc5f2c 100755..100644 --- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h +++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp index 4751224..24b1709 100644 --- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp @@ -44,7 +44,7 @@ namespace WebCore { -WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, false }; +WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, 0 }; static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args) { diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h index 5db4946..5db4946 100755..100644 --- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h +++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp index 6b84856..14c80b9 100644 --- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp @@ -44,7 +44,7 @@ namespace WebCore { -WrapperTypeInfo V8HTMLOptionElementConstructor::info = { V8HTMLOptionElementConstructor::GetTemplate, 0, false }; +WrapperTypeInfo V8HTMLOptionElementConstructor::info = { V8HTMLOptionElementConstructor::GetTemplate, 0, 0 }; static v8::Handle<v8::Value> v8HTMLOptionElementConstructorCallback(const v8::Arguments& args) { diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h index 2adf0fe..2adf0fe 100755..100644 --- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h +++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp index bf81ae9..2ce4780 100644 --- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp @@ -58,6 +58,7 @@ v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const if (ec) return throwError(ec); + notification->ref(); return toV8(notification.get()); } @@ -72,6 +73,7 @@ v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8: if (ec) return throwError(ec); + notification->ref(); return toV8(notification.get()); } diff --git a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp index 7c24ac8..63d0a97 100644 --- a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp +++ b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp @@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8SQLResultSetRowList::itemCallback(const v8::Arguments& a SQLResultSetRowList* rowList = V8SQLResultSetRowList::toNative(args.Holder()); unsigned long index = args[0]->IntegerValue(); - if (index < 0 || index >= rowList->length()) { + if (index >= rowList->length()) { V8Proxy::throwError(V8Proxy::RangeError, "Item index is out of range."); return v8::Undefined(); } @@ -91,4 +91,3 @@ v8::Handle<v8::Value> V8SQLResultSetRowList::itemCallback(const v8::Arguments& a } // namespace WebCore #endif - diff --git a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp index b931053..5e15dab 100644 --- a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp @@ -93,24 +93,6 @@ v8::Handle<v8::Value> V8WebSocket::constructorCallback(const v8::Arguments& args return args.Holder(); } -v8::Handle<v8::Value> V8WebSocket::sendCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.WebSocket.send()"); - WebSocket* webSocket = V8WebSocket::toNative(args.Holder()); - - ExceptionCode ec = 0; - bool ret = false; - if (args.Length() < 1) - return throwError("Not enough arguments", V8Proxy::SyntaxError); - else { - String msg = toWebCoreString(args[0]); - ret = webSocket->send(msg, ec); - } - if (ec) - return throwError(ec); - return v8Boolean(ret); -} - } // namespace WebCore #endif // ENABLE(WEB_SOCKETS) diff --git a/WebCore/bindings/v8/npruntime.cpp b/WebCore/bindings/v8/npruntime.cpp index 12500a7..836456a 100644 --- a/WebCore/bindings/v8/npruntime.cpp +++ b/WebCore/bindings/v8/npruntime.cpp @@ -296,7 +296,6 @@ NPObject* _NPN_RetainObject(NPObject* npObject) void _NPN_DeallocateObject(NPObject* npObject) { ASSERT(npObject); - ASSERT(npObject->referenceCount >= 0); if (npObject) { // NPObjects that remain in pure C++ may never have wrappers. diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index c7705b7..f0e1768 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -38,8 +38,18 @@ #ifndef npapi_h_ #define npapi_h_ +#if defined(__OS2__) +#pragma pack(1) +#endif + #include "nptypes.h" +#if defined(__OS2__) || defined(OS2) +#ifndef XP_OS2 +#define XP_OS2 1 +#endif +#endif + #ifdef INCLUDE_JAVA #include "jri.h" /* Java Runtime Interface */ #else @@ -48,41 +58,22 @@ #endif #if defined(_WIN32) && !defined(__SYMBIAN32__) +#include <windows.h> #ifndef XP_WIN #define XP_WIN 1 #endif #endif -#ifdef __SYMBIAN32__ -# ifndef XP_SYMBIAN -# define XP_SYMBIAN 1 -# endif -#endif /* __SYMBIAN32__ */ - -#ifdef __MWERKS__ -# define _declspec __declspec -# ifdef macintosh -# ifndef XP_MAC -# define XP_MAC 1 -# endif /* XP_MAC */ -# endif /* macintosh */ -# ifdef __INTEL__ -# ifndef XP_SYMBIAN -# undef NULL -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* XP_WIN */ -# endif /* XP_SYMBIAN */ -# endif /* __INTEL__ */ -#endif /* __MWERKS__ */ - -#if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__) && !defined(XP_UNIX) -# define XP_MACOSX +#if defined(__SYMBIAN32__) +#ifndef XP_SYMBIAN +#define XP_SYMBIAN 1 +#endif #endif -#ifdef XP_MAC - #include <Quickdraw.h> - #include <Events.h> +#if defined(__APPLE_CC__) && !defined(XP_UNIX) +#ifndef XP_MACOSX +#define XP_MACOSX 1 +#endif #endif #if defined(XP_MACOSX) && defined(__LP64__) @@ -90,7 +81,7 @@ #define NP_NO_CARBON #endif -#ifdef XP_MACOSX +#if defined(XP_MACOSX) #include <ApplicationServices/ApplicationServices.h> #include <OpenGL/OpenGL.h> #ifndef NP_NO_CARBON @@ -98,19 +89,15 @@ #endif #endif -#ifdef XP_UNIX +#if defined(XP_UNIX) #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> #endif #if defined(XP_SYMBIAN) - #include <QEvent> - #include <QRegion> -#endif - -#ifdef XP_WIN - #include <windows.h> +#include <QEvent> +#include <QRegion> #endif /*----------------------------------------------------------------------*/ @@ -120,6 +107,49 @@ #define NP_VERSION_MAJOR 0 #define NP_VERSION_MINOR 24 + +/* The OS/2 version of Netscape uses RC_DATA to define the + mime types, file extensions, etc that are required. + Use a vertical bar to separate types, end types with \0. + FileVersion and ProductVersion are 32bit ints, all other + entries are strings that MUST be terminated with a \0. + +AN EXAMPLE: + +RCDATA NP_INFO_ProductVersion { 1,0,0,1,} + +RCDATA NP_INFO_MIMEType { "video/x-video|", + "video/x-flick\0" } +RCDATA NP_INFO_FileExtents { "avi|", + "flc\0" } +RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", + "MMOS2 Flc/Fli player(*.flc)\0" } + +RCDATA NP_INFO_FileVersion { 1,0,0,1 } +RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } +RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" +RCDATA NP_INFO_InternalName { "NPAVI32\0" ) +RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" +RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } +RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } +*/ +/* RC_DATA types for version info - required */ +#define NP_INFO_ProductVersion 1 +#define NP_INFO_MIMEType 2 +#define NP_INFO_FileOpenName 3 +#define NP_INFO_FileExtents 4 +/* RC_DATA types for version info - used if found */ +#define NP_INFO_FileDescription 5 +#define NP_INFO_ProductName 6 +/* RC_DATA types for version info - optional */ +#define NP_INFO_CompanyName 7 +#define NP_INFO_FileVersion 8 +#define NP_INFO_InternalName 9 +#define NP_INFO_LegalCopyright 10 +#define NP_INFO_OriginalFilename 11 + +#ifndef RC_INVOKED + /*----------------------------------------------------------------------*/ /* Definition of Basic Types */ /*----------------------------------------------------------------------*/ @@ -144,7 +174,7 @@ typedef char* NPMIMEType; /*----------------------------------------------------------------------*/ #if !defined(__LP64__) -#if defined(XP_MAC) || defined(XP_MACOSX) +#if defined(XP_MACOSX) #pragma options align=mac68k #endif #endif /* __LP64__ */ @@ -201,7 +231,19 @@ typedef struct _NPRect uint16_t right; } NPRect; -#ifdef XP_UNIX +typedef struct _NPSize +{ + int32_t width; + int32_t height; +} NPSize; + +/* Return values for NPP_HandleEvent */ +#define kNPEventNotHandled 0 +#define kNPEventHandled 1 +/* Exact meaning must be spec'd in event model. */ +#define kNPEventStartIME 2 + +#if defined(XP_UNIX) /* * Unix specific structures and definitions */ @@ -238,7 +280,7 @@ typedef struct #endif /* XP_UNIX */ -#ifdef XP_MACOSX +#if defined(XP_MACOSX) typedef enum { #ifndef NP_NO_QUICKDRAW NPDrawingModelQuickDraw = 0, @@ -280,8 +322,8 @@ typedef enum { #define _NP_ABI_MIXIN_FOR_GCC3 0 #endif +#if defined(XP_MACOSX) #define NP_ABI_MACHO_MASK 0x01000000 -#if (defined(TARGET_RT_MAC_MACHO)) #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK #else #define _NP_ABI_MIXIN_FOR_MACHO 0 @@ -324,10 +366,13 @@ typedef enum { */ NPPVpluginWantsAllNetworkStreams = 18, + /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ + NPPVpluginNativeAccessibleAtkPlugId = 19, + /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ NPPVpluginCancelSrcStream = 20 -#ifdef XP_MACOSX +#if defined(XP_MACOSX) /* Used for negotiating drawing models */ , NPPVpluginDrawingModel = 1000 /* Used for negotiating event models */ @@ -336,6 +381,7 @@ typedef enum { , NPPVpluginCoreAnimationLayer = 1003 #endif +<<<<<<< HEAD #ifdef ANDROID /* Used when the plugin returns 0 from NPN_WriteReady and wishes the browser * to wait a certain amount of millis before calling NPN_WriteReady again. @@ -344,6 +390,10 @@ typedef enum { // TODO(reed): upstream , NPPFakeValueToForce32Bits = 0x7FFFFFFF +======= +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , NPPVpluginWindowlessLocalBool = 2002 +>>>>>>> webkit.org at r61871 #endif } NPPVariable; @@ -374,7 +424,7 @@ typedef enum { NPNVprivateModeBool = 18 -#ifdef XP_MACOSX +#if defined(XP_MACOSX) /* Used for negotiating drawing models */ , NPNVpluginDrawingModel = 1000 #ifndef NP_NO_QUICKDRAW @@ -388,9 +438,14 @@ typedef enum { #endif , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ #endif /* XP_MACOSX */ +<<<<<<< HEAD #ifdef ANDROID , NPNFakeValueToForce32Bits = 0x7FFFFFFF +======= +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , NPNVSupportsWindowlessLocal = 2002 +>>>>>>> webkit.org at r61871 #endif } NPNVariable; @@ -400,6 +455,14 @@ typedef enum { } NPNURLVariable; /* + * The type of Toolkit the widgets use + */ +typedef enum { + NPNVGtk12 = 1, + NPNVGtk2 +} NPNToolkitType; + +/* * The type of a NPWindow - it specifies the type of the data structure * returned in the window field. */ @@ -424,6 +487,22 @@ typedef struct _NPWindow NPWindowType type; /* Is this a window or a drawable? */ } NPWindow; +typedef struct _NPImageExpose +{ + char* data; /* image pointer */ + int32_t stride; /* Stride of data image pointer */ + int32_t depth; /* Depth of image pointer */ + int32_t x; /* Expose x */ + int32_t y; /* Expose y */ + uint32_t width; /* Expose width */ + uint32_t height; /* Expose height */ + NPSize dataSize; /* Data buffer size */ + float translateX; /* translate X matrix value */ + float translateY; /* translate Y matrix value */ + float scaleX; /* scale X matrix value */ + float scaleY; /* scale Y matrix value */ +} NPImageExpose; + typedef struct _NPFullPrint { NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ @@ -448,7 +527,7 @@ typedef struct _NPPrint } print; } NPPrint; -#if defined(XP_MAC) || defined(XP_MACOSX) +#if defined(XP_MACOSX) #ifndef NP_NO_CARBON typedef EventRecord NPEvent; #endif @@ -461,16 +540,21 @@ typedef struct _NPEvent uintptr_t wParam; uintptr_t lParam; } NPEvent; -#elif defined (XP_UNIX) +#elif defined(XP_OS2) +typedef struct _NPEvent +{ + uint32_t event; + uint32_t wParam; + uint32_t lParam; +} NPEvent; +#elif defined(XP_UNIX) typedef XEvent NPEvent; #else typedef void* NPEvent; #endif -#if defined(XP_MAC) -typedef RgnHandle NPRegion; -#elif defined(XP_MACOSX) -typedef void *NPRegion; +#if defined(XP_MACOSX) +typedef void* NPRegion; #ifndef NP_NO_QUICKDRAW typedef RgnHandle NPQDRegion; #endif @@ -489,7 +573,7 @@ typedef struct _NPNSString NPNSString; typedef struct _NPNSWindow NPNSWindow; typedef struct _NPNSMenu NPNSMenu; -#ifdef XP_MACOSX +#if defined(XP_MACOSX) typedef NPNSMenu NPMenu; #else typedef void *NPMenu; @@ -503,7 +587,7 @@ typedef enum { NPCoordinateSpaceFlippedScreen } NPCoordinateSpace; -#ifdef XP_MACOSX +#if defined(XP_MACOSX) #ifndef NP_NO_QUICKDRAW typedef struct NP_Port @@ -598,15 +682,24 @@ typedef struct _NPCocoaEvent { } data; } NPCocoaEvent; -#endif /* XP_MACOSX */ - -#if defined(XP_MAC) || defined(XP_MACOSX) -/* Non-standard event types that can be passed to HandleEvent */ +#ifndef NP_NO_CARBON +/* Non-standard event types that can be passed to HandleEvent */ +enum NPEventType { + NPEventType_GetFocusEvent = (osEvt + 16), + NPEventType_LoseFocusEvent, + NPEventType_AdjustCursorEvent, + NPEventType_MenuCommandEvent, + NPEventType_ClippingChangedEvent, + NPEventType_ScrollingBeginsEvent = 1000, + NPEventType_ScrollingEndsEvent +}; +/* Obsolete versions of the above */ #define getFocusEvent (osEvt + 16) #define loseFocusEvent (osEvt + 17) #define adjustCursorEvent (osEvt + 18) -#endif /* XP_MAC */ +#endif /* NP_NO_CARBON */ +#endif /* XP_MACOSX */ /* * Values for mode passed to NPP_New: @@ -625,7 +718,7 @@ typedef struct _NPCocoaEvent { #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) #if !defined(__LP64__) -#if defined(XP_MAC) || defined(XP_MACOSX) +#if defined(XP_MACOSX) #pragma options align=reset #endif #endif /* __LP64__ */ @@ -694,8 +787,8 @@ typedef struct _NPCocoaEvent { /* Function Prototypes */ /*----------------------------------------------------------------------*/ -#if defined(_WINDOWS) && !defined(WIN32) -#define NP_LOADDS _loadds +#if defined(__OS2__) +#define NP_LOADDS _System #else #define NP_LOADDS #endif @@ -706,12 +799,12 @@ extern "C" { /* NPP_* functions are provided by the plugin and called by the navigator. */ -#ifdef XP_UNIX +#if defined(XP_UNIX) char* NPP_GetMIMEDescription(void); #endif -NPError NPP_Initialize(void); -void NPP_Shutdown(void); +NPError NP_LOADDS NPP_Initialize(void); +void NP_LOADDS NPP_Shutdown(void); NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); @@ -728,64 +821,62 @@ int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16_t NPP_HandleEvent(NPP instance, void* event); +int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); jref NP_LOADDS NPP_GetJavaClass(void); -NPError NPP_GetValue(NPP instance, NPPVariable variable, - void *value); -NPError NPP_SetValue(NPP instance, NPNVariable variable, - void *value); +NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); +NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); /* NPN_* functions are provided by the navigator and called by the plugin. */ -void NPN_Version(int* plugin_major, int* plugin_minor, +void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); -NPError NPN_GetURLNotify(NPP instance, const char* url, +NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, const char* target, void* notifyData); -NPError NPN_GetURL(NPP instance, const char* url, +NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, const char* target); -NPError NPN_PostURLNotify(NPP instance, const char* url, +NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData); -NPError NPN_PostURL(NPP instance, const char* url, +NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file); -NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NPN_NewStream(NPP instance, NPMIMEType type, +NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); +NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream); -int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, +int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer); -NPError NPN_DestroyStream(NPP instance, NPStream* stream, +NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -void NPN_Status(NPP instance, const char* message); -const char* NPN_UserAgent(NPP instance); -void* NPN_MemAlloc(uint32_t size); -void NPN_MemFree(void* ptr); -uint32_t NPN_MemFlush(uint32_t size); -void NPN_ReloadPlugins(NPBool reloadPages); -JRIEnv* NPN_GetJavaEnv(void); -jref NPN_GetJavaPeer(NPP instance); -NPError NPN_GetValue(NPP instance, NPNVariable variable, +void NP_LOADDS NPN_Status(NPP instance, const char* message); +const char* NP_LOADDS NPN_UserAgent(NPP instance); +void* NP_LOADDS NPN_MemAlloc(uint32_t size); +void NP_LOADDS NPN_MemFree(void* ptr); +uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); +void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); +JRIEnv* NP_LOADDS NPN_GetJavaEnv(void); +jref NP_LOADDS NPN_GetJavaPeer(NPP instance); +NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value); -NPError NPN_SetValue(NPP instance, NPPVariable variable, +NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value); -void NPN_InvalidateRect(NPP instance, NPRect *invalidRect); -void NPN_InvalidateRegion(NPP instance, +void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); +void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); -void NPN_ForceRedraw(NPP instance); -void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); -void NPN_PopPopupsEnabledState(NPP instance); -void NPN_PluginThreadAsyncCall(NPP instance, +void NP_LOADDS NPN_ForceRedraw(NPP instance); +void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); +void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); +void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData); -NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, +NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len); -NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, +NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); -NPError NPN_GetAuthenticationInfo(NPP instance, +NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme, @@ -793,13 +884,18 @@ NPError NPN_GetAuthenticationInfo(NPP instance, char **username, uint32_t *ulen, char **password, uint32_t *plen); -uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -void NPN_UnscheduleTimer(NPP instance, uint32_t timerID); -NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu); -NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); +uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); +void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); +NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); +NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); #ifdef __cplusplus } /* end extern "C" */ #endif +#endif /* RC_INVOKED */ +#if defined(__OS2__) +#pragma pack() +#endif + #endif /* npapi_h_ */ diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 6cea96e..77a6716 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -162,9 +162,11 @@ static JSRealType valueRealType(ExecState* exec, JSValue val) return String; // I don't know. } -QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects) +QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects, int recursionLimit) { - if (!value) + --recursionLimit; + + if (!value || !recursionLimit) return QVariant(); JSObject* object = 0; @@ -336,7 +338,8 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type if (type == Object || type == Array || type == RTArray) { // Enumerate the contents of the object PropertyNameArray properties(exec); - object->getPropertyNames(exec, properties); + if (properties.size() > 0) + object->getPropertyNames(exec, properties); PropertyNameArray::const_iterator it = properties.begin(); QVariantMap result; @@ -344,7 +347,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type while(it != properties.end()) { if (object->propertyIsEnumerable(exec, *it)) { JSValue val = object->get(exec, *it); - QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects); + QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist >= 0) { UString ustring = (*it).ustring(); QString id = QString((const QChar*)ustring.rep()->characters(), ustring.size()); @@ -368,7 +371,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); - result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); + result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; break; // Failed converting a list entry, so fail the array @@ -387,7 +390,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); - result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); + result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; break; // Failed converting a list entry, so fail the array @@ -401,7 +404,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array int objdist; qConvDebug() << "making a single length variantlist"; - QVariant var = convertValueToQVariant(exec, value, QMetaType::Void, &objdist, visitedObjects); + QVariant var = convertValueToQVariant(exec, value, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist != -1) { QVariantList result; result << var; @@ -645,7 +648,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<QObject*>()); else @@ -664,7 +667,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<QObject*>()); else @@ -679,7 +682,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array QObjectList result; int itemdist = -1; - QVariant item = convertValueToQVariant(exec, value, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, value, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) { result.append(item.value<QObject*>()); dist = 10; @@ -696,7 +699,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<int>()); else @@ -715,7 +718,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<int>()); else @@ -730,7 +733,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array QList<int> result; int itemdist = -1; - QVariant item = convertValueToQVariant(exec, value, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, value, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) { result.append(item.value<int>()); dist = 10; @@ -757,7 +760,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } // And then recurse with the autodetect flag - ret = convertValueToQVariant(exec, value, QMetaType::Void, distance, visitedObjects); + ret = convertValueToQVariant(exec, value, QMetaType::Void, distance, visitedObjects, recursionLimit); dist = 10; } break; @@ -777,8 +780,9 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance) { + const int recursionLimit = 200; HashSet<JSObject*> visitedObjects; - return convertValueToQVariant(exec, value, hint, distance, &visitedObjects); + return convertValueToQVariant(exec, value, hint, distance, &visitedObjects, recursionLimit); } JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant) diff --git a/WebCore/config.h b/WebCore/config.h index 827bd05..c46a53c 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -323,7 +323,3 @@ typedef float CGFloat; #if PLATFORM(WIN) && PLATFORM(CG) #define WTF_USE_SAFARI_THEME 1 #endif - -#if defined(WTF_USE_V8) -#define USE_NEW_QUERY_CALLBACKS -#endif diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index 23366cf..06779a9 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> * @@ -921,6 +921,12 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper if (style->highlight() == nullAtom) return CSSPrimitiveValue::createIdentifier(CSSValueNone); return CSSPrimitiveValue::create(style->highlight(), CSSPrimitiveValue::CSS_STRING); + case CSSPropertyWebkitHyphens: + return CSSPrimitiveValue::create(style->hyphens()); + case CSSPropertyWebkitHyphenateCharacter: + if (style->hyphenateCharacter().isNull()) + return CSSPrimitiveValue::createIdentifier(CSSValueAuto); + return CSSPrimitiveValue::create(style->hyphenateCharacter(), CSSPrimitiveValue::CSS_STRING); case CSSPropertyWebkitBorderFit: if (style->borderFit() == BorderFitBorder) return CSSPrimitiveValue::createIdentifier(CSSValueBorder); diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y index 06c6d01..26b2ba8 100644 --- a/WebCore/css/CSSGrammar.y +++ b/WebCore/css/CSSGrammar.y @@ -778,19 +778,25 @@ page_selector: CSSParser* p = static_cast<CSSParser*>(parser); $$ = p->createFloatingSelector(); $$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace); + $$->setForPage(); } | IDENT pseudo_page { CSSParser* p = static_cast<CSSParser*>(parser); $$ = $2; - if ($$) + if ($$) { $$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace); + $$->setForPage(); + } } | pseudo_page { $$ = $1; + if ($$) + $$->setForPage(); } | /* empty */ { CSSParser* p = static_cast<CSSParser*>(parser); $$ = p->createFloatingSelector(); + $$->setForPage(); } ; diff --git a/WebCore/css/CSSInitialValue.h b/WebCore/css/CSSInitialValue.h index 96bc2a5..70ea91c 100644 --- a/WebCore/css/CSSInitialValue.h +++ b/WebCore/css/CSSInitialValue.h @@ -30,12 +30,12 @@ class CSSInitialValue : public CSSValue { public: static PassRefPtr<CSSInitialValue> createExplicit() { - static CSSInitialValue* explicitValue = new CSSInitialValue(false); + static CSSInitialValue* explicitValue = create(false).releaseRef(); return explicitValue; } static PassRefPtr<CSSInitialValue> createImplicit() { - static CSSInitialValue* explicitValue = new CSSInitialValue(true); + static CSSInitialValue* explicitValue = create(true).releaseRef(); return explicitValue; } @@ -47,6 +47,11 @@ private: { } + static PassRefPtr<CSSInitialValue> create(bool implicit) + { + return adoptRef(new CSSInitialValue(implicit)); + } + virtual unsigned short cssValueType() const; virtual bool isImplicitInitialValue() const { return m_implicit; } diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp index 44e0b17..8d37a2e 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -82,13 +82,18 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS #endif { m_properties.reserveInitialCapacity(numProperties); + HashSet<int> candidates; for (int i = 0; i < numProperties; ++i) { - ASSERT(properties[i]); - m_properties.append(*properties[i]); - if (properties[i]->value()->isVariableDependentValue()) + const CSSProperty *property = properties[i]; + ASSERT(property); + if (property->value()->isVariableDependentValue()) m_variableDependentValueCount++; + else if (candidates.contains(property->id())) + removeProperty(properties[i]->id(), false); + m_properties.append(*property); + if (!getPropertyPriority(property->id()) && !property->isImportant()) + candidates.add(property->id()); } - // FIXME: This allows duplicate properties. } CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& other) diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 8934656..57c42d3 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> * Copyright (C) 2008 Eric Seidel <eric@webkit.org> * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) @@ -845,7 +845,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyOutlineColor: // <color> | invert | inherit // Outline color has "invert" as additional keyword. // Also, we want to allow the special focus color even in strict parsing mode. - if (propId == CSSPropertyOutlineColor && (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor)) { + if (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor) { validPrimitive = true; break; } @@ -882,7 +882,7 @@ bool CSSParser::parseValue(int propId, bool important) // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | text | wait | help | // vertical-text | cell | context-menu | alias | copy | no-drop | not-allowed | -webkit-zoom-in - // -webkit-zoom-in | -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit + // -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit RefPtr<CSSValueList> list; while (value && value->unit == CSSPrimitiveValue::CSS_URI) { if (!list) @@ -1030,12 +1030,15 @@ bool CSSParser::parseValue(int propId, bool important) break; case CSSPropertyTextIndent: // <length> | <percentage> | inherit + validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict)); + break; + case CSSPropertyPaddingTop: //// <padding-width> | inherit case CSSPropertyPaddingRight: // Which is defined as case CSSPropertyPaddingBottom: // <length> | <percentage> case CSSPropertyPaddingLeft: //// case CSSPropertyWebkitPaddingStart: - validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict)); + validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict)); break; case CSSPropertyMaxHeight: // <length> | <percentage> | none | inherit @@ -1606,6 +1609,16 @@ bool CSSParser::parseValue(int propId, bool important) validPrimitive = true; break; + case CSSPropertyWebkitHyphens: + if (id == CSSValueNone || id == CSSValueManual || id == CSSValueAuto) + validPrimitive = true; + break; + + case CSSPropertyWebkitHyphenateCharacter: + if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING) + validPrimitive = true; + break; + case CSSPropertyWebkitBorderFit: if (id == CSSValueBorder || id == CSSValueLines) validPrimitive = true; @@ -2294,13 +2307,13 @@ CSSParser::SizeParameterType CSSParser::parseSizeParameter(CSSValueList* parsedV case CSSValueLetter: if (prevParamType == None || prevParamType == Orientation) { // Normalize to Page Size then Orientation order by prepending. - // This is not specified by the CSS3 Paged Media specification, but for simpler processing hereafter. + // This is not specified by the CSS3 Paged Media specification, but for simpler processing later (CSSStyleSelector::applyPageSizeProperty). parsedValues->prepend(CSSPrimitiveValue::createIdentifier(value->id)); return PageSize; } return None; case 0: - if (validUnit(value, FLength, m_strict) && (prevParamType == None || prevParamType == Length)) { + if (validUnit(value, FLength | FNonNeg, m_strict) && (prevParamType == None || prevParamType == Length)) { parsedValues->append(CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit))); return Length; } diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp index e602f86..0508cd5 100644 --- a/WebCore/css/CSSPrimitiveValue.cpp +++ b/WebCore/css/CSSPrimitiveValue.cpp @@ -56,18 +56,33 @@ static CSSTextCache& cssTextCache() // non-refcounted simple type with value semantics. In practice these sharing tricks get similar memory benefits // with less need for refactoring. +inline PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createUncachedIdentifier(int identifier) +{ + return adoptRef(new CSSPrimitiveValue(identifier)); +} + +inline PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createUncachedColor(unsigned rgbValue) +{ + return adoptRef(new CSSPrimitiveValue(rgbValue)); +} + +inline PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createUncached(double value, UnitTypes type) +{ + return adoptRef(new CSSPrimitiveValue(value, type)); +} + PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createIdentifier(int ident) { static RefPtr<CSSPrimitiveValue>* identValueCache = new RefPtr<CSSPrimitiveValue>[numCSSValueKeywords]; if (ident >= 0 && ident < numCSSValueKeywords) { RefPtr<CSSPrimitiveValue> primitiveValue = identValueCache[ident]; if (!primitiveValue) { - primitiveValue = adoptRef(new CSSPrimitiveValue(ident)); + primitiveValue = createUncachedIdentifier(ident); identValueCache[ident] = primitiveValue; } return primitiveValue.release(); } - return adoptRef(new CSSPrimitiveValue(ident)); + return createUncachedIdentifier(ident); } PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createColor(unsigned rgbValue) @@ -76,17 +91,17 @@ PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::createColor(unsigned rgbValue) static ColorValueCache* colorValueCache = new ColorValueCache; // These are the empty and deleted values of the hash table. if (rgbValue == Color::transparent) { - static CSSPrimitiveValue* colorTransparent = new CSSPrimitiveValue(Color::transparent); + static CSSPrimitiveValue* colorTransparent = createUncachedColor(Color::transparent).releaseRef(); return colorTransparent; } if (rgbValue == Color::white) { - static CSSPrimitiveValue* colorWhite = new CSSPrimitiveValue(Color::white); + static CSSPrimitiveValue* colorWhite = createUncachedColor(Color::white).releaseRef(); return colorWhite; } RefPtr<CSSPrimitiveValue> primitiveValue = colorValueCache->get(rgbValue); if (primitiveValue) return primitiveValue.release(); - primitiveValue = adoptRef(new CSSPrimitiveValue(rgbValue)); + primitiveValue = createUncachedColor(rgbValue); // Just wipe out the cache and start rebuilding when it gets too big. const int maxColorCacheSize = 512; if (colorValueCache->size() >= maxColorCacheSize) @@ -109,14 +124,14 @@ PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::create(double value, UnitTypes if (value == intValue) { RefPtr<CSSPrimitiveValue> primitiveValue = integerValueCache[intValue][type]; if (!primitiveValue) { - primitiveValue = adoptRef(new CSSPrimitiveValue(value, type)); + primitiveValue = createUncached(value, type); integerValueCache[intValue][type] = primitiveValue; } return primitiveValue.release(); } } - return adoptRef(new CSSPrimitiveValue(value, type)); + return createUncached(value, type); } PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::create(const String& value, UnitTypes type) diff --git a/WebCore/css/CSSPrimitiveValue.h b/WebCore/css/CSSPrimitiveValue.h index c2a4dc3..a71c8c6 100644 --- a/WebCore/css/CSSPrimitiveValue.h +++ b/WebCore/css/CSSPrimitiveValue.h @@ -191,6 +191,10 @@ private: static void create(unsigned); // compile-time guard template<typename T> operator T*(); // compile-time guard + static PassRefPtr<CSSPrimitiveValue> createUncachedIdentifier(int identifier); + static PassRefPtr<CSSPrimitiveValue> createUncachedColor(unsigned rgbValue); + static PassRefPtr<CSSPrimitiveValue> createUncached(double value, UnitTypes type); + void init(PassRefPtr<Counter>); void init(PassRefPtr<Rect>); void init(PassRefPtr<Pair>); diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index f646b29..baa1ab8 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> * Copyright (C) Research In Motion Limited 2010. All rights reserved. @@ -344,6 +344,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case CapsLockIndicatorPart: m_value.ident = CSSValueCapsLockIndicator; break; + case InputSpeechButtonPart: +#if ENABLE(INPUT_SPEECH) + m_value.ident = CSSValueInputSpeechButton; +#endif + break; } } @@ -2157,6 +2162,38 @@ template<> inline CSSPrimitiveValue::operator ColorSpace() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens) + : m_type(CSS_IDENT) + , m_hasCachedCSSText(false) +{ + switch (hyphens) { + case HyphensNone: + m_value.ident = CSSValueNone; + break; + case HyphensManual: + m_value.ident = CSSValueManual; + break; + case HyphensAuto: + m_value.ident = CSSValueAuto; + break; + } +} + +template<> inline CSSPrimitiveValue::operator Hyphens() const +{ + switch (m_value.ident) { + case CSSValueNone: + return HyphensNone; + case CSSValueManual: + return HyphensManual; + case CSSValueAuto: + return HyphensAuto; + default: + ASSERT_NOT_REACHED(); + return HyphensAuto; + } +} + #if ENABLE(SVG) template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e) diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in index 5b9e7fd..9c65971 100644 --- a/WebCore/css/CSSPropertyNames.in +++ b/WebCore/css/CSSPropertyNames.in @@ -209,6 +209,8 @@ z-index -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight +-webkit-hyphenate-character +-webkit-hyphens -webkit-line-break -webkit-line-clamp -webkit-margin-bottom-collapse diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index e45bf4c..ddf1737 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -5,6 +5,7 @@ * 2001-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 David Smith (catfish.man@gmail.com) + * Copyright (C) 2010 Google 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 @@ -37,6 +38,9 @@ using namespace HTMLNames; unsigned int CSSSelector::specificity() { + if (m_isForPage) + return specificityForPage(); + // FIXME: Pseudo-elements and pseudo-classes do not have the same specificity. This function // isn't quite correct. int s = (m_tag.localName() == starAtom ? 0 : 1); @@ -66,6 +70,27 @@ unsigned int CSSSelector::specificity() return s & 0xffffff; } +unsigned CSSSelector::specificityForPage() +{ + // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context + unsigned s = (m_tag.localName() == starAtom ? 0 : 4); + + switch (pseudoType()) { + case PseudoFirstPage: + s += 2; + break; + case PseudoLeftPage: + case PseudoRightPage: + s += 1; + break; + case PseudoNotParsed: + break; + default: + ASSERT_NOT_REACHED(); + } + return s; +} + PseudoId CSSSelector::pseudoId(PseudoType type) { switch (type) { @@ -83,6 +108,10 @@ PseudoId CSSSelector::pseudoId(PseudoType type) return FILE_UPLOAD_BUTTON; case PseudoInputPlaceholder: return INPUT_PLACEHOLDER; +#if ENABLE(INPUT_SPEECH) + case PseudoInputSpeechButton: + return INPUT_SPEECH_BUTTON; +#endif case PseudoSliderThumb: return SLIDER_THUMB; case PseudoSearchCancelButton: @@ -150,6 +179,37 @@ PseudoId CSSSelector::pseudoId(PseudoType type) ASSERT_NOT_REACHED(); return NOPSEUDO; #endif + +#if ENABLE(METER_TAG) + case PseudoMeterHorizontalBar: + return METER_HORIZONTAL_BAR; + case PseudoMeterHorizontalOptimum: + return METER_HORIZONTAL_OPTIMUM; + case PseudoMeterHorizontalSuboptimal: + return METER_HORIZONTAL_SUBOPTIMAL; + case PseudoMeterHorizontalEvenLessGood: + return METER_HORIZONTAL_EVEN_LESS_GOOD; + case PseudoMeterVerticalBar: + return METER_VERTICAL_BAR; + case PseudoMeterVerticalOptimum: + return METER_VERTICAL_OPTIMUM; + case PseudoMeterVerticalSuboptimal: + return METER_VERTICAL_SUBOPTIMAL; + case PseudoMeterVerticalEvenLessGood: + return METER_VERTICAL_EVEN_LESS_GOOD; +#else + case PseudoMeterHorizontalBar: + case PseudoMeterHorizontalOptimum: + case PseudoMeterHorizontalSuboptimal: + case PseudoMeterHorizontalEvenLessGood: + case PseudoMeterVerticalBar: + case PseudoMeterVerticalOptimum: + case PseudoMeterVerticalSuboptimal: + case PseudoMeterVerticalEvenLessGood: + ASSERT_NOT_REACHED(); + return NOPSEUDO; +#endif + case PseudoInputListButton: #if ENABLE(DATALIST) return INPUT_LIST_BUTTON; @@ -225,6 +285,9 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( DEFINE_STATIC_LOCAL(AtomicString, before, ("before")); DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked")); DEFINE_STATIC_LOCAL(AtomicString, fileUploadButton, ("-webkit-file-upload-button")); +#if ENABLE(INPUT_SPEECH) + DEFINE_STATIC_LOCAL(AtomicString, inputSpeechButton, ("-webkit-input-speech-button")); +#endif DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default")); DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled")); DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only")); @@ -280,6 +343,18 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( #if ENABLE(PROGRESS_TAG) DEFINE_STATIC_LOCAL(AtomicString, progressBarValue, ("-webkit-progress-bar-value")); #endif + +#if ENABLE(METER_TAG) + DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalBar, ("-webkit-meter-horizontal-bar")); + DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalOptimumValue, ("-webkit-meter-horizontal-optimum-value")); + DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalSuboptimalValue, ("-webkit-meter-horizontal-suboptimal-value")); + DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalEvenLessGoodValue, ("-webkit-meter-horizontal-even-less-good-value")); + DEFINE_STATIC_LOCAL(AtomicString, meterVerticalBar, ("-webkit-meter-vertical-bar")); + DEFINE_STATIC_LOCAL(AtomicString, meterVerticalOptimumValue, ("-webkit-meter-vertical-optimum-value")); + DEFINE_STATIC_LOCAL(AtomicString, meterVerticalSuboptimalValue, ("-webkit-meter-vertical-suboptimal-value")); + DEFINE_STATIC_LOCAL(AtomicString, meterVerticalEvenLessGoodValue, ("-webkit-meter-vertical-even-less-good-value")); +#endif + DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); DEFINE_STATIC_LOCAL(AtomicString, root, ("root")); @@ -323,6 +398,9 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( nameToPseudoType->set(before.impl(), CSSSelector::PseudoBefore); nameToPseudoType->set(checked.impl(), CSSSelector::PseudoChecked); nameToPseudoType->set(fileUploadButton.impl(), CSSSelector::PseudoFileUploadButton); +#if ENABLE(INPUT_SPEECH) + nameToPseudoType->set(inputSpeechButton.impl(), CSSSelector::PseudoInputSpeechButton); +#endif nameToPseudoType->set(defaultString.impl(), CSSSelector::PseudoDefault); nameToPseudoType->set(disabled.impl(), CSSSelector::PseudoDisabled); nameToPseudoType->set(readOnly.impl(), CSSSelector::PseudoReadOnly); @@ -377,6 +455,16 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( #if ENABLE(PROGRESS_TAG) nameToPseudoType->set(progressBarValue.impl(), CSSSelector::PseudoProgressBarValue); #endif +#if ENABLE(METER_TAG) + nameToPseudoType->set(meterHorizontalBar.impl(), CSSSelector::PseudoMeterHorizontalBar); + nameToPseudoType->set(meterHorizontalOptimumValue.impl(), CSSSelector::PseudoMeterHorizontalOptimum); + nameToPseudoType->set(meterHorizontalSuboptimalValue.impl(), CSSSelector::PseudoMeterHorizontalSuboptimal); + nameToPseudoType->set(meterHorizontalEvenLessGoodValue.impl(), CSSSelector::PseudoMeterHorizontalEvenLessGood); + nameToPseudoType->set(meterVerticalBar.impl(), CSSSelector::PseudoMeterVerticalBar); + nameToPseudoType->set(meterVerticalOptimumValue.impl(), CSSSelector::PseudoMeterVerticalOptimum); + nameToPseudoType->set(meterVerticalSuboptimalValue.impl(), CSSSelector::PseudoMeterVerticalSuboptimal); + nameToPseudoType->set(meterVerticalEvenLessGoodValue.impl(), CSSSelector::PseudoMeterVerticalEvenLessGood); +#endif nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot); nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowInactive); nameToPseudoType->set(decrement.impl(), CSSSelector::PseudoDecrement); @@ -442,6 +530,9 @@ void CSSSelector::extractPseudoType() const case PseudoFileUploadButton: case PseudoInputListButton: case PseudoInputPlaceholder: +#if ENABLE(INPUT_SPEECH) + case PseudoInputSpeechButton: +#endif case PseudoInnerSpinButton: case PseudoMediaControlsPanel: case PseudoMediaControlsMuteButton: @@ -459,6 +550,14 @@ void CSSSelector::extractPseudoType() const case PseudoMediaControlsFullscreenButton: case PseudoMediaControlsTimelineContainer: case PseudoMediaControlsVolumeSliderContainer: + case PseudoMeterHorizontalBar: + case PseudoMeterHorizontalOptimum: + case PseudoMeterHorizontalSuboptimal: + case PseudoMeterHorizontalEvenLessGood: + case PseudoMeterVerticalBar: + case PseudoMeterVerticalOptimum: + case PseudoMeterVerticalSuboptimal: + case PseudoMeterVerticalEvenLessGood: case PseudoOuterSpinButton: case PseudoProgressBarValue: case PseudoResizer: diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index 11d30b1..d55fafc 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -39,6 +39,7 @@ namespace WebCore { , m_parsedNth(false) , m_isLastInSelectorList(false) , m_hasRareData(false) + , m_isForPage(false) , m_tag(anyQName()) { } @@ -50,6 +51,7 @@ namespace WebCore { , m_parsedNth(false) , m_isLastInSelectorList(false) , m_hasRareData(false) + , m_isForPage(false) , m_tag(qName) { } @@ -185,7 +187,18 @@ namespace WebCore { PseudoMediaControlsReturnToRealtimeButton, PseudoMediaControlsStatusDisplay, PseudoMediaControlsFullscreenButton, + PseudoMeterHorizontalBar, + PseudoMeterVerticalBar, + PseudoMeterHorizontalOptimum, + PseudoMeterHorizontalSuboptimal, + PseudoMeterHorizontalEvenLessGood, + PseudoMeterVerticalOptimum, + PseudoMeterVerticalSuboptimal, + PseudoMeterVerticalEvenLessGood, PseudoInputListButton, +#if ENABLE(INPUT_SPEECH) + PseudoInputSpeechButton, +#endif PseudoInnerSpinButton, PseudoOuterSpinButton, PseudoProgressBarValue, @@ -253,6 +266,9 @@ namespace WebCore { void setLastInSelectorList() { m_isLastInSelectorList = true; } bool isSimple() const; + bool isForPage() const { return m_isForPage; } + void setForPage() { m_isForPage = true; } + unsigned m_relation : 3; // enum Relation mutable unsigned m_match : 4; // enum Match mutable unsigned m_pseudoType : 8; // PseudoType @@ -261,7 +277,9 @@ namespace WebCore { bool m_parsedNth : 1; // Used for :nth-* bool m_isLastInSelectorList : 1; bool m_hasRareData : 1; + bool m_isForPage : 1; + unsigned specificityForPage(); void extractPseudoType() const; struct RareData : Noncopyable { diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 13bdeb9..3af3291 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -30,6 +30,7 @@ #include "CSSBorderImageValue.h" #include "CSSCursorImageValue.h" #include "CSSFontFaceRule.h" +#include "CSSHelper.h" #include "CSSImportRule.h" #include "CSSMediaRule.h" #include "CSSPageRule.h" @@ -528,7 +529,7 @@ static void loadFullDefaultStyle() if (simpleDefaultStyleSheet) { ASSERT(defaultStyle); delete defaultStyle; - delete simpleDefaultStyleSheet; + simpleDefaultStyleSheet->deref(); defaultStyle = new CSSRuleSet; simpleDefaultStyleSheet = 0; } else { @@ -1548,6 +1549,36 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, return m_style.release(); } +PassRefPtr<RenderStyle> CSSStyleSelector::styleForPage(int pageIndex) +{ + initForStyleResolve(m_checker.m_document->body()); + + m_style = RenderStyle::create(); + m_style->inheritFrom(m_rootElementStyle); + + const bool isLeft = isLeftPage(pageIndex); + const bool isFirst = isFirstPage(pageIndex); + const String page = pageName(pageIndex); + matchPageRules(defaultPrintStyle, isLeft, isFirst, page); + matchPageRules(m_userStyle, isLeft, isFirst, page); + matchPageRules(m_authorStyle, isLeft, isFirst, page); + m_lineHeightValue = 0; + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); + + // If our font got dirtied, go ahead and update it now. + if (m_fontDirty) + updateFont(); + + // Line-height is set when we are sure we decided on the font-size + if (m_lineHeightValue) + applyProperty(CSSPropertyLineHeight, m_lineHeightValue); + + applyDeclarations<false>(false, 0, m_matchedDecls.size() - 1); + + // Now return the style. + return m_style.release(); +} + #if ENABLE(DATAGRID) PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForDataGridColumn(DataGridColumn*, RenderStyle*) @@ -2889,6 +2920,74 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e } } +void CSSStyleSelector::matchPageRules(CSSRuleSet* rules, bool isLeftPage, bool isFirstPage, const String& pageName) +{ + m_matchedRules.clear(); + + if (!rules) + return; + + matchPageRulesForList(rules->getPageRules(), isLeftPage, isFirstPage, pageName); + + // If we didn't match any rules, we're done. + if (m_matchedRules.isEmpty()) + return; + + // Sort the set of matched rules. + sortMatchedRules(0, m_matchedRules.size()); + + // Now transfer the set of matched rules over to our list of decls. + for (unsigned i = 0; i < m_matchedRules.size(); i++) + addMatchedDeclaration(m_matchedRules[i]->rule()->declaration()); +} + +void CSSStyleSelector::matchPageRulesForList(CSSRuleDataList* rules, bool isLeftPage, bool isFirstPage, const String& pageName) +{ + if (!rules) + return; + + for (CSSRuleData* d = rules->first(); d; d = d->next()) { + CSSStyleRule* rule = d->rule(); + const AtomicString& selectorLocalName = d->selector()->m_tag.localName(); + if (selectorLocalName != starAtom && selectorLocalName != pageName) + continue; + CSSSelector::PseudoType pseudoType = d->selector()->pseudoType(); + if ((pseudoType == CSSSelector::PseudoLeftPage && !isLeftPage) + || (pseudoType == CSSSelector::PseudoRightPage && isLeftPage) + || (pseudoType == CSSSelector::PseudoFirstPage && !isFirstPage)) + continue; + + // If the rule has no properties to apply, then ignore it. + CSSMutableStyleDeclaration* decl = rule->declaration(); + if (!decl || !decl->length()) + continue; + + // Add this rule to our list of matched rules. + addMatchedRule(d); + } +} + +bool CSSStyleSelector::isLeftPage(int pageIndex) const +{ + bool isFirstPageLeft = false; + if (m_rootElementStyle->direction() == RTL) + isFirstPageLeft = true; + + return (pageIndex + (isFirstPageLeft ? 1 : 0)) % 2; +} + +bool CSSStyleSelector::isFirstPage(int pageIndex) const +{ + // FIXME: In case of forced left/right page, page at index 1 (not 0) can be the first page. + return (!pageIndex); +} + +String CSSStyleSelector::pageName(int /* pageIndex */) const +{ + // FIXME: Implement page index to page name mapping. + return ""; +} + static void applyCounterList(RenderStyle* style, CSSValueList* list, bool isReset) { CounterDirectiveMap& map = style->accessCounterDirectives(); @@ -3760,12 +3859,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) l = Length(primitiveValue->getDoubleValue(), Percent); else return; - if (id == CSSPropertyPaddingLeft || id == CSSPropertyPaddingRight || - id == CSSPropertyPaddingTop || id == CSSPropertyPaddingBottom) - // Padding can't be negative - apply = !((l.isFixed() || l.isPercent()) && l.calcValue(100) < 0); - else - apply = true; + apply = true; } if (!apply) return; switch (id) { @@ -5087,6 +5181,19 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setHighlight(primitiveValue->getStringValue()); return; } + case CSSPropertyWebkitHyphens: { + HANDLE_INHERIT_AND_INITIAL(hyphens, Hyphens); + m_style->setHyphens(*primitiveValue); + return; + } + case CSSPropertyWebkitHyphenateCharacter: { + HANDLE_INHERIT_AND_INITIAL(hyphenateCharacter, HyphenateCharacter); + if (primitiveValue->getIdent() == CSSValueAuto) + m_style->setHyphenateCharacter(nullAtom); + else + m_style->setHyphenateCharacter(primitiveValue->getStringValue()); + return; + } case CSSPropertyWebkitBorderFit: { HANDLE_INHERIT_AND_INITIAL(borderFit, BorderFit); if (primitiveValue->getIdent() == CSSValueBorder) @@ -5351,12 +5458,14 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setColorSpace(*primitiveValue); } return; + case CSSPropertySize: + applyPageSizeProperty(value); + return; case CSSPropertyInvalid: return; case CSSPropertyFontStretch: case CSSPropertyPage: case CSSPropertyQuotes: - case CSSPropertySize: case CSSPropertyTextLineThrough: case CSSPropertyTextLineThroughColor: case CSSPropertyTextLineThroughMode: @@ -5416,6 +5525,161 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } } +void CSSStyleSelector::applyPageSizeProperty(CSSValue* value) +{ + if (!value->isValueList()) + return; + CSSValueList* valueList = static_cast<CSSValueList*>(value); + Length width; + Length height; + switch (valueList->length()) { + case 2: { + // <length>{2} | <page-size> <orientation> + if (!valueList->item(0)->isPrimitiveValue() || !valueList->item(1)->isPrimitiveValue()) + return; + CSSPrimitiveValue* primitiveValue0 = static_cast<CSSPrimitiveValue*>(valueList->item(0)); + CSSPrimitiveValue* primitiveValue1 = static_cast<CSSPrimitiveValue*>(valueList->item(1)); + int type0 = primitiveValue0->primitiveType(); + int type1 = primitiveValue1->primitiveType(); + if (CSSPrimitiveValue::isUnitTypeLength(type0)) { + // <length>{2} + if (!CSSPrimitiveValue::isUnitTypeLength(type1)) + return; + width = Length(primitiveValue0->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); + height = Length(primitiveValue1->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); + } else { + // <page-size> <orientation> + // The value order is guaranteed. See CSSParser::parseSizeParameter. + if (!pageSizeFromName(primitiveValue0, primitiveValue1, width, height)) + return; + } + break; + } + case 1: { + // <length> | auto | <page-size> | [ portrait | landscape] + if (!valueList->item(0)->isPrimitiveValue()) + return; + CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valueList->item(0)); + int type = primitiveValue->primitiveType(); + if (CSSPrimitiveValue::isUnitTypeLength(type)) { + // <length> + width = height = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); + } else { + if (type != CSSPrimitiveValue::CSS_IDENT) + return; + switch (primitiveValue->getIdent()) { + case CSSValueAuto: + // auto + if (!pageSizeFromName(0, 0, width, height)) + return; + break; + case CSSValuePortrait: + case CSSValueLandscape: + // <page-size> + if (!pageSizeFromName(0, primitiveValue, width, height)) + return; + break; + default: + // [ portrait | landscape] + if (!pageSizeFromName(primitiveValue, 0, width, height)) + return; + } + } + break; + } + default: + return; + } + m_style->setPageSize(LengthSize(width, height)); + return; +} + +bool CSSStyleSelector::pageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height) +{ + static const Length a5Width = mmLength(148), a5Height = mmLength(210); + static const Length a4Width = mmLength(210), a4Height = mmLength(297); + static const Length a3Width = mmLength(297), a3Height = mmLength(420); + static const Length b5Width = mmLength(176), b5Height = mmLength(250); + static const Length b4Width = mmLength(250), b4Height = mmLength(353); + static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11); + static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14); + static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17); + + // FIXME: Define UA default page size. Assume letter for now. + int ident = CSSValueLetter; + if (pageSizeName) { + if (pageSizeName->primitiveType() != CSSPrimitiveValue::CSS_IDENT) + return false; + ident = pageSizeName->getIdent(); + } + + // FIXME: Define UA default page orientation. Assume portrait for now. + bool portrait = true; + if (pageOrientation) { + if (pageOrientation->primitiveType() != CSSPrimitiveValue::CSS_IDENT) + return false; + switch (pageOrientation->getIdent()) { + case CSSValueLandscape: + portrait = false; + break; + case CSSValuePortrait: + portrait = true; + break; + default: + return false; + } + } + switch (ident) { + case CSSValueA5: + width = a5Width; + height = a5Height; + break; + case CSSValueA4: + width = a4Width; + height = a4Height; + break; + case CSSValueA3: + width = a3Width; + height = a3Height; + break; + case CSSValueB5: + width = b5Width; + height = b5Height; + break; + case CSSValueB4: + width = b4Width; + height = b4Height; + break; + case CSSValueLetter: + width = letterWidth; + height = letterHeight; + break; + case CSSValueLegal: + width = legalWidth; + height = legalHeight; + break; + case CSSValueLedger: + width = ledgerWidth; + height = ledgerHeight; + break; + default: + return false; + } + if (!portrait) + swap(width, height); + return true; +} + +Length CSSStyleSelector::mmLength(double mm) +{ + return Length(CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); +} + +Length CSSStyleSelector::inchLength(double inch) +{ + return Length(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); +} + void CSSStyleSelector::mapFillAttachment(FillLayer* layer, CSSValue* value) { if (value->cssValueType() == CSSValue::CSS_INITIAL) { diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index fd37c85..f0de83b 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -93,6 +93,8 @@ public: PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle = 0, bool matchVisitedPseudoClass = false); + PassRefPtr<RenderStyle> styleForPage(int pageIndex); + static PassRefPtr<RenderStyle> styleForDocument(Document*); #if ENABLE(DATAGRID) @@ -180,6 +182,13 @@ public: template <bool firstPass> void applyDeclarations(bool important, int startIndex, int endIndex); + + void matchPageRules(CSSRuleSet*, bool isLeftPage, bool isFirstPage, const String& pageName); + void matchPageRulesForList(CSSRuleDataList*, bool isLeftPage, bool isFirstPage, const String& pageName); + bool isLeftPage(int pageIndex) const; + bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } + bool isFirstPage(int pageIndex) const; + String pageName(int pageIndex) const; CSSRuleSet* m_authorStyle; CSSRuleSet* m_userStyle; @@ -251,6 +260,10 @@ public: void mapNinePieceImage(CSSValue*, NinePieceImage&); void applyProperty(int id, CSSValue*); + void applyPageSizeProperty(CSSValue*); + bool pageSizeFromName(CSSPrimitiveValue*, CSSPrimitiveValue*, Length& width, Length& height); + Length mmLength(double mm); + Length inchLength(double inch); #if ENABLE(SVG) void applySVGProperty(int id, CSSValue*); #endif diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index ad63265..40bb0de 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -134,10 +134,10 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio return addRule(selector, style, length(), ec); } - PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules) { - if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) + KURL url = finalURL(); + if (!url.isEmpty() && doc() && !doc()->securityOrigin()->canRequest(url)) return 0; return CSSRuleList::create(this, omitCharsetRules); } @@ -207,7 +207,7 @@ void CSSStyleSheet::checkLoaded() if (parent()) parent()->checkLoaded(); - // Avoid |this| being deleted by scripts that run via HTMLDocumentParser::executeScriptsWaitingForStylesheets(). + // Avoid |this| being deleted by scripts that run via LegacyHTMLDocumentParser::executeScriptsWaitingForStylesheets(). // See <rdar://problem/6622300>. RefPtr<CSSStyleSheet> protector(this); m_loadCompleted = ownerNode() ? ownerNode()->sheetLoaded() : true; diff --git a/WebCore/css/CSSStyleSheet.h b/WebCore/css/CSSStyleSheet.h index bb14e28..4c59144 100644 --- a/WebCore/css/CSSStyleSheet.h +++ b/WebCore/css/CSSStyleSheet.h @@ -26,7 +26,7 @@ namespace WebCore { -class CSSNamespace; +struct CSSNamespace; class CSSParser; class CSSRule; class DocLoader; diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index 154183b..3439878 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -566,6 +566,7 @@ button button-bevel default-button inner-spin-button +input-speech-button list-button listbox listitem @@ -730,3 +731,8 @@ fullscreen maximized minimized windowed + +# -webkit-hyphens +# none +manual +# auto diff --git a/WebCore/css/SVGCSSParser.cpp b/WebCore/css/SVGCSSParser.cpp index 0d5cde6..535b273 100644 --- a/WebCore/css/SVGCSSParser.cpp +++ b/WebCore/css/SVGCSSParser.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2008 Eric Seidel <eric@webkit.org> Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005, 2007 Rob Buis <buis@kde.org> + 2004, 2005, 2007, 2010 Rob Buis <buis@kde.org> Copyright (C) 2005, 2006 Apple Computer, Inc. This library is free software; you can redistribute it and/or @@ -31,6 +31,7 @@ #include "CSSQuirkPrimitiveValue.h" #include "CSSValueKeywords.h" #include "CSSValueList.h" +#include "RenderTheme.h" #include "SVGPaint.h" using namespace std; @@ -181,6 +182,8 @@ bool CSSParser::parseSVGValue(int propId, bool important) parsedValue = SVGPaint::create(SVGPaint::SVG_PAINTTYPE_NONE); else if (id == CSSValueCurrentcolor) parsedValue = SVGPaint::create(SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR); + else if ((id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSSValueMenu) + parsedValue = SVGPaint::create(RenderTheme::defaultTheme()->systemColor(id)); else if (value->unit == CSSPrimitiveValue::CSS_URI) { RGBA32 c = Color::transparent; if (m_valueList->next() && parseColorFromValue(m_valueList->current(), c)) { diff --git a/WebCore/css/WebKitCSSMatrix.idl b/WebCore/css/WebKitCSSMatrix.idl index 9d6c897..fc45ebe 100644 --- a/WebCore/css/WebKitCSSMatrix.idl +++ b/WebCore/css/WebKitCSSMatrix.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,7 +26,12 @@ module css { // Introduced in DOM Level ?: - interface [CustomConstructor] WebKitCSSMatrix { + interface [ + CanBeConstructed, + CustomConstructFunction, + ConstructorParameters=1, + V8CustomConstructor + ] WebKitCSSMatrix { // These attributes are simple aliases for certain elements of the 4x4 matrix attribute double a; // alias for m11 diff --git a/WebCore/css/html.css b/WebCore/css/html.css index b4bb05a..dc27ff8 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -372,6 +372,11 @@ input::-webkit-outer-spin-button { -webkit-user-select: none; } +input::-webkit-input-speech-button { + -webkit-appearance: input-speech-button; + display: inline-block; +} + textarea { -webkit-appearance: textarea; background-color: white; @@ -531,6 +536,46 @@ meter::-webkit-meter { -webkit-appearance: meter; } +meter::-webkit-meter-horizontal-bar { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc)); +} + +meter::-webkit-meter-vertical-bar { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, right top, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc)); +} + +meter::-webkit-meter-horizontal-optimum-value { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, left bottom, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3)); +} + +meter::-webkit-meter-horizontal-suboptimal-value { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, left bottom, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3)); +} + +meter::-webkit-meter-horizontal-even-less-good-value { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, left bottom, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44)); +} + +meter::-webkit-meter-vertical-optimum-value { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, right top, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3)); +} + +meter::-webkit-meter-vertical-suboptimal-value { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, right top, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3)); +} + +meter::-webkit-meter-vertical-even-less-good-value { + -webkit-appearance: meter; + background: -webkit-gradient(linear, left top, right top, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44)); +} + /* progress */ progress { @@ -683,4 +728,12 @@ iframe { border: 2px inset } +/* page */ + +@page { + /* FIXME: Define the right default values for page properties. */ + size: auto; + margin: 1in; +} + /* noscript is handled internally, as it depends on settings */ diff --git a/WebCore/css/mathml.css b/WebCore/css/mathml.css index 5c9038a..7a9b348 100644 --- a/WebCore/css/mathml.css +++ b/WebCore/css/mathml.css @@ -7,15 +7,20 @@ math { margin: 0px; vertical-align: baseline; line-height: 1.0; + padding-left: 1px; + padding-right: 1px; } math[display="block"] { display: block; - text-align: center; page-break-inside: avoid; margin-bottom: 1em; } +math * { + text-align: left; +} + math > * { vertical-align: baseline; } @@ -23,12 +28,8 @@ math > * { mrow, mfenced { display: inline-block; white-space: nowrap; - vertical-align: middle; -} - -mrow > mo, mfenced > mo, math > mo -{ - vertical-align: middle; + padding-left: 1px; + padding-right: 1px; } mi, mtext { @@ -42,7 +43,6 @@ mi + mrow { mfrac { display: inline-block; - vertical-align: middle; } msub, msup { @@ -83,10 +83,6 @@ munderover > * + *, mover > * + *, munder > * + * { font-size: 0.75em; } -mover > mi { - text-align: center; -} - mo, mn, mi, mtext { padding: 0px; margin: 0px; @@ -96,7 +92,7 @@ mo { display: inline-block; } -mo { +math > mo, mrow > mo, mfenced > mo { padding-left: 0.05em; padding-right: 0.05em; } @@ -154,7 +150,7 @@ mroot > * + mrow, mroot > * + mfenced { mtable { display: inline-table; text-align: center; - vertical-align: middle; + vertical-align: -40%; } mtr { display: table-row; diff --git a/WebCore/dom/DOMImplementation.cpp b/WebCore/dom/DOMImplementation.cpp index 4b7a743..3483b23 100644 --- a/WebCore/dom/DOMImplementation.cpp +++ b/WebCore/dom/DOMImplementation.cpp @@ -227,18 +227,18 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& namespaceUR RefPtr<Document> doc; #if ENABLE(SVG) if (namespaceURI == SVGNames::svgNamespaceURI) - doc = SVGDocument::create(0); + doc = SVGDocument::create(0, KURL()); else #endif #if ENABLE(WML) if (namespaceURI == WMLNames::wmlNamespaceURI) - doc = WMLDocument::create(0); + doc = WMLDocument::create(0, KURL()); else #endif if (namespaceURI == HTMLNames::xhtmlNamespaceURI) - doc = Document::createXHTML(0); + doc = Document::createXHTML(0, KURL()); else - doc = Document::create(0); + doc = Document::create(0, KURL()); RefPtr<Node> documentElement; if (!qualifiedName.isEmpty()) { @@ -295,63 +295,63 @@ bool DOMImplementation::isTextMIMEType(const String& mimeType) PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title) { - RefPtr<HTMLDocument> d = HTMLDocument::create(0); + RefPtr<HTMLDocument> d = HTMLDocument::create(0, KURL()); d->open(); d->write("<!doctype html><html><body></body></html>"); d->setTitle(title); return d.release(); } -PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame* frame, bool inViewSourceMode) +PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame* frame, const KURL& url, bool inViewSourceMode) { if (inViewSourceMode) - return HTMLViewSourceDocument::create(frame, type); + return HTMLViewSourceDocument::create(frame, url, type); // Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those. if (type == "text/html") - return HTMLDocument::create(frame); + return HTMLDocument::create(frame, url); if (type == "application/xhtml+xml" #if ENABLE(XHTMLMP) || type == "application/vnd.wap.xhtml+xml" #endif ) - return Document::createXHTML(frame); + return Document::createXHTML(frame, url); #if ENABLE(WML) if (type == "text/vnd.wap.wml" || type == "application/vnd.wap.wmlc") - return WMLDocument::create(frame); + return WMLDocument::create(frame, url); #endif #if ENABLE(FTPDIR) // Plugins cannot take FTP from us either if (type == "application/x-ftp-directory") - return FTPDirectoryDocument::create(frame); + return FTPDirectoryDocument::create(frame, url); #endif PluginData* pluginData = 0; - if (frame && frame->page() && frame->loader()->allowPlugins(NotAboutToInstantiatePlugin)) + if (frame && frame->page() && frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) pluginData = frame->page()->pluginData(); // PDF is one image type for which a plugin can override built-in support. // We do not want QuickTime to take over all image types, obviously. if ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type)) - return PluginDocument::create(frame); + return PluginDocument::create(frame, url); if (Image::supportsType(type)) - return ImageDocument::create(frame); + return ImageDocument::create(frame, url); #if ENABLE(VIDEO) // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument if (MediaPlayer::supportsType(ContentType(type))) - return MediaDocument::create(frame); + return MediaDocument::create(frame, url); #endif // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed. // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle, // and also serves as an optimization to prevent loading the plug-in database in the common case. if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type)) - return PluginDocument::create(frame); + return PluginDocument::create(frame, url); if (isTextMIMEType(type)) - return TextDocument::create(frame); + return TextDocument::create(frame, url); #if ENABLE(SVG) if (type == "image/svg+xml") { @@ -359,13 +359,13 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame Settings* settings = frame ? frame->settings() : 0; if (!settings || !settings->usesDashboardBackwardCompatibilityMode()) #endif - return SVGDocument::create(frame); + return SVGDocument::create(frame, url); } #endif if (isXMLMIMEType(type)) - return Document::create(frame); + return Document::create(frame, url); - return HTMLDocument::create(frame); + return HTMLDocument::create(frame, url); } } diff --git a/WebCore/dom/DOMImplementation.h b/WebCore/dom/DOMImplementation.h index b776d22..c3d5658 100644 --- a/WebCore/dom/DOMImplementation.h +++ b/WebCore/dom/DOMImplementation.h @@ -34,6 +34,7 @@ class Document; class DocumentType; class Frame; class HTMLDocument; +class KURL; class String; typedef int ExceptionCode; @@ -56,7 +57,7 @@ public: static PassRefPtr<HTMLDocument> createHTMLDocument(const String& title); // Other methods (not part of DOM) - static PassRefPtr<Document> createDocument(const String& MIMEType, Frame*, bool inViewSourceMode); + static PassRefPtr<Document> createDocument(const String& MIMEType, Frame*, const KURL&, bool inViewSourceMode); static bool isXMLMIMEType(const String& MIMEType); static bool isTextMIMEType(const String& MIMEType); diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index c41b87e..c9a2182 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -76,10 +76,10 @@ #include "HTMLMapElement.h" #include "HTMLNameCollection.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "HTMLStyleElement.h" #include "HTMLTitleElement.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" #include "HTTPParsers.h" #include "HistoryItem.h" #include "HitTestRequest.h" @@ -372,7 +372,7 @@ private: Document* m_document; }; -Document::Document(Frame* frame, bool isXHTML, bool isHTML) +Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) : ContainerNode(0) , m_domtree_version(0) , m_styleSheets(StyleSheetList::create(this)) @@ -431,7 +431,13 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML) m_frame = frame; +<<<<<<< HEAD #if !PLATFORM(ANDROID) +======= + if (frame || !url.isEmpty()) + setURL(url); + +>>>>>>> webkit.org at r61871 m_axObjectCache = 0; #endif @@ -1534,6 +1540,43 @@ PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem return style.release(); } +PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) +{ + RefPtr<RenderStyle> style = styleSelector()->styleForPage(pageIndex); + return style.release(); +} + +bool Document::isPageBoxVisible(int pageIndex) +{ + RefPtr<RenderStyle> style = styleForPage(pageIndex); + return style->visibility() != HIDDEN; // display property doesn't apply to @page. +} + +IntRect Document::pageAreaRectInPixels(int pageIndex) +{ + RefPtr<RenderStyle> style = styleForPage(pageIndex); + IntSize pageSize = preferredPageSizeInPixels(pageIndex); + // 100% value for margin-{left,right,top,bottom}. This is used also for top and bottom. http://www.w3.org/TR/CSS2/box.html#value-def-margin-width + int maxValue = pageSize.width(); + int surroundLeft = style->marginLeft().calcValue(maxValue) + style->borderLeft().width() + style->paddingLeft().calcValue(maxValue); + int surroundRight = style->marginRight().calcValue(maxValue) + style->borderRight().width() + style->paddingRight().calcValue(maxValue); + int surroundTop = style->marginTop().calcValue(maxValue) + style->borderTop().width() + style->paddingTop().calcValue(maxValue); + int surroundBottom = style->marginBottom().calcValue(maxValue) + style->borderBottom().width() + style->paddingBottom().calcValue(maxValue); + int width = pageSize.width() - surroundLeft - surroundRight; + int height = pageSize.height() - surroundTop - surroundBottom; + + return IntRect(surroundLeft, surroundTop, width, height); +} + +IntSize Document::preferredPageSizeInPixels(int pageIndex) +{ + RefPtr<RenderStyle> style = styleForPage(pageIndex); + LengthSize size = style->pageSize(); + ASSERT(size.width().isFixed()); + ASSERT(size.height().isFixed()); + return IntSize(size.width().calcValue(0), size.height().calcValue(0)); +} + void Document::createStyleSelector() { bool matchAuthorAndUserStyles = true; @@ -1723,7 +1766,7 @@ void Document::open(Document* ownerDocument) } if (m_frame) { - if (m_frame->loader()->isLoadingMainResource() || (parser() && parser()->executingScript())) + if (m_frame->loader()->isLoadingMainResource() || (parser() && parser()->isExecutingScript())) return; if (m_frame->loader()->state() == FrameStateProvisional) @@ -2000,12 +2043,16 @@ void Document::write(const SegmentedString& text, Document* ownerDocument) printf("Beginning a document.write at %d\n", elapsedTime()); #endif - if (!m_parser) + if (!m_parser || m_parser->finishWasCalled()) open(ownerDocument); ASSERT(m_parser); + // FIXME: forceSynchronous should always be the same as the bool passed to + // write(). However LegacyHTMLDocumentParser uses write("", false) to pump + // the parser (after running external scripts, etc.) thus necessitating a + // separate state for forceSynchronous. bool wasForcedSynchronous = false; - HTMLDocumentParser* parser = m_parser->asHTMLDocumentParser(); + LegacyHTMLDocumentParser* parser = m_parser->asHTMLDocumentParser(); if (parser) { wasForcedSynchronous = parser->forceSynchronous(); parser->setForceSynchronous(true); @@ -4630,9 +4677,8 @@ void Document::initSecurityContext() // In the common case, create the security context from the currently // loading URL. - const KURL& url = m_frame->loader()->url(); - m_cookieURL = url; - ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(url, m_frame->loader()->sandboxFlags())); + m_cookieURL = m_url; + ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(m_url, m_frame->loader()->sandboxFlags())); if (SecurityOrigin::allowSubstituteDataAccessToLocal()) { // If this document was loaded with substituteData, then the document can @@ -4790,6 +4836,17 @@ void Document::executeScriptSoon(ScriptElementData* data, CachedResourceHandle<C m_executeScriptSoonTimer.startOneShot(0); } +void Document::suspendExecuteScriptSoonTimer() +{ + m_executeScriptSoonTimer.stop(); +} + +void Document::resumeExecuteScriptSoonTimer() +{ + if (!m_scriptsToExecuteSoon.isEmpty()) + m_executeScriptSoonTimer.startOneShot(0); +} + // FF method for accessing the selection added for compatibility. DOMSelection* Document::getSelection() const { diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index 0e86df4..dc4b6ba 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -185,13 +185,13 @@ enum PageshowEventPersistence { class Document : public ContainerNode, public ScriptExecutionContext { public: - static PassRefPtr<Document> create(Frame* frame) + static PassRefPtr<Document> create(Frame* frame, const KURL& url) { - return adoptRef(new Document(frame, false, false)); + return adoptRef(new Document(frame, url, false, false)); } - static PassRefPtr<Document> createXHTML(Frame* frame) + static PassRefPtr<Document> createXHTML(Frame* frame, const KURL& url) { - return adoptRef(new Document(frame, true, false)); + return adoptRef(new Document(frame, url, true, false)); } virtual ~Document(); @@ -482,6 +482,10 @@ public: void updateLayout(); void updateLayoutIgnorePendingStylesheets(); PassRefPtr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*); + PassRefPtr<RenderStyle> styleForPage(int pageIndex); + bool isPageBoxVisible(int pageIndex); + IntRect pageAreaRectInPixels(int pageIndex); + IntSize preferredPageSizeInPixels(int pageIndex); static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function. DocLoader* docLoader() { return m_docLoader.get(); } @@ -823,6 +827,9 @@ public: void executeScriptSoon(ScriptElementData*, CachedResourceHandle<CachedScript>); + void suspendExecuteScriptSoonTimer(); + void resumeExecuteScriptSoonTimer(); + #if ENABLE(XSLT) void applyXSLTransform(ProcessingInstruction* pi); PassRefPtr<Document> transformSourceDocument() { return m_transformSourceDocument; } @@ -992,7 +999,7 @@ public: const QualifiedName& idAttributeName() const { return m_idAttributeName; } protected: - Document(Frame*, bool isXHTML, bool isHTML); + Document(Frame*, const KURL&, bool isXHTML, bool isHTML); void clearXMLVersion() { m_xmlVersion = String(); } diff --git a/WebCore/dom/DocumentFragment.cpp b/WebCore/dom/DocumentFragment.cpp index f7df8f6..7287439 100644 --- a/WebCore/dom/DocumentFragment.cpp +++ b/WebCore/dom/DocumentFragment.cpp @@ -24,12 +24,18 @@ #include "DocumentFragment.h" #include "Document.h" +#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" +#include "Page.h" +#include "Settings.h" +#include "XMLDocumentParser.h" namespace WebCore { inline DocumentFragment::DocumentFragment(Document* document) : ContainerNode(document) { + ASSERT(document); } PassRefPtr<DocumentFragment> DocumentFragment::create(Document* document) @@ -70,4 +76,22 @@ PassRefPtr<Node> DocumentFragment::cloneNode(bool deep) return clone.release(); } +bool DocumentFragment::shouldUseLegacyHTMLParser() const +{ + return document()->page() && document()->page()->settings() + && !document()->page()->settings()->html5ParserEnabled(); +} + +void DocumentFragment::parseHTML(const String& source, FragmentScriptingPermission scriptingPermission) +{ + if (shouldUseLegacyHTMLParser()) + return LegacyHTMLDocumentParser::parseDocumentFragment(source, this, scriptingPermission); + HTMLDocumentParser::parseDocumentFragment(source, this, scriptingPermission); +} + +bool DocumentFragment::parseXML(const String& source, Element* parent, FragmentScriptingPermission scriptingPermission) +{ + return parseXMLDocumentFragment(source, this, parent, scriptingPermission); +} + } diff --git a/WebCore/dom/DocumentFragment.h b/WebCore/dom/DocumentFragment.h index e624ee4..5eff17f 100644 --- a/WebCore/dom/DocumentFragment.h +++ b/WebCore/dom/DocumentFragment.h @@ -25,6 +25,7 @@ #define DocumentFragment_h #include "ContainerNode.h" +#include "FragmentScriptingPermission.h" namespace WebCore { @@ -32,9 +33,14 @@ class DocumentFragment : public ContainerNode { public: static PassRefPtr<DocumentFragment> create(Document*); + void parseHTML(const String&, FragmentScriptingPermission = FragmentScriptingAllowed); + bool parseXML(const String&, Element* parent, FragmentScriptingPermission = FragmentScriptingAllowed); + private: DocumentFragment(Document*); + bool shouldUseLegacyHTMLParser() const; + virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); diff --git a/WebCore/dom/DocumentParser.h b/WebCore/dom/DocumentParser.h index c7eea06..881136c 100644 --- a/WebCore/dom/DocumentParser.h +++ b/WebCore/dom/DocumentParser.h @@ -2,6 +2,7 @@ * Copyright (C) 2000 Peter Kelly (pmk@post.com) * Copyright (C) 2005, 2006 Apple Computer, Inc. * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2010 Google, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,64 +24,84 @@ #ifndef DocumentParser_h #define DocumentParser_h +#include <wtf/Assertions.h> + namespace WebCore { - class LegacyHTMLTreeConstructor; - class HTMLDocumentParser; - class SegmentedString; - class XSSAuditor; - - class DocumentParser : public Noncopyable { - public: - virtual ~DocumentParser() { } - - // Script output must be prepended, while new data - // received during executing a script must be appended, hence the - // extra bool to be able to distinguish between both cases. - // document.write() always uses false, while the loader uses true. - virtual void write(const SegmentedString&, bool appendData) = 0; - virtual void finish() = 0; - virtual bool isWaitingForScripts() const = 0; - virtual void stopParsing() { m_parserStopped = true; } - virtual bool processingData() const { return false; } - virtual int executingScript() const { return 0; } - - virtual bool wantsRawData() const { return false; } - virtual bool writeRawData(const char* /*data*/, int /*length*/) { return false; } - - bool inViewSourceMode() const { return m_inViewSourceMode; } - void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; } - - virtual bool wellFormed() const { return true; } - - virtual int lineNumber() const { return -1; } - virtual int columnNumber() const { return -1; } - - virtual void executeScriptsWaitingForStylesheets() {} - - virtual LegacyHTMLTreeConstructor* htmlTreeConstructor() const { return 0; } - virtual HTMLDocumentParser* asHTMLDocumentParser() { return 0; } - - XSSAuditor* xssAuditor() const { return m_XSSAuditor; } - void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; } - - protected: - DocumentParser(bool viewSourceMode = false) - : m_parserStopped(false) - , m_inViewSourceMode(viewSourceMode) - , m_XSSAuditor(0) - { - } - - // The parser has buffers, so parsing may continue even after - // it stops receiving data. We use m_parserStopped to stop the parser - // even when it has buffered data. - bool m_parserStopped; - bool m_inViewSourceMode; - - // The XSSAuditor associated with this document parser. - XSSAuditor* m_XSSAuditor; - }; +class Document; +class LegacyHTMLTreeBuilder; +class LegacyHTMLDocumentParser; +class SegmentedString; +class XSSAuditor; + +class DocumentParser : public Noncopyable { +public: + virtual ~DocumentParser() { } + + // Script output must be prepended, while new data + // received during executing a script must be appended, hence the + // extra bool to be able to distinguish between both cases. + // document.write() always uses false, while the loader uses true. + virtual void write(const SegmentedString&, bool isFromNetwork) = 0; + virtual void finish() = 0; + virtual bool finishWasCalled() = 0; + virtual bool isWaitingForScripts() const = 0; + virtual bool isExecutingScript() const { return false; } + + virtual void stopParsing() { m_parserStopped = true; } + // FIXME: processingData() is only used by DocumentLoader::isLoadingInAPISense + // and is very unclear as to what it actually means. Only LegacyHTMLDocumentParser + // actually implements it. + virtual bool processingData() const { return false; } + + virtual bool wantsRawData() const { return false; } + virtual bool writeRawData(const char* /*data*/, int /*length*/) + { + ASSERT_NOT_REACHED(); + return false; + } + + virtual bool wellFormed() const { return true; } + + virtual int lineNumber() const { return -1; } + virtual int columnNumber() const { return -1; } + + virtual void executeScriptsWaitingForStylesheets() {} + + virtual LegacyHTMLTreeBuilder* htmlTreeBuilder() const { return 0; } + virtual LegacyHTMLDocumentParser* asHTMLDocumentParser() { return 0; } + + // FIXME: view source mode is only used by the HTML and Text + // DocumentParsers and may not belong on the base-class. + bool inViewSourceMode() const { return m_inViewSourceMode; } + void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; } + + Document* document() const { return m_document; } + + XSSAuditor* xssAuditor() const { return m_XSSAuditor; } + void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; } + +protected: + DocumentParser(Document* document, bool viewSourceMode = false) + : m_parserStopped(false) + , m_inViewSourceMode(viewSourceMode) + , m_document(document) + , m_XSSAuditor(0) + { + ASSERT(document); + } + + // The parser has buffers, so parsing may continue even after + // it stops receiving data. We use m_parserStopped to stop the parser + // even when it has buffered data. + bool m_parserStopped; + bool m_inViewSourceMode; + + // Every DocumentParser needs a pointer back to the document. + Document* m_document; + // The XSSAuditor associated with this document parser. + XSSAuditor* m_XSSAuditor; +}; } // namespace WebCore diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index c1c798b..adbb720 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -4,7 +4,7 @@ * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) * (C) 2007 David Smith (catfish.man@gmail.com) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * (C) 2007 Eric Seidel (eric@webkit.org) * * This library is free software; you can redistribute it and/or @@ -42,7 +42,6 @@ #include "FrameView.h" #include "HTMLElement.h" #include "HTMLNames.h" -#include "HTMLDocumentParser.h" #include "InspectorController.h" #include "NodeList.h" #include "NodeRenderStyle.h" @@ -52,7 +51,6 @@ #include "RenderWidget.h" #include "TextIterator.h" #include "XMLNames.h" -#include "XMLDocumentParser.h" #include <wtf/text/CString.h> #if ENABLE(SVG) @@ -93,12 +91,12 @@ NodeRareData* Element::createRareData() PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission) { - RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); - + RefPtr<DocumentFragment> fragment = document()->createDocumentFragment(); + if (document()->isHTMLDocument()) - parseHTMLDocumentFragment(markup, fragment.get(), scriptingPermission); + fragment->parseHTML(markup, scriptingPermission); else { - if (!parseXMLDocumentFragment(markup, fragment.get(), this, scriptingPermission)) + if (!fragment->parseXML(markup, this, scriptingPermission)) // FIXME: We should propagate a syntax error exception out here. return 0; } @@ -189,7 +187,7 @@ void Element::setCStringAttribute(const QualifiedName& name, const char* cString void Element::setBooleanAttribute(const QualifiedName& name, bool b) { if (b) - setAttribute(name, name.localName()); + setAttribute(name, emptyAtom); else { ExceptionCode ex; removeAttribute(name, ex); @@ -639,6 +637,8 @@ void Element::updateAfterAttributeChanged(Attribute* attr) document()->axObjectCache()->contentChanged(renderer()); } else if (attrName == aria_selectedAttr) document()->axObjectCache()->selectedChildrenChanged(renderer()); + else if (attrName == aria_expandedAttr) + document()->axObjectCache()->handleAriaExpandedChange(renderer()); } void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr) @@ -1098,7 +1098,7 @@ void Element::dispatchAttrRemovalEvent(Attribute*) if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER)) return; ExceptionCode ec = 0; - dispatchEvent(new MutationEvent(DOMAttrModifiedEvent, true, false, attr, attr->value(), + dispatchEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(), attr->value(), document()->attrName(attr->id()), MutationEvent::REMOVAL), ec); #endif } @@ -1111,7 +1111,7 @@ void Element::dispatchAttrAdditionEvent(Attribute*) if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER)) return; ExceptionCode ec = 0; - dispatchEvent(new MutationEvent(DOMAttrModifiedEvent, true, false, attr, attr->value(), + dispatchEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(), attr->value(), document()->attrName(attr->id()), MutationEvent::ADDITION), ec); #endif } @@ -1531,4 +1531,39 @@ KURL Element::getURLAttribute(const QualifiedName& name) const return document()->completeURL(deprecatedParseURL(getAttribute(name))); } +int Element::getIntegralAttribute(const QualifiedName& attributeName) const +{ + return getAttribute(attributeName).string().toInt(); +} + +void Element::setIntegralAttribute(const QualifiedName& attributeName, int value) +{ + // FIXME: Need an AtomicString version of String::number. + ExceptionCode ec; + setAttribute(attributeName, String::number(value), ec); +} + +unsigned Element::getUnsignedIntegralAttribute(const QualifiedName& attributeName) const +{ + return getAttribute(attributeName).string().toUInt(); +} + +void Element::setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsigned value) +{ + // FIXME: Need an AtomicString version of String::number. + ExceptionCode ec; + setAttribute(attributeName, String::number(value), ec); +} + +#if ENABLE(SVG) +bool Element::childShouldCreateRenderer(Node* child) const +{ + // Only create renderers for SVG elements whose parents are SVG elements, or for proper <svg xmlns="svgNS"> subdocuments. + if (child->isSVGElement()) + return child->hasTagName(SVGNames::svgTag) || isSVGElement(); + + return Node::childShouldCreateRenderer(child); +} +#endif + } // namespace WebCore diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index c6eebcb..a0cf7b1 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -26,7 +26,7 @@ #define Element_h #include "Document.h" -#include "MappedAttributeEntry.h" +#include "FragmentScriptingPermission.h" #include "NamedNodeMap.h" #include "ScrollTypes.h" @@ -101,6 +101,12 @@ public: void setAttribute(const QualifiedName&, const AtomicString& value, ExceptionCode&); void removeAttribute(const QualifiedName&, ExceptionCode&); + // Typed getters and setters for language bindings. + int getIntegralAttribute(const QualifiedName& attributeName) const; + void setIntegralAttribute(const QualifiedName& attributeName, int value); + unsigned getUnsignedIntegralAttribute(const QualifiedName& attributeName) const; + void setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsigned value); + // Call this to get the value of an attribute that is known not to be the style // attribute or one of the SVG animatable attributes. bool fastHasAttribute(const QualifiedName&) const; @@ -279,6 +285,10 @@ public: virtual void dispatchFormControlChangeEvent() { } +#if ENABLE(SVG) + virtual bool childShouldCreateRenderer(Node*) const; +#endif + protected: Element(const QualifiedName& tagName, Document* document, ConstructionType type) : ContainerNode(document, type) diff --git a/WebCore/dom/ExceptionCode.cpp b/WebCore/dom/ExceptionCode.cpp index 7bb8a50..9303f9e 100644 --- a/WebCore/dom/ExceptionCode.cpp +++ b/WebCore/dom/ExceptionCode.cpp @@ -38,6 +38,10 @@ #include "XPathException.h" #endif +#if ENABLE(DATABASE) +#include "SQLException.h" +#endif + namespace WebCore { static const char* const exceptionNames[] = { @@ -145,6 +149,30 @@ static const char* const svgExceptionDescriptions[] = { }; #endif +#if ENABLE(DATABASE) +static const char* const sqlExceptionNames[] = { + "UNKNOWN_ERR", + "DATABASE_ERR", + "VERSION_ERR", + "TOO_LARGE_ERR", + "QUOTA_ERR", + "SYNTAX_ERR", + "CONSTRAINT_ERR", + "TIMEOUT_ERR" +}; + +static const char* const sqlExceptionDescriptions[] = { + "The operation failed for reasons unrelated to the database.", + "The operation failed for some reason related to the database.", + "The actual database version did not match the expected version.", + "Data returned from the database is too large.", + "Quota was exceeded.", + "Invalid or unauthorized statement; or the number of arguments did not match the number of ? placeholders.", + "A constraint was violated.", + "A transaction lock could not be acquired in a reasonable time." +}; +#endif + void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& description) { ASSERT(ec); @@ -156,7 +184,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des int nameTableSize; int nameTableOffset; ExceptionType type; - + if (code >= RangeException::RangeExceptionOffset && code <= RangeException::RangeExceptionMax) { type = RangeExceptionType; typeName = "DOM Range"; @@ -203,6 +231,16 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des nameTableSize = sizeof(svgExceptionNames) / sizeof(svgExceptionNames[0]); nameTableOffset = SVGException::SVG_WRONG_TYPE_ERR; #endif +#if ENABLE(DATABASE) + } else if (code >= SQLException::SQLExceptionOffset && code <= SQLException::SQLExceptionMax) { + type = SQLExceptionType; + typeName = "DOM SQL"; + code -= SQLException::SQLExceptionOffset; + nameTable = sqlExceptionNames; + descriptionTable = sqlExceptionDescriptions; + nameTableSize = sizeof(sqlExceptionNames) / sizeof(sqlExceptionNames[0]); + nameTableOffset = SQLException::UNKNOWN_ERR; +#endif } else { type = DOMExceptionType; typeName = "DOM"; diff --git a/WebCore/dom/ExceptionCode.h b/WebCore/dom/ExceptionCode.h index a5618f8..ef73052 100644 --- a/WebCore/dom/ExceptionCode.h +++ b/WebCore/dom/ExceptionCode.h @@ -78,8 +78,11 @@ namespace WebCore { #if ENABLE(SVG) , SVGExceptionType #endif - }; - +#if ENABLE(DATABASE) + , SQLExceptionType +#endif + }; + struct ExceptionCodeDescription { const char* typeName; // has spaces and is suitable for use in exception description strings; maximum length is 10 characters diff --git a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.h b/WebCore/dom/FragmentScriptingPermission.h index 65b9050..6371011 100644 --- a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.h +++ b/WebCore/dom/FragmentScriptingPermission.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * 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 @@ -20,27 +20,21 @@ * 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. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSWebKitCSSMatrixConstructor_h -#define JSWebKitCSSMatrixConstructor_h - -#include "JSDOMBinding.h" -#include "JSDocument.h" +#ifndef FragmentScriptingPermission_h +#define FragmentScriptingPermission_h namespace WebCore { -class JSWebKitCSSMatrixConstructor : public DOMConstructorObject { -public: - JSWebKitCSSMatrixConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - -private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } +// FIXME: This enum is poorly named. It is used to remove script contents when +// generating DocumentFragments for paste in platform/*/Pasteboard.*. +enum FragmentScriptingPermission { + FragmentScriptingAllowed, + FragmentScriptingNotAllowed, }; -} +}; -#endif // JSWebKitCSSMatrixConstructor_h +#endif // FragmentScriptingPermission_h diff --git a/WebCore/dom/InputElement.h b/WebCore/dom/InputElement.h index d477046..1d6c356 100644 --- a/WebCore/dom/InputElement.h +++ b/WebCore/dom/InputElement.h @@ -44,6 +44,9 @@ public: virtual bool isSearchField() const = 0; virtual bool isTextField() const = 0; virtual bool hasSpinButton() const { return false; } +#if ENABLE(INPUT_SPEECH) + virtual bool isSpeechEnabled() const = 0; +#endif virtual bool searchEventsShouldBeDispatched() const = 0; diff --git a/WebCore/dom/MappedAttributeEntry.h b/WebCore/dom/MappedAttributeEntry.h index ce2464e..f28f182 100644 --- a/WebCore/dom/MappedAttributeEntry.h +++ b/WebCore/dom/MappedAttributeEntry.h @@ -48,8 +48,6 @@ enum MappedAttributeEntry { , eLastEntry }; -enum FragmentScriptingPermission { FragmentScriptingAllowed, FragmentScriptingNotAllowed }; - } #endif diff --git a/WebCore/dom/MessageChannel.idl b/WebCore/dom/MessageChannel.idl index bae5b18..a3f3c94 100644 --- a/WebCore/dom/MessageChannel.idl +++ b/WebCore/dom/MessageChannel.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,7 +26,13 @@ module events { - interface [CustomConstructor, CustomMarkFunction, NoStaticTables] MessageChannel { + interface [ + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, + CustomMarkFunction, + NoStaticTables + ] MessageChannel { readonly attribute MessagePort port1; readonly attribute MessagePort port2; diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 840b967..4b25d9a 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -681,6 +681,21 @@ IntRect Node::getRect() const return renderer()->absoluteBoundingBoxRect(); return IntRect(); } + +IntRect Node::renderRect(bool* isReplaced) +{ + RenderObject* hitRenderer = this->renderer(); + ASSERT(hitRenderer); + RenderObject* renderer = hitRenderer; + while (renderer && !renderer->isBody() && !renderer->isRoot()) { + if (renderer->isRenderBlock() || renderer->isInlineBlockOrInlineTable() || renderer->isReplaced()) { + *isReplaced = renderer->isReplaced(); + return renderer->absoluteBoundingBoxRect(true); + } + renderer = renderer->parent(); + } + return IntRect(); +} bool Node::hasNonEmptyBoundingBox() const { diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index 8bf89cc..6e99cd7 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -332,6 +332,7 @@ public: virtual bool isContentRichlyEditable() const; virtual bool shouldUseInputMethod() const; virtual IntRect getRect() const; + IntRect renderRect(bool* isReplaced); // Returns true if the node has a non-empty bounding box in layout. // This does not 100% guarantee the user can see it, but is pretty close. @@ -666,7 +667,7 @@ private: void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } protected: - // CreateElementZeroRefCount is deprecated and can be removed once we convert all element + // CreateWithZeroRefCountFlag is deprecated and can be removed once we convert all element // classes to start with a reference count of 1. enum ConstructionType { CreateOther = DefaultNodeFlags, @@ -674,11 +675,9 @@ protected: CreateComment = DefaultNodeFlags | IsCommentFlag, CreateContainer = DefaultNodeFlags | IsContainerFlag, CreateElement = CreateContainer | IsElementFlag, - CreateElementZeroRefCount = IsElementFlag | CreateWithZeroRefCountFlag, CreateStyledElement = CreateElement | IsStyledElementFlag, CreateStyledElementZeroRefCount = CreateStyledElement | CreateWithZeroRefCountFlag, CreateHTMLElement = CreateStyledElement | IsHTMLFlag, - CreateHTMLElementZeroRefCount = CreateHTMLElement | CreateWithZeroRefCountFlag, CreateSVGElement = CreateStyledElement | IsSVGFlag, CreateSVGElementZeroRefCount = CreateSVGElement | CreateWithZeroRefCountFlag, }; diff --git a/WebCore/dom/NodeFilter.idl b/WebCore/dom/NodeFilter.idl index 16f3f26..40c5bad 100644 --- a/WebCore/dom/NodeFilter.idl +++ b/WebCore/dom/NodeFilter.idl @@ -21,8 +21,12 @@ module traversal { // Introduced in DOM Level 2: - interface [CustomMarkFunction, CustomNativeConverter, ObjCProtocol] NodeFilter { - + interface [ + CustomMarkFunction, + CustomNativeConverter, + ObjCProtocol, + PureInterface + ] NodeFilter { // Constants returned by acceptNode const short FILTER_ACCEPT = 1; const short FILTER_REJECT = 2; diff --git a/WebCore/dom/Position.cpp b/WebCore/dom/Position.cpp index 7861fbe..65b7261 100644 --- a/WebCore/dom/Position.cpp +++ b/WebCore/dom/Position.cpp @@ -739,7 +739,7 @@ bool Position::isCandidate() const return m_offset == 0 && !nodeIsUserSelectNone(node()->parent()); if (renderer->isText()) - return inRenderedText() && !nodeIsUserSelectNone(node()); + return !nodeIsUserSelectNone(node()) && inRenderedText(); if (isTableElement(node()) || editingIgnoresContent(node())) return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) && !nodeIsUserSelectNone(node()->parent()); diff --git a/WebCore/dom/Position.h b/WebCore/dom/Position.h index ce06f48..f606c29 100644 --- a/WebCore/dom/Position.h +++ b/WebCore/dom/Position.h @@ -234,7 +234,7 @@ inline Position positionAfterNode(Node* anchorNode) inline int lastOffsetInNode(Node* node) { - return node->offsetInCharacters() ? node->maxCharacterOffset() : node->childNodeCount(); + return node->offsetInCharacters() ? node->maxCharacterOffset() : static_cast<int>(node->childNodeCount()); } // firstPositionInNode and lastPositionInNode return parent-anchored positions, lastPositionInNode construction is O(n) due to childNodeCount() diff --git a/WebCore/dom/PositionIterator.cpp b/WebCore/dom/PositionIterator.cpp index 619e376..d2c3a3f 100644 --- a/WebCore/dom/PositionIterator.cpp +++ b/WebCore/dom/PositionIterator.cpp @@ -150,7 +150,7 @@ bool PositionIterator::isCandidate() const return !m_offsetInAnchor && !Position::nodeIsUserSelectNone(m_anchorNode->parent()); if (renderer->isText()) - return Position(*this).inRenderedText() && !Position::nodeIsUserSelectNone(m_anchorNode); + return !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).inRenderedText(); if (isTableElement(m_anchorNode) || editingIgnoresContent(m_anchorNode)) return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelectNone(m_anchorNode->parent()); diff --git a/WebCore/dom/RawDataDocumentParser.h b/WebCore/dom/RawDataDocumentParser.h new file mode 100644 index 0000000..77d148d --- /dev/null +++ b/WebCore/dom/RawDataDocumentParser.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 RawDataDocumentParser_h +#define RawDataDocumentParser_h + +#include "DocumentParser.h" + +namespace WebCore { + +// FIXME: It seems wrong that RawDataDocumentParser is a subclass of +// DocumentParser. RawDataDocumentParser, just wants to override an earlier +// version of write() before the data is decoded. Seems the decoding could +// move into the base-class DocumentParser, and then RawDataDocumentParser +// would just be short-circuting. That could simplify some of the +// DocumentWriter logic. +class RawDataDocumentParser : public DocumentParser { +public: + RawDataDocumentParser(Document* document) + : DocumentParser(document) + { + } + +protected: + virtual void finish() + { + if (!m_parserStopped) + m_document->finishedParsing(); + } + +private: + virtual void write(const SegmentedString&, bool) + { + // <https://bugs.webkit.org/show_bug.cgi?id=25397>: JS code can always call document.write, we need to handle it. + ASSERT_NOT_REACHED(); + } + + virtual bool finishWasCalled() + { + // finish() always calls document()->finishedParsing() so we will be + // deleted after finish(). + return false; + } + + virtual bool isWaitingForScripts() const { return false; } + + virtual bool wantsRawData() const { return true; } + virtual bool writeRawData(const char*, int) { return false; } +}; + +}; + +#endif // RawDataDocumentParser_h diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp index 0ac0846..518aead 100644 --- a/WebCore/dom/ScriptElement.cpp +++ b/WebCore/dom/ScriptElement.cpp @@ -305,6 +305,20 @@ String ScriptElementData::scriptContent() const return String::adopt(val); } +bool ScriptElementData::isAsynchronous() const +{ + // Only external scripts may be asynchronous. + // See: http://dev.w3.org/html5/spec/Overview.html#attr-script-async + return !m_scriptElement->sourceAttributeValue().isEmpty() && m_scriptElement->asyncAttributeValue(); +} + +bool ScriptElementData::isDeferred() const +{ + // Only external scripts may be deferred and async trumps defer to allow for backward compatibility. + // See: http://dev.w3.org/html5/spec/Overview.html#attr-script-defer + return !m_scriptElement->sourceAttributeValue().isEmpty() && !m_scriptElement->asyncAttributeValue() && m_scriptElement->deferAttributeValue(); +} + ScriptElement* toScriptElement(Element* element) { if (element->isHTMLElement() && element->hasTagName(HTMLNames::scriptTag)) diff --git a/WebCore/dom/ScriptElement.h b/WebCore/dom/ScriptElement.h index 8cc84fc..c663e43 100644 --- a/WebCore/dom/ScriptElement.h +++ b/WebCore/dom/ScriptElement.h @@ -44,6 +44,8 @@ public: virtual String languageAttributeValue() const = 0; virtual String forAttributeValue() const = 0; virtual String eventAttributeValue() const = 0; + virtual bool asyncAttributeValue() const = 0; + virtual bool deferAttributeValue() const = 0; virtual void dispatchLoadEvent() = 0; virtual void dispatchErrorEvent() = 0; @@ -74,6 +76,8 @@ public: String scriptContent() const; String scriptCharset() const; + bool isAsynchronous() const; + bool isDeferred() const; Element* element() const { return m_element; } bool createdByParser() const { return m_createdByParser; } diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp index c7052b3..43e6e28 100644 --- a/WebCore/dom/SelectElement.cpp +++ b/WebCore/dom/SelectElement.cpp @@ -342,8 +342,13 @@ void SelectElement::setSelectedIndex(SelectElementData& data, Element* element, data.setUserDrivenChange(userDrivenChange); if (fireOnChangeNow) menuListOnChange(data, element); - if (RenderMenuList* menuList = toRenderMenuList(element->renderer())) - menuList->didSetSelectedIndex(); + RenderObject* renderer = element->renderer(); + if (renderer) { + if (data.usesMenuList()) + toRenderMenuList(renderer)->didSetSelectedIndex(); + else if (renderer->isListBox()) + toRenderListBox(renderer)->selectionChanged(); + } } if (Frame* frame = element->document()->frame()) diff --git a/WebCore/dom/StaticHashSetNodeList.cpp b/WebCore/dom/StaticHashSetNodeList.cpp new file mode 100644 index 0000000..d641cb5 --- /dev/null +++ b/WebCore/dom/StaticHashSetNodeList.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 Antonio Gomes <tonikitoo@webkit.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "StaticHashSetNodeList.h" + +#include "Element.h" + +namespace WebCore { + +unsigned StaticHashSetNodeList::length() const +{ + return m_nodes.size(); +} + +Node* StaticHashSetNodeList::item(unsigned index) const +{ + if (index < (unsigned) m_nodes.size()) { + ListHashSet<RefPtr<Node> >::const_iterator it = m_nodes.begin(); + for (unsigned count = 0; count < index; ++it, ++count) { } + return (*it).get(); + } + + return 0; +} + +Node* StaticHashSetNodeList::itemWithName(const AtomicString& elementId) const +{ + ListHashSet<RefPtr<Node> >::const_iterator it = m_nodes.begin(); + ListHashSet<RefPtr<Node> >::const_iterator end = m_nodes.end(); + for ( ; it != end ; ++it) { + Node* node = (*it).get(); + if (node->hasID() && static_cast<Element*>(node)->getIdAttribute() == elementId) + return node; + } + + return 0; +} + +} // namespace WebCore diff --git a/WebCore/dom/StaticHashSetNodeList.h b/WebCore/dom/StaticHashSetNodeList.h new file mode 100644 index 0000000..e954493 --- /dev/null +++ b/WebCore/dom/StaticHashSetNodeList.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 Antonio Gomes <tonikitoo@webkit.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 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. + */ + +#ifndef StaticHashSetNodeList_h +#define StaticHashSetNodeList_h + +#include "NodeList.h" +#include <wtf/ListHashSet.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class Node; + +class StaticHashSetNodeList : public NodeList { +public: + // Adopts the contents of the nodes ListHashSet. + static PassRefPtr<StaticHashSetNodeList> adopt(const ListHashSet<RefPtr<Node> >& nodes) + { + return adopt(const_cast<ListHashSet<RefPtr<Node> >&>(nodes)); + } + + static PassRefPtr<StaticHashSetNodeList> adopt(ListHashSet<RefPtr<Node> >& nodes) + { + return adoptRef(new StaticHashSetNodeList(nodes)); + } + + virtual unsigned length() const; + virtual Node* item(unsigned index) const; + virtual Node* itemWithName(const AtomicString&) const; + +private: + StaticHashSetNodeList(ListHashSet<RefPtr<Node> >& nodes) + { + m_nodes.swap(nodes); + } + + ListHashSet<RefPtr<Node> > m_nodes; +}; + +} // namespace WebCore + +#endif // StaticHashSetNodeList_h diff --git a/WebCore/dom/Touch.h b/WebCore/dom/Touch.h index ceb8ae7..54e85a5 100644 --- a/WebCore/dom/Touch.h +++ b/WebCore/dom/Touch.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TOUCH_H_ -#define TOUCH_H_ +#ifndef Touch_h +#define Touch_h #if ENABLE(TOUCH_EVENTS) @@ -72,4 +72,4 @@ private: #endif // ENABLE(TOUCH_EVENTS) -#endif /* TOUCH_H_ */ +#endif /* Touch_h */ diff --git a/WebCore/dom/TouchList.h b/WebCore/dom/TouchList.h index 61350b0..2546955 100644 --- a/WebCore/dom/TouchList.h +++ b/WebCore/dom/TouchList.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TOUCHLIST_H_ -#define TOUCHLIST_H_ +#ifndef TouchList_h +#define TouchList_h #if ENABLE(TOUCH_EVENTS) @@ -57,4 +57,4 @@ private: #endif // ENABLE(TOUCH_EVENTS) -#endif /* TOUCHLIST_H_ */ +#endif /* TouchList_h */ diff --git a/WebCore/dom/XMLDocumentParser.cpp b/WebCore/dom/XMLDocumentParser.cpp index 987e9b1..ab02bb3 100644 --- a/WebCore/dom/XMLDocumentParser.cpp +++ b/WebCore/dom/XMLDocumentParser.cpp @@ -72,10 +72,7 @@ const int maxErrors = 25; #if ENABLE(WML) bool XMLDocumentParser::isWMLDocument() const { - if (m_doc) - return m_doc->isWMLDocument(); - - return false; + return document()->isWMLDocument(); } #endif @@ -83,7 +80,7 @@ void XMLDocumentParser::pushCurrentNode(Node* n) { ASSERT(n); ASSERT(m_currentNode); - if (n != m_doc) + if (n != document()) n->ref(); m_currentNodeStack.append(m_currentNode); m_currentNode = n; @@ -97,7 +94,7 @@ void XMLDocumentParser::popCurrentNode() return; ASSERT(m_currentNodeStack.size()); - if (m_currentNode != m_doc) + if (m_currentNode != document()) m_currentNode->deref(); m_currentNode = m_currentNodeStack.last(); @@ -106,14 +103,14 @@ void XMLDocumentParser::popCurrentNode() void XMLDocumentParser::clearCurrentNodeStack() { - if (m_currentNode && m_currentNode != m_doc) + if (m_currentNode && m_currentNode != document()) m_currentNode->deref(); m_currentNode = 0; if (m_currentNodeStack.size()) { // Aborted parsing. for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) m_currentNodeStack[i]->deref(); - if (m_currentNodeStack[0] && m_currentNodeStack[0] != m_doc) + if (m_currentNodeStack[0] && m_currentNodeStack[0] != document()) m_currentNodeStack[0]->deref(); m_currentNodeStack.clear(); } @@ -169,7 +166,7 @@ bool XMLDocumentParser::enterText() #if !USE(QXMLSTREAM) ASSERT(m_bufferedText.size() == 0); #endif - RefPtr<Node> newNode = Text::create(m_doc, ""); + RefPtr<Node> newNode = Text::create(document(), ""); if (!m_currentNode->addChild(newNode.get())) return false; pushCurrentNode(newNode.get()); @@ -217,12 +214,12 @@ void XMLDocumentParser::end() insertErrorMessageBlock(); else { exitText(); - m_doc->updateStyleSelector(); + document()->updateStyleSelector(); } clearCurrentNodeStack(); if (!m_parsingFragment) - m_doc->finishedParsing(); + document()->finishedParsing(); } void XMLDocumentParser::finish() @@ -233,6 +230,11 @@ void XMLDocumentParser::finish() end(); } +bool XMLDocumentParser::finishWasCalled() +{ + return m_finishCalled; +} + static inline RefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages) { RefPtr<Element> reportElement = doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), false); @@ -267,7 +269,7 @@ void XMLDocumentParser::insertErrorMessageBlock() // Create elements for display ExceptionCode ec = 0; - Document* doc = m_doc; + Document* doc = document(); Node* documentElement = doc->documentElement(); if (!documentElement) { RefPtr<Node> rootElement = doc->createElement(htmlTag, false); diff --git a/WebCore/dom/XMLDocumentParser.h b/WebCore/dom/XMLDocumentParser.h index bc10415..9915409 100644 --- a/WebCore/dom/XMLDocumentParser.h +++ b/WebCore/dom/XMLDocumentParser.h @@ -22,8 +22,8 @@ * */ -#ifndef XMLTokenizer_h -#define XMLTokenizer_h +#ifndef XMLDocumentParser_h +#define XMLDocumentParser_h #if USE(EXPAT) @@ -136,10 +136,10 @@ bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent #include "CachedResourceClient.h" #include "CachedResourceHandle.h" -#include "MappedAttributeEntry.h" #include "SegmentedString.h" #include "StringHash.h" #include "DocumentParser.h" +#include "FragmentScriptingPermission.h" #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> @@ -185,18 +185,9 @@ namespace WebCore { XMLDocumentParser(DocumentFragment*, Element*, FragmentScriptingPermission); ~XMLDocumentParser(); + // Exposed for callbacks: enum ErrorType { warning, nonFatal, fatal }; - - // from DocumentParser - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool isWaitingForScripts() const; - virtual void stopParsing(); - - void end(); - - void pauseParsing(); - void resumeParsing(); + void handleError(ErrorType, const char* message, int lineNumber, int columnNumber); void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; } bool isXHTMLDocument() const { return m_isXHTMLDocument; } @@ -208,16 +199,24 @@ namespace WebCore { bool isWMLDocument() const; #endif - // from CachedResourceClient - virtual void notifyFinished(CachedResource* finishedObj); - + private: + // From DocumentParser + virtual void write(const SegmentedString&, bool appendData); + virtual void finish(); + virtual bool finishWasCalled(); + virtual bool isWaitingForScripts() const; + virtual void stopParsing(); + virtual bool wellFormed() const { return !m_sawError; } + virtual int lineNumber() const; + virtual int columnNumber() const; - void handleError(ErrorType type, const char* m, int lineNumber, int columnNumber); + // from CachedResourceClient + virtual void notifyFinished(CachedResource*); - virtual bool wellFormed() const { return !m_sawError; } + void end(); - int lineNumber() const; - int columnNumber() const; + void pauseParsing(); + void resumeParsing(); #if USE(QXMLSTREAM) private: @@ -264,7 +263,6 @@ public: void doWrite(const String&); void doEnd(); - Document* m_doc; FrameView* m_view; String m_originalSourceForTransform; @@ -321,6 +319,10 @@ bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent } // namespace WebCore +<<<<<<< HEAD #endif // USE(EXPAT) #endif // XMLTokenizer_h +======= +#endif // XMLDocumentParser_h +>>>>>>> webkit.org at r61871 diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp index 2a1bac6..33b0a09 100644 --- a/WebCore/dom/XMLDocumentParserLibxml2.cpp +++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp @@ -38,13 +38,12 @@ #include "FrameView.h" #include "HTMLLinkElement.h" #include "HTMLStyleElement.h" -#include "HTMLDocumentParser.h" // for decodeNamedEntity +#include "LegacyHTMLDocumentParser.h" // for decodeNamedEntity #include "ProcessingInstruction.h" #include "ResourceError.h" #include "ResourceHandle.h" #include "ResourceRequest.h" #include "ResourceResponse.h" -#include "ScriptController.h" #include "ScriptElement.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" @@ -523,12 +522,12 @@ PassRefPtr<XMLParserContext> XMLParserContext::createMemoryParser(xmlSAXHandlerP // -------------------------------- -XMLDocumentParser::XMLDocumentParser(Document* _doc, FrameView* _view) - : m_doc(_doc) - , m_view(_view) +XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView) + : DocumentParser(document) + , m_view(frameView) , m_context(0) , m_pendingCallbacks(new PendingCallbacks) - , m_currentNode(_doc) + , m_currentNode(document) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -551,7 +550,7 @@ XMLDocumentParser::XMLDocumentParser(Document* _doc, FrameView* _view) } XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parentElement, FragmentScriptingPermission scriptingPermission) - : m_doc(fragment->document()) + : DocumentParser(fragment->document()) , m_view(0) , m_context(0) , m_pendingCallbacks(new PendingCallbacks) @@ -576,8 +575,6 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent , m_scriptingPermission(scriptingPermission) { fragment->ref(); - if (m_doc) - m_doc->ref(); // Add namespaces based on the parent node Vector<Element*> elemStack; @@ -620,8 +617,6 @@ XMLParserContext::~XMLParserContext() XMLDocumentParser::~XMLDocumentParser() { clearCurrentNodeStack(); - if (m_parsingFragment && m_doc) - m_doc->deref(); if (m_pendingScript) m_pendingScript->removeClient(this); } @@ -644,11 +639,11 @@ void XMLDocumentParser::doWrite(const String& parseString) const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); xmlSwitchEncoding(context->context(), BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE); - XMLDocumentParserScope scope(m_doc->docLoader()); + XMLDocumentParserScope scope(document()->docLoader()); xmlParseChunk(context->context(), reinterpret_cast<const char*>(parseString.characters()), sizeof(UChar) * parseString.length(), 0); } - if (m_doc->decoder() && m_doc->decoder()->sawError()) { + if (document()->decoder() && document()->decoder()->sawError()) { // If the decoder saw an error, report it as fatal (stops parsing) handleError(fatal, "Encoding error", context->context()->input->line, context->context()->input->col); } @@ -729,7 +724,7 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha #if ENABLE(XHTMLMP) // check if the DOCTYPE Declaration of XHTMLMP document exists - if (!m_hasDocTypeDeclaration && m_doc->isXHTMLMPDocument()) { + if (!m_hasDocTypeDeclaration && document()->isXHTMLMPDocument()) { handleError(fatal, "DOCTYPE declaration lost.", lineNumber(), columnNumber()); return; } @@ -770,7 +765,7 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha m_sawFirstElement = true; QualifiedName qName(prefix, localName, uri); - RefPtr<Element> newElement = m_doc->createElement(qName, true); + RefPtr<Element> newElement = document()->createElement(qName, true); if (!newElement) { stopParsing(); return; @@ -783,19 +778,12 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha return; } - ScriptController* jsProxy = m_doc->frame() ? m_doc->frame()->script() : 0; - if (jsProxy && m_doc->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) - jsProxy->setEventHandlerLineNumber(lineNumber()); - handleElementAttributes(newElement.get(), libxmlAttributes, nb_attributes, ec, m_scriptingPermission); if (ec) { stopParsing(); return; } - if (jsProxy) - jsProxy->setEventHandlerLineNumber(0); - newElement->beginParsingChildren(); ScriptElement* scriptElement = toScriptElement(newElement.get()); @@ -811,8 +799,8 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha if (m_view && !newElement->attached()) newElement->attach(); - if (!m_parsingFragment && isFirstElement && m_doc->frame()) - m_doc->frame()->loader()->dispatchDocumentElementAvailable(); + if (!m_parsingFragment && isFirstElement && document()->frame()) + document()->frame()->loader()->dispatchDocumentElementAvailable(); } void XMLDocumentParser::endElementNs() @@ -863,7 +851,7 @@ void XMLDocumentParser::endElementNs() #if ENABLE(XHTMLMP) if (!scriptElement->shouldExecuteAsJavaScript()) - m_doc->setShouldProcessNoscriptElement(true); + document()->setShouldProcessNoscriptElement(true); else #endif { @@ -872,7 +860,7 @@ void XMLDocumentParser::endElementNs() // we have a src attribute String scriptCharset = scriptElement->scriptCharset(); if (element->dispatchBeforeLoadEvent(scriptHref) && - (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { + (m_pendingScript = document()->docLoader()->requestScript(scriptHref, scriptCharset))) { m_scriptElement = element; m_pendingScript->addClient(this); @@ -882,7 +870,7 @@ void XMLDocumentParser::endElementNs() } else m_scriptElement = 0; } else - m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); + m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStartLine)); } m_requestingScript = false; popCurrentNode(); @@ -940,7 +928,7 @@ void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlCh // ### handle exceptions int exception = 0; - RefPtr<ProcessingInstruction> pi = m_doc->createProcessingInstruction( + RefPtr<ProcessingInstruction> pi = document()->createProcessingInstruction( toString(target), toString(data), exception); if (exception) return; @@ -956,7 +944,7 @@ void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlCh #if ENABLE(XSLT) m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); - if (m_sawXSLTransform && !m_doc->transformSourceDocument()) + if (m_sawXSLTransform && !document()->transformSourceDocument()) stopParsing(); #endif } @@ -973,7 +961,7 @@ void XMLDocumentParser::cdataBlock(const xmlChar* s, int len) exitText(); - RefPtr<Node> newNode = CDATASection::create(m_doc, toString(s, len)); + RefPtr<Node> newNode = CDATASection::create(document(), toString(s, len)); if (!m_currentNode->addChild(newNode.get())) return; if (m_view && !newNode->attached()) @@ -992,7 +980,7 @@ void XMLDocumentParser::comment(const xmlChar* s) exitText(); - RefPtr<Node> newNode = Comment::create(m_doc, toString(s)); + RefPtr<Node> newNode = Comment::create(document(), toString(s)); m_currentNode->addChild(newNode.get()); if (m_view && !newNode->attached()) newNode->attach(); @@ -1003,10 +991,10 @@ void XMLDocumentParser::startDocument(const xmlChar* version, const xmlChar* enc ExceptionCode ec = 0; if (version) - m_doc->setXMLVersion(toString(version), ec); - m_doc->setXMLStandalone(standalone == 1, ec); // possible values are 0, 1, and -1 + document()->setXMLVersion(toString(version), ec); + document()->setXMLStandalone(standalone == 1, ec); // possible values are 0, 1, and -1 if (encoding) - m_doc->setXMLEncoding(toString(encoding)); + document()->setXMLEncoding(toString(encoding)); } void XMLDocumentParser::endDocument() @@ -1027,7 +1015,7 @@ void XMLDocumentParser::internalSubset(const xmlChar* name, const xmlChar* exter return; } - if (m_doc) { + if (document()) { #if ENABLE(WML) || ENABLE(XHTMLMP) String extId = toString(externalID); #endif @@ -1048,7 +1036,7 @@ void XMLDocumentParser::internalSubset(const xmlChar* name, const xmlChar* exter return; } - if (m_doc->isXHTMLMPDocument()) + if (document()->isXHTMLMPDocument()) setIsXHTMLMPDocument(true); else setIsXHTMLDocument(true); @@ -1057,7 +1045,7 @@ void XMLDocumentParser::internalSubset(const xmlChar* name, const xmlChar* exter } #endif - m_doc->addChild(DocumentType::create(m_doc, toString(name), toString(externalID), toString(systemID))); + document()->addChild(DocumentType::create(document(), toString(name), toString(externalID), toString(systemID))); } } @@ -1283,7 +1271,7 @@ void XMLDocumentParser::initializeParserContext(const char* chunk) m_sawXSLTransform = false; m_sawFirstElement = false; - XMLDocumentParserScope scope(m_doc->docLoader()); + XMLDocumentParserScope scope(document()->docLoader()); if (m_parsingFragment) m_context = XMLParserContext::createMemoryParser(&sax, this, chunk); else @@ -1294,12 +1282,12 @@ void XMLDocumentParser::doEnd() { #if ENABLE(XSLT) if (m_sawXSLTransform) { - void* doc = xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url().string()); - m_doc->setTransformSource(new TransformSource(doc)); + void* doc = xmlDocPtrForString(document()->docLoader(), m_originalSourceForTransform, document()->url().string()); + document()->setTransformSource(new TransformSource(doc)); - m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. - m_doc->updateStyleSelector(); - m_doc->setParsing(true); + document()->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. + document()->updateStyleSelector(); + document()->setParsing(true); m_parserStopped = true; } #endif @@ -1310,7 +1298,7 @@ void XMLDocumentParser::doEnd() if (m_context) { // Tell libxml we're done. { - XMLDocumentParserScope scope(m_doc->docLoader()); + XMLDocumentParserScope scope(document()->docLoader()); xmlParseChunk(context(), 0, 0, 1); } @@ -1383,6 +1371,8 @@ void XMLDocumentParser::resumeParsing() end(); } +// FIXME: This method should be possible to implement using the DocumentParser +// API, instead of needing to grab at libxml2 state directly. bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent, FragmentScriptingPermission scriptingPermission) { if (!chunk.length()) diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp index 89f542f..3b657f1 100644 --- a/WebCore/dom/XMLDocumentParserQt.cpp +++ b/WebCore/dom/XMLDocumentParserQt.cpp @@ -38,7 +38,7 @@ #include "FrameView.h" #include "HTMLLinkElement.h" #include "HTMLStyleElement.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" #include "ProcessingInstruction.h" #include "ResourceError.h" #include "ResourceHandle.h" @@ -77,11 +77,11 @@ QString EntityResolver::resolveUndeclaredEntity(const QString &name) // -------------------------------- -XMLDocumentParser::XMLDocumentParser(Document* _doc, FrameView* _view) - : m_doc(_doc) - , m_view(_view) +XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView) + : DocumentParser(document) + , m_view(frameView) , m_wroteText(false) - , m_currentNode(_doc) + , m_currentNode(document) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -105,7 +105,7 @@ XMLDocumentParser::XMLDocumentParser(Document* _doc, FrameView* _view) } XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parentElement, FragmentScriptingPermission permission) - : m_doc(fragment->document()) + : DocumentParser(fragment->document()) , m_view(0) , m_wroteText(false) , m_currentNode(fragment) @@ -129,8 +129,6 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent , m_scriptingPermission(permission) { fragment->ref(); - if (m_doc) - m_doc->ref(); // Add namespaces based on the parent node Vector<Element*> elemStack; @@ -169,8 +167,6 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent XMLDocumentParser::~XMLDocumentParser() { clearCurrentNodeStack(); - if (m_parsingFragment && m_doc) - m_doc->deref(); if (m_pendingScript) m_pendingScript->removeClient(this); delete m_stream.entityResolver(); @@ -180,7 +176,7 @@ void XMLDocumentParser::doWrite(const String& parseString) { m_wroteText = true; - if (m_doc->decoder() && m_doc->decoder()->sawError()) { + if (document()->decoder() && document()->decoder()->sawError()) { // If the decoder saw an error, report it as fatal (stops parsing) handleError(fatal, "Encoding error", lineNumber(), columnNumber()); return; @@ -207,10 +203,10 @@ void XMLDocumentParser::doEnd() { #if ENABLE(XSLT) if (m_sawXSLTransform) { - m_doc->setTransformSource(new TransformSource(m_originalSourceForTransform)); - m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. - m_doc->updateStyleSelector(); - m_doc->setParsing(true); + document()->setTransformSource(new TransformSource(m_originalSourceForTransform)); + document()->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. + document()->updateStyleSelector(); + document()->setParsing(true); m_parserStopped = true; } #endif @@ -365,7 +361,7 @@ void XMLDocumentParser::parse() break; case QXmlStreamReader::StartElement: { #if ENABLE(XHTMLMP) - if (m_doc->isXHTMLMPDocument() && !m_hasDocTypeDeclaration) { + if (document()->isXHTMLMPDocument() && !m_hasDocTypeDeclaration) { handleError(fatal, "DOCTYPE declaration lost.", lineNumber(), columnNumber()); break; } @@ -444,14 +440,14 @@ void XMLDocumentParser::startDocument() ExceptionCode ec = 0; if (!m_parsingFragment) { - m_doc->setXMLStandalone(m_stream.isStandaloneDocument(), ec); + document()->setXMLStandalone(m_stream.isStandaloneDocument(), ec); QStringRef version = m_stream.documentVersion(); if (!version.isEmpty()) - m_doc->setXMLVersion(version, ec); + document()->setXMLVersion(version, ec); QStringRef encoding = m_stream.documentEncoding(); if (!encoding.isEmpty()) - m_doc->setXMLEncoding(encoding); + document()->setXMLEncoding(encoding); } } @@ -475,7 +471,7 @@ void XMLDocumentParser::parseStartElement() } QualifiedName qName(prefix, localName, uri); - RefPtr<Element> newElement = m_doc->createElement(qName, true); + RefPtr<Element> newElement = document()->createElement(qName, true); if (!newElement) { stopParsing(); return; @@ -529,8 +525,8 @@ void XMLDocumentParser::parseStartElement() if (m_view && !newElement->attached()) newElement->attach(); - if (isFirstElement && m_doc->frame()) - m_doc->frame()->loader()->dispatchDocumentElementAvailable(); + if (isFirstElement && document()->frame()) + document()->frame()->loader()->dispatchDocumentElementAvailable(); } void XMLDocumentParser::parseEndElement() @@ -574,7 +570,7 @@ void XMLDocumentParser::parseEndElement() #if ENABLE(XHTMLMP) if (!scriptElement->shouldExecuteAsJavaScript()) - m_doc->setShouldProcessNoscriptElement(true); + document()->setShouldProcessNoscriptElement(true); else #endif { @@ -583,7 +579,7 @@ void XMLDocumentParser::parseEndElement() // we have a src attribute String scriptCharset = scriptElement->scriptCharset(); if (element->dispatchBeforeLoadEvent(scriptHref) && - (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { + (m_pendingScript = document()->docLoader()->requestScript(scriptHref, scriptCharset))) { m_scriptElement = element; m_pendingScript->addClient(this); @@ -593,7 +589,7 @@ void XMLDocumentParser::parseEndElement() } else m_scriptElement = 0; } else - m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); + m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStartLine)); } m_requestingScript = false; popCurrentNode(); @@ -613,7 +609,7 @@ void XMLDocumentParser::parseProcessingInstruction() // ### handle exceptions int exception = 0; - RefPtr<ProcessingInstruction> pi = m_doc->createProcessingInstruction( + RefPtr<ProcessingInstruction> pi = document()->createProcessingInstruction( m_stream.processingInstructionTarget(), m_stream.processingInstructionData(), exception); if (exception) @@ -630,7 +626,7 @@ void XMLDocumentParser::parseProcessingInstruction() #if ENABLE(XSLT) m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); - if (m_sawXSLTransform && !m_doc->transformSourceDocument()) + if (m_sawXSLTransform && !document()->transformSourceDocument()) stopParsing(); #endif } @@ -639,7 +635,7 @@ void XMLDocumentParser::parseCdata() { exitText(); - RefPtr<Node> newNode = CDATASection::create(m_doc, m_stream.text()); + RefPtr<Node> newNode = CDATASection::create(document(), m_stream.text()); if (!m_currentNode->addChild(newNode.get())) return; if (m_view && !newNode->attached()) @@ -650,7 +646,7 @@ void XMLDocumentParser::parseComment() { exitText(); - RefPtr<Node> newNode = Comment::create(m_doc, m_stream.text()); + RefPtr<Node> newNode = Comment::create(document(), m_stream.text()); m_currentNode->addChild(newNode.get()); if (m_view && !newNode->attached()) newNode->attach(); @@ -695,14 +691,14 @@ void XMLDocumentParser::parseDtd() return; } - if (m_doc->isXHTMLMPDocument()) // check if the MIME type is correct with this method + if (document()->isXHTMLMPDocument()) // check if the MIME type is correct with this method setIsXHTMLMPDocument(true); else setIsXHTMLDocument(true); } #endif #if ENABLE(WML) - else if (m_doc->isWMLDocument() + else if (document()->isWMLDocument() && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.3//EN") && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.2//EN") && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.1//EN") @@ -710,7 +706,7 @@ void XMLDocumentParser::parseDtd() handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()); #endif if (!m_parsingFragment) - m_doc->addChild(DocumentType::create(m_doc, name, publicId, systemId)); + document()->addChild(DocumentType::create(document(), name, publicId, systemId)); } } diff --git a/WebCore/dom/XMLDocumentParserScope.h b/WebCore/dom/XMLDocumentParserScope.h index 89740d2..bdf629d 100644 --- a/WebCore/dom/XMLDocumentParserScope.h +++ b/WebCore/dom/XMLDocumentParserScope.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef XMLTokenizerScope_h -#define XMLTokenizerScope_h +#ifndef XMLDocumentParserScope_h +#define XMLDocumentParserScope_h #include <wtf/Noncopyable.h> @@ -59,4 +59,4 @@ namespace WebCore { } // namespace WebCore -#endif // XMLTokenizerScope_h +#endif // XMLDocumentParserScope_h diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp index e33f143..41d6758 100644 --- a/WebCore/editing/CompositeEditCommand.cpp +++ b/WebCore/editing/CompositeEditCommand.cpp @@ -558,7 +558,7 @@ void CompositeEditCommand::deleteInsignificantText(const Position& start, const if (node->isTextNode()) { Text* textNode = static_cast<Text*>(node); int startOffset = node == start.node() ? start.deprecatedEditingOffset() : 0; - int endOffset = node == end.node() ? end.deprecatedEditingOffset() : textNode->length(); + int endOffset = node == end.node() ? end.deprecatedEditingOffset() : static_cast<int>(textNode->length()); deleteInsignificantText(textNode, startOffset, endOffset); } if (node == end.node()) diff --git a/WebCore/editing/DeleteButton.cpp b/WebCore/editing/DeleteButton.cpp index a5aaea2..91991cf 100644 --- a/WebCore/editing/DeleteButton.cpp +++ b/WebCore/editing/DeleteButton.cpp @@ -45,7 +45,7 @@ inline DeleteButton::DeleteButton(Document* document) PassRefPtr<DeleteButton> DeleteButton::create(Document* document) { - return new DeleteButton(document); + return adoptRef(new DeleteButton(document)); } void DeleteButton::defaultEventHandler(Event* event) diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp index 8ae1313..773ed90 100644 --- a/WebCore/editing/Editor.cpp +++ b/WebCore/editing/Editor.cpp @@ -884,7 +884,7 @@ void Editor::appliedEditing(PassRefPtr<EditCommand> cmd) VisibleSelection newSelection(cmd->endingSelection()); // Don't clear the typing style with this selection change. We do those things elsewhere if necessary. - changeSelectionAfterCommand(newSelection, false, false, cmd.get()); + changeSelectionAfterCommand(newSelection, false, false); if (!cmd->preservesTypingStyle()) m_frame->setTypingStyle(0); @@ -909,7 +909,7 @@ void Editor::unappliedEditing(PassRefPtr<EditCommand> cmd) dispatchEditableContentChangedEvents(*cmd); VisibleSelection newSelection(cmd->startingSelection()); - changeSelectionAfterCommand(newSelection, true, true, cmd.get()); + changeSelectionAfterCommand(newSelection, true, true); m_lastEditCommand = 0; if (client()) @@ -924,7 +924,7 @@ void Editor::reappliedEditing(PassRefPtr<EditCommand> cmd) dispatchEditableContentChangedEvents(*cmd); VisibleSelection newSelection(cmd->endingSelection()); - changeSelectionAfterCommand(newSelection, true, true, cmd.get()); + changeSelectionAfterCommand(newSelection, true, true); m_lastEditCommand = 0; if (client()) @@ -2870,7 +2870,7 @@ PassRefPtr<Range> Editor::nextVisibleRange(Range* currentRange, const String& ta return lastVisibleRange(target, caseFlag); } -void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle, EditCommand* cmd) +void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle) { // If there is no selection change, don't bother sending shouldChangeSelection, but still call setSelection, // because there is work that it must do in this situation. @@ -2880,14 +2880,14 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, b if (selectionDidNotChangeDOMPosition || m_frame->shouldChangeSelection(newSelection)) m_frame->selection()->setSelection(newSelection, closeTyping, clearTypingStyle); - // Some kinds of deletes and line break insertions change the selection's position within the document without - // changing its position within the DOM. For example when you press return in the following (the caret is marked by ^): + // Some editing operations change the selection visually without affecting its position within the DOM. + // For example when you press return in the following (the caret is marked by ^): // <div contentEditable="true"><div>^Hello</div></div> // WebCore inserts <div><br></div> *before* the current block, which correctly moves the paragraph down but which doesn't // change the caret's DOM position (["hello", 0]). In these situations the above SelectionController::setSelection call // does not call EditorClient::respondToChangedSelection(), which, on the Mac, sends selection change notifications and // starts a new kill ring sequence, but we want to do these things (matches AppKit). - if (selectionDidNotChangeDOMPosition && cmd->isTypingCommand()) + if (selectionDidNotChangeDOMPosition) client()->respondToChangedSelection(); } diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h index 3e223dc..cd1b204 100644 --- a/WebCore/editing/Editor.h +++ b/WebCore/editing/Editor.h @@ -324,7 +324,7 @@ private: PassRefPtr<Range> firstVisibleRange(const String&, bool caseFlag); PassRefPtr<Range> lastVisibleRange(const String&, bool caseFlag); - void changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle, EditCommand*); + void changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle); }; inline void Editor::setStartNewKillRingSequence(bool flag) diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 6bd75d6..0fc0068 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -898,6 +898,12 @@ static bool executePasteAndMatchStyle(Frame* frame, Event*, EditorCommandSource, return true; } +static bool executePasteAsPlainText(Frame* frame, Event*, EditorCommandSource, const String&) +{ + frame->editor()->pasteAsPlainText(); + return true; +} + static bool executePrint(Frame* frame, Event*, EditorCommandSource, const String&) { Page* page = frame->page(); @@ -1419,6 +1425,7 @@ static const CommandMap& createCommandMap() { "Outdent", { executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, { "PasteAndMatchStyle", { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, + { "PasteAsPlainText", { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, { "Print", { executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "Redo", { executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "RemoveFormat", { executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, diff --git a/WebCore/editing/InsertListCommand.cpp b/WebCore/editing/InsertListCommand.cpp index 07b612f..0f7dc77 100644 --- a/WebCore/editing/InsertListCommand.cpp +++ b/WebCore/editing/InsertListCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,7 +39,7 @@ using namespace HTMLNames; PassRefPtr<HTMLElement> InsertListCommand::insertList(Document* document, Type type) { - RefPtr<InsertListCommand> insertCommand = new InsertListCommand(document, type); + RefPtr<InsertListCommand> insertCommand = create(document, type); insertCommand->apply(); return insertCommand->m_listElement; } diff --git a/WebCore/editing/ModifySelectionListLevel.cpp b/WebCore/editing/ModifySelectionListLevel.cpp index 9a7e105..3e6754e 100644 --- a/WebCore/editing/ModifySelectionListLevel.cpp +++ b/WebCore/editing/ModifySelectionListLevel.cpp @@ -209,28 +209,28 @@ bool IncreaseSelectionListLevelCommand::canIncreaseSelectionListLevel(Document* return canIncreaseListLevel(document->frame()->selection()->selection(), startListChild, endListChild); } -PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevelWithType(Document* document, Type listType) +PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevel(Document* document, Type type) { ASSERT(document); ASSERT(document->frame()); - RefPtr<IncreaseSelectionListLevelCommand> modCommand = new IncreaseSelectionListLevelCommand(document, listType); - modCommand->apply(); - return modCommand->m_listElement; + RefPtr<IncreaseSelectionListLevelCommand> command = create(document, type); + command->apply(); + return command->m_listElement.release(); } PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevel(Document* document) { - return increaseSelectionListLevelWithType(document, InheritedListType); + return increaseSelectionListLevel(document, InheritedListType); } PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered(Document* document) { - return increaseSelectionListLevelWithType(document, OrderedList); + return increaseSelectionListLevel(document, OrderedList); } PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered(Document* document) { - return increaseSelectionListLevelWithType(document, UnorderedList); + return increaseSelectionListLevel(document, UnorderedList); } DecreaseSelectionListLevelCommand::DecreaseSelectionListLevelCommand(Document* document) @@ -289,7 +289,7 @@ void DecreaseSelectionListLevelCommand::decreaseSelectionListLevel(Document* doc { ASSERT(document); ASSERT(document->frame()); - applyCommand(new DecreaseSelectionListLevelCommand(document)); + applyCommand(create(document)); } } diff --git a/WebCore/editing/ModifySelectionListLevel.h b/WebCore/editing/ModifySelectionListLevel.h index 39efff8..feefa91 100644 --- a/WebCore/editing/ModifySelectionListLevel.h +++ b/WebCore/editing/ModifySelectionListLevel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,9 +55,15 @@ public: private: enum Type { InheritedListType, OrderedList, UnorderedList }; - static PassRefPtr<Node> increaseSelectionListLevelWithType(Document*, Type listType); + static PassRefPtr<Node> increaseSelectionListLevel(Document*, Type); + static PassRefPtr<IncreaseSelectionListLevelCommand> create(Document* document, Type type) + { + return adoptRef(new IncreaseSelectionListLevelCommand(document, type)); + } + IncreaseSelectionListLevelCommand(Document*, Type); + virtual void doApply(); Type m_listType; @@ -71,7 +77,13 @@ public: static void decreaseSelectionListLevel(Document*); private: + static PassRefPtr<DecreaseSelectionListLevelCommand> create(Document* document) + { + return adoptRef(new DecreaseSelectionListLevelCommand(document)); + } + DecreaseSelectionListLevelCommand(Document*); + virtual void doApply(); }; diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp index ca18bc1..b17ab10 100644 --- a/WebCore/editing/SelectionController.cpp +++ b/WebCore/editing/SelectionController.cpp @@ -131,7 +131,7 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at SelectionController::setSelection // if document->frame() == m_frame we can get into an infinite loop - if (document && document->frame() != m_frame && document != m_frame->document()) { + if (document && document->frame() && document->frame() != m_frame && document != m_frame->document()) { document->frame()->selection()->setSelection(s, closeTyping, clearTypingStyle, userTriggered); return; } diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index 17f5680..dcb53d6 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -392,7 +392,7 @@ static void removeExteriorStyles(CSSMutableStyleDeclaration* style) enum RangeFullySelectsNode { DoesFullySelectNode, DoesNotFullySelectNode }; -static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Range* range, EAnnotateForInterchange annotate, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) +static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) { if (namespaces) namespaces->checkConsistency(); @@ -468,9 +468,14 @@ static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Ran result.append('='); - if (el->isURLAttribute(attr)) - appendQuotedURLAttributeValue(result, attr->value()); - else { + if (el->isURLAttribute(attr)) { + // We don't want to complete file:/// URLs because it may contain sensitive information + // about the user's system. + if (absoluteURLs == AbsoluteURLs && !node->document()->url().isLocalFile()) + appendQuotedURLAttributeValue(result, node->document()->completeURL(attr->value()).string()); + else + appendQuotedURLAttributeValue(result, attr->value().string()); + } else { result.append('\"'); appendAttributeValue(result, attr->value(), documentIsHTML); result.append('\"'); @@ -550,10 +555,10 @@ static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Ran } } -static String getStartMarkup(const Node* node, const Range* range, EAnnotateForInterchange annotate, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) +static String getStartMarkup(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) { Vector<UChar> result; - appendStartMarkup(result, node, range, annotate, convertBlocksToInlines, namespaces, rangeFullySelectsNode); + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, namespaces, rangeFullySelectsNode); return String::adopt(result); } @@ -608,7 +613,7 @@ public: { } - void appendMarkup(Node* startNode, EChildrenOnly, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0); + void appendMarkup(Node* startNode, EChildrenOnly, EAbsoluteURLs, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0); String takeResult() { return String::adopt(m_result); } @@ -619,7 +624,7 @@ private: }; // FIXME: Would be nice to do this in a non-recursive way. -void MarkupAccumulator::appendMarkup(Node* startNode, EChildrenOnly childrenOnly, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces) +void MarkupAccumulator::appendMarkup(Node* startNode, EChildrenOnly childrenOnly, EAbsoluteURLs absoluteURLs, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces) { if (startNode == m_nodeToSkip) return; @@ -632,13 +637,13 @@ void MarkupAccumulator::appendMarkup(Node* startNode, EChildrenOnly childrenOnly if (!childrenOnly) { if (m_nodes) m_nodes->append(startNode); - appendStartMarkup(m_result, startNode, 0, DoNotAnnotateForInterchange, false, &namespaceHash); + appendStartMarkup(m_result, startNode, 0, DoNotAnnotateForInterchange, absoluteURLs, false, &namespaceHash); } // children if (!(startNode->document()->isHTMLDocument() && doesHTMLForbidEndTag(startNode))) { for (Node* current = startNode->firstChild(); current; current = current->nextSibling()) - appendMarkup(current, IncludeNode, &namespaceHash); + appendMarkup(current, IncludeNode, absoluteURLs, &namespaceHash); } // end tag @@ -789,7 +794,7 @@ static void addStyleMarkup(Vector<String>& preMarkups, Vector<String>& postMarku // FIXME: Shouldn't we omit style info when annotate == DoNotAnnotateForInterchange? // FIXME: At least, annotation and style info should probably not be included in range.markupString() -String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterchange annotate, bool convertBlocksToInlines) +String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterchange annotate, bool convertBlocksToInlines, EAbsoluteURLs absoluteURLs) { DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\"" AppleInterchangeNewline "\">")); @@ -878,7 +883,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc // Add the node to the markup. if (addMarkupForNode) { - markups.append(getStartMarkup(n, updatedRange.get(), annotate)); + markups.append(getStartMarkup(n, updatedRange.get(), annotate, absoluteURLs)); if (nodes) nodes->append(n); } @@ -915,7 +920,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc continue; // or b) ancestors that we never encountered during a pre-order traversal starting at startNode: ASSERT(startNode->isDescendantOf(parent)); - preMarkups.append(getStartMarkup(parent, updatedRange.get(), annotate)); + preMarkups.append(getStartMarkup(parent, updatedRange.get(), annotate, absoluteURLs)); markups.append(getEndMarkup(parent)); if (nodes) nodes->append(parent); @@ -1001,7 +1006,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc } else { // Since this node and all the other ancestors are not in the selection we want to set RangeFullySelectsNode to DoesNotFullySelectNode // so that styles that affect the exterior of the node are not included. - preMarkups.append(getStartMarkup(ancestor, updatedRange.get(), annotate, convertBlocksToInlines, 0, DoesNotFullySelectNode)); + preMarkups.append(getStartMarkup(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, 0, DoesNotFullySelectNode)); markups.append(getEndMarkup(ancestor)); } if (nodes) @@ -1067,7 +1072,7 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const return fragment.release(); } -String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* nodes) +String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* nodes, EAbsoluteURLs absoluteURLs) { if (!node) return ""; @@ -1080,7 +1085,7 @@ String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* } MarkupAccumulator accumulator(deleteButtonContainerElement, nodes); - accumulator.appendMarkup(const_cast<Node*>(node), childrenOnly); + accumulator.appendMarkup(const_cast<Node*>(node), childrenOnly, absoluteURLs); return accumulator.takeResult(); } diff --git a/WebCore/editing/markup.h b/WebCore/editing/markup.h index dd34159..5428097 100644 --- a/WebCore/editing/markup.h +++ b/WebCore/editing/markup.h @@ -26,8 +26,8 @@ #ifndef markup_h #define markup_h +#include "FragmentScriptingPermission.h" #include "HTMLInterchange.h" -#include "MappedAttributeEntry.h" #include <wtf/Forward.h> #include <wtf/Vector.h> @@ -41,6 +41,7 @@ namespace WebCore { class String; enum EChildrenOnly { IncludeNode, ChildrenOnly }; + enum EAbsoluteURLs { DoNotResolveURLs, AbsoluteURLs }; PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text); PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = FragmentScriptingAllowed); @@ -49,8 +50,8 @@ namespace WebCore { bool isPlainTextMarkup(Node *node); String createMarkup(const Range*, - Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false); - String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0); + Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs); + String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs); String createFullMarkup(const Node*); String createFullMarkup(const Range*); diff --git a/WebCore/history/CachedFrame.cpp b/WebCore/history/CachedFrame.cpp index 8881066..0be6710 100644 --- a/WebCore/history/CachedFrame.cpp +++ b/WebCore/history/CachedFrame.cpp @@ -129,9 +129,10 @@ CachedFrame::CachedFrame(Frame* frame) // Custom scrollbar renderers will get reattached when the document comes out of the page cache m_view->detachCustomScrollbars(); - m_document->documentWillBecomeInactive(); + m_document->documentWillBecomeInactive(); frame->clearTimers(); m_document->setInPageCache(true); + frame->loader()->stopLoading(UnloadEventPolicyUnloadAndPageHide); frame->loader()->client()->savePlatformDataToCachedFrame(this); diff --git a/WebCore/history/HistoryItem.cpp b/WebCore/history/HistoryItem.cpp index 03aa450..3ee423b 100644 --- a/WebCore/history/HistoryItem.cpp +++ b/WebCore/history/HistoryItem.cpp @@ -37,7 +37,7 @@ namespace WebCore { -static long long generateDocumentSequenceNumber() +static long long generateSequenceNumber() { // Initialize to the current time to reduce the likelihood of generating // identifiers that overlap with those from past/future browser sessions. @@ -57,7 +57,8 @@ HistoryItem::HistoryItem() , m_lastVisitWasFailure(false) , m_isTargetItem(false) , m_visitCount(0) - , m_documentSequenceNumber(generateDocumentSequenceNumber()) + , m_itemSequenceNumber(generateSequenceNumber()) + , m_documentSequenceNumber(generateSequenceNumber()) { } @@ -70,7 +71,8 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, double ti , m_lastVisitWasFailure(false) , m_isTargetItem(false) , m_visitCount(0) - , m_documentSequenceNumber(generateDocumentSequenceNumber()) + , m_itemSequenceNumber(generateSequenceNumber()) + , m_documentSequenceNumber(generateSequenceNumber()) { iconDatabase()->retainIconForPageURL(m_urlString); } @@ -85,7 +87,8 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, const Str , m_lastVisitWasFailure(false) , m_isTargetItem(false) , m_visitCount(0) - , m_documentSequenceNumber(generateDocumentSequenceNumber()) + , m_itemSequenceNumber(generateSequenceNumber()) + , m_documentSequenceNumber(generateSequenceNumber()) { iconDatabase()->retainIconForPageURL(m_urlString); } @@ -101,7 +104,8 @@ HistoryItem::HistoryItem(const KURL& url, const String& target, const String& pa , m_lastVisitWasFailure(false) , m_isTargetItem(false) , m_visitCount(0) - , m_documentSequenceNumber(generateDocumentSequenceNumber()) + , m_itemSequenceNumber(generateSequenceNumber()) + , m_documentSequenceNumber(generateSequenceNumber()) { iconDatabase()->retainIconForPageURL(m_urlString); } @@ -133,7 +137,8 @@ inline HistoryItem::HistoryItem(const HistoryItem& item) , m_visitCount(item.m_visitCount) , m_dailyVisitCounts(item.m_dailyVisitCounts) , m_weeklyVisitCounts(item.m_weeklyVisitCounts) - , m_documentSequenceNumber(generateDocumentSequenceNumber()) + , m_itemSequenceNumber(item.m_itemSequenceNumber) + , m_documentSequenceNumber(item.m_documentSequenceNumber) , m_formContentType(item.m_formContentType) { if (item.m_formData) diff --git a/WebCore/history/HistoryItem.h b/WebCore/history/HistoryItem.h index ee8c0c8..ef73c5e 100644 --- a/WebCore/history/HistoryItem.h +++ b/WebCore/history/HistoryItem.h @@ -136,6 +136,9 @@ public: void setStateObject(PassRefPtr<SerializedScriptValue> object); SerializedScriptValue* stateObject() const { return m_stateObject.get(); } + void setItemSequenceNumber(long long number) { m_itemSequenceNumber = number; } + long long itemSequenceNumber() const { return m_itemSequenceNumber; } + void setDocumentSequenceNumber(long long number) { m_documentSequenceNumber = number; } long long documentSequenceNumber() const { return m_documentSequenceNumber; } @@ -242,6 +245,8 @@ private: OwnPtr<Vector<String> > m_redirectURLs; + long long m_itemSequenceNumber; + // Support for HTML5 History RefPtr<SerializedScriptValue> m_stateObject; long long m_documentSequenceNumber; diff --git a/WebCore/history/PageCache.cpp b/WebCore/history/PageCache.cpp index 72fca86..7719187 100644 --- a/WebCore/history/PageCache.cpp +++ b/WebCore/history/PageCache.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "FrameLoaderStateMachine.h" #include "HistoryItem.h" #include "Logging.h" #include "Page.h" @@ -77,7 +78,7 @@ static void pageCacheLog(const String& prefix, const String& message) static bool logCanCacheFrameDecision(Frame* frame, int indentLevel) { // Only bother logging for frames that have actually loaded and have content. - if (frame->loader()->creatingInitialEmptyDocument()) + if (frame->loader()->stateMachine()->creatingInitialEmptyDocument()) return false; KURL currentURL = frame->loader()->documentLoader() ? frame->loader()->documentLoader()->url() : KURL(); if (currentURL.isEmpty()) @@ -102,7 +103,7 @@ static bool logCanCacheFrameDecision(Frame* frame, int indentLevel) PCLOG(" -Main document has an error"); cannotCache = true; } - if (frame->loader()->containsPlugins()) { + if (frame->loader()->subframeLoader()->containsPlugins()) { PCLOG(" -Frame contains plugins"); cannotCache = true; } @@ -175,7 +176,7 @@ static bool logCanCacheFrameDecision(Frame* frame, int indentLevel) static void logCanCachePageDecision(Page* page) { // Only bother logging for main frames that have actually loaded and have content. - if (page->mainFrame()->loader()->creatingInitialEmptyDocument()) + if (page->mainFrame()->loader()->stateMachine()->creatingInitialEmptyDocument()) return; KURL currentURL = page->mainFrame()->loader()->documentLoader() ? page->mainFrame()->loader()->documentLoader()->url() : KURL(); if (currentURL.isEmpty()) @@ -246,7 +247,7 @@ bool PageCache::canCachePageContainingThisFrame(Frame* frame) // (objects created by the plug-in). Since there is no way to pause/resume a Netscape plug-in, // they would need to be destroyed and then recreated, and there is no way that we can recreate // the right NPObjects. See <rdar://problem/5197041> for more information. - && !frame->loader()->containsPlugins() + && !frame->loader()->subframeLoader()->containsPlugins() && !frame->loader()->url().protocolIs("https") && (!frame->domWindow() || !frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) #if ENABLE(DATABASE) diff --git a/WebCore/html/AsyncImageResizer.h b/WebCore/html/AsyncImageResizer.h index 3eeeead..add070a 100644 --- a/WebCore/html/AsyncImageResizer.h +++ b/WebCore/html/AsyncImageResizer.h @@ -35,6 +35,7 @@ #include "Blob.h" #include "CachedResourceClient.h" +#include "IntSize.h" #include "ScriptValue.h" namespace WebCore { diff --git a/WebCore/html/Blob.cpp b/WebCore/html/Blob.cpp index 0546f1c..baf3d49 100644 --- a/WebCore/html/Blob.cpp +++ b/WebCore/html/Blob.cpp @@ -36,10 +36,17 @@ namespace WebCore { +Blob::Blob(const String& type, const BlobItemList& items) + : m_type(type) +{ + for (size_t i = 0; i < items.size(); ++i) + m_items.append(items[i]); +} + Blob::Blob(const String& path) { // Note: this doesn't initialize the type unlike File(path). - append(FileBlobItem::create(path)); + m_items.append(FileBlobItem::create(path)); } unsigned long long Blob::size() const @@ -58,13 +65,8 @@ const String& Blob::path() const return m_items[0]->toFileBlobItem()->path(); } -void Blob::append(PassRefPtr<BlobItem> item) -{ - m_items.append(item); -} - #if ENABLE(BLOB_SLICE) -PassRefPtr<Blob> Blob::slice(long long start, long long length) const +PassRefPtr<Blob> Blob::slice(long long start, long long length, const String& contentType) const { if (start < 0) start = 0; @@ -80,15 +82,15 @@ PassRefPtr<Blob> Blob::slice(long long start, long long length) const length = totalSize - start; size_t i = 0; - RefPtr<Blob> blob = Blob::create(); + BlobItemList items; for (; i < m_items.size() && static_cast<unsigned long long>(start) >= m_items[i]->size(); ++i) start -= m_items[i]->size(); for (; length > 0 && i < m_items.size(); ++i) { - blob->m_items.append(m_items[i]->slice(start, length)); - length -= blob->m_items.last()->size(); + items.append(m_items[i]->slice(start, length)); + length -= items.last()->size(); start = 0; } - return blob.release(); + return Blob::create(contentType, items); } #endif // ENABLE(BLOB_SLICE) diff --git a/WebCore/html/Blob.h b/WebCore/html/Blob.h index 39177b5..ad6c7a6 100644 --- a/WebCore/html/Blob.h +++ b/WebCore/html/Blob.h @@ -41,9 +41,9 @@ namespace WebCore { class Blob : public RefCounted<Blob> { public: - static PassRefPtr<Blob> create() + static PassRefPtr<Blob> create(const String& type, const BlobItemList& items) { - return adoptRef(new Blob()); + return adoptRef(new Blob(type, items)); } // FIXME: Deprecated method. This is called only from @@ -63,15 +63,14 @@ public: // FIXME: Deprecated method. const String& path() const; - void append(PassRefPtr<BlobItem>); const BlobItemList& items() const { return m_items; } #if ENABLE(BLOB_SLICE) - PassRefPtr<Blob> slice(long long start, long long length) const; + PassRefPtr<Blob> slice(long long start, long long length, const String& contentType = String()) const; #endif protected: - Blob() { } + Blob(const String& type, const BlobItemList&); // FIXME: Deprecated constructor. See also the comment for Blob::create(path). Blob(const String& path); diff --git a/WebCore/html/Blob.idl b/WebCore/html/Blob.idl index 8db6064..0ae2759 100644 --- a/WebCore/html/Blob.idl +++ b/WebCore/html/Blob.idl @@ -32,9 +32,10 @@ module html { interface Blob { readonly attribute unsigned long long size; - + readonly attribute DOMString type; + #if defined(ENABLE_BLOB_SLICE) && ENABLE_BLOB_SLICE - Blob slice(in long long start, in long long length); + Blob slice(in long long start, in long long length, in [Optional, ConvertUndefinedOrNullToNullString] DOMString contentType); #endif }; diff --git a/WebCore/html/BlobBuilder.cpp b/WebCore/html/BlobBuilder.cpp new file mode 100644 index 0000000..cda1568 --- /dev/null +++ b/WebCore/html/BlobBuilder.cpp @@ -0,0 +1,90 @@ +/* + * 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. + */ + +#include "config.h" + +#include "BlobBuilder.h" + +#include "AtomicString.h" +#include "Blob.h" +#include "ExceptionCode.h" +#include "TextEncoding.h" + +namespace WebCore { + +static bool getLineEndingTypeFromString(const AtomicString& typeString, LineEnding& endingType) +{ + DEFINE_STATIC_LOCAL(AtomicString, transparent, ("transparent")); + DEFINE_STATIC_LOCAL(AtomicString, native, ("native")); + + if (typeString.isEmpty() || typeString == transparent) { + endingType = EndingTransparent; + return true; + } + if (typeString == native) { + endingType = EndingNative; + return true; + } + return false; +} + +bool BlobBuilder::append(const String& text, const String& type, ExceptionCode& ec) +{ + ec = 0; + LineEnding endingType; + if (!getLineEndingTypeFromString(type, endingType)) { + ec = SYNTAX_ERR; + return false; + } + m_items.append(StringBlobItem::create(text, endingType, UTF8Encoding())); + return true; +} + +bool BlobBuilder::append(const String& text, ExceptionCode& ec) +{ + return append(text, String(), ec); +} + +bool BlobBuilder::append(PassRefPtr<Blob> blob) +{ + if (blob) { + for (size_t i = 0; i < blob->items().size(); ++i) + m_items.append(blob->items()[i]); + return true; + } + return false; +} + +PassRefPtr<Blob> BlobBuilder::getBlob(const String& contentType) const +{ + return Blob::create(contentType, m_items); +} + +} // namespace WebCore diff --git a/WebCore/html/BlobBuilder.h b/WebCore/html/BlobBuilder.h new file mode 100644 index 0000000..1173c04 --- /dev/null +++ b/WebCore/html/BlobBuilder.h @@ -0,0 +1,60 @@ +/* + * 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. + */ + +#ifndef BlobBuilder_h +#define BlobBuilder_h + +#include "BlobItem.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Blob; + +typedef int ExceptionCode; + +class BlobBuilder : public RefCounted<BlobBuilder> { +public: + static PassRefPtr<BlobBuilder> create() { return adoptRef(new BlobBuilder()); } + + bool append(PassRefPtr<Blob>); + bool append(const String& text, ExceptionCode&); + bool append(const String& text, const String& ending, ExceptionCode&); + + PassRefPtr<Blob> getBlob(const String& contentType = String()) const; + +private: + BlobItemList m_items; +}; + +} // namespace WebCore + +#endif // BlobBuilder_h diff --git a/WebCore/html/BlobBuilder.idl b/WebCore/html/BlobBuilder.idl new file mode 100644 index 0000000..93cb87f --- /dev/null +++ b/WebCore/html/BlobBuilder.idl @@ -0,0 +1,43 @@ +/* + * 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. + */ + +module html { + interface [ + CanBeConstructed, + GenerateNativeConverter, + NoStaticTables + ] BlobBuilder { + Blob getBlob(in [Optional, ConvertUndefinedOrNullToNullString] DOMString contentType); + void append(in Blob blob); + void append(in DOMString value, in [Optional, ConvertUndefinedOrNullToNullString] DOMString endings) raises (DOMException); + }; + +} + diff --git a/WebCore/html/CSSPreloadScanner.cpp b/WebCore/html/CSSPreloadScanner.cpp new file mode 100644 index 0000000..729103e --- /dev/null +++ b/WebCore/html/CSSPreloadScanner.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ + * Copyright (C) 2010 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CSSPreloadScanner.h" + +#include "CSSHelper.h" +#include "CachedCSSStyleSheet.h" +#include "DocLoader.h" +#include "Document.h" +#include "HTMLToken.h" + +namespace WebCore { + +static inline bool isWhitespace(UChar c) +{ + return c == ' ' || c == '\n' || c == '\r' || c == '\t'; +} + +CSSPreloadScanner::CSSPreloadScanner(Document* document) + : m_document(document) +{ + reset(); +} + +void CSSPreloadScanner::reset() +{ + m_state = Initial; + m_rule.clear(); + m_ruleValue.clear(); +} + +void CSSPreloadScanner::scan(const HTMLToken& token, bool scanningBody) +{ + m_scanningBody = scanningBody; + + const HTMLToken::DataVector& characters = token.characters(); + for (HTMLToken::DataVector::const_iterator iter = characters.begin(); + iter != characters.end(); ++iter) { + tokenize(*iter); + } +} + +inline void CSSPreloadScanner::tokenize(UChar c) +{ + // We are just interested in @import rules, no need for real tokenization here + // Searching for other types of resources is probably low payoff. + switch (m_state) { + case Initial: + if (c == '@') + m_state = RuleStart; + else if (c == '/') + m_state = MaybeComment; + break; + case MaybeComment: + if (c == '*') + m_state = Comment; + else + m_state = Initial; + break; + case Comment: + if (c == '*') + m_state = MaybeCommentEnd; + break; + case MaybeCommentEnd: + if (c == '/') + m_state = Initial; + else if (c == '*') + ; + else + m_state = Comment; + break; + case RuleStart: + if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { + m_rule.clear(); + m_ruleValue.clear(); + m_rule.append(c); + m_state = Rule; + } else + m_state = Initial; + break; + case Rule: + if (isWhitespace(c)) + m_state = AfterRule; + else if (c == ';') + m_state = Initial; + else + m_rule.append(c); + break; + case AfterRule: + if (isWhitespace(c)) + ; + else if (c == ';') + m_state = Initial; + else { + m_state = RuleValue; + m_ruleValue.append(c); + } + break; + case RuleValue: + if (isWhitespace(c)) + m_state = AfterRuleValue; + else if (c == ';') { + emitRule(); + m_state = Initial; + } else + m_ruleValue.append(c); + break; + case AfterRuleValue: + if (isWhitespace(c)) + ; + else if (c == ';') { + emitRule(); + m_state = Initial; + } else { + // FIXME: media rules + m_state = Initial; + } + break; + } +} + +void CSSPreloadScanner::emitRule() +{ + String rule(m_rule.data(), m_rule.size()); + if (equalIgnoringCase(rule, "import") && !m_ruleValue.isEmpty()) { + String value(m_ruleValue.data(), m_ruleValue.size()); + String url = deprecatedParseURL(value); + if (!url.isEmpty()) + m_document->docLoader()->preload(CachedResource::CSSStyleSheet, url, String(), m_scanningBody); + } + m_rule.clear(); + m_ruleValue.clear(); +} + +} diff --git a/WebCore/html/CSSPreloadScanner.h b/WebCore/html/CSSPreloadScanner.h new file mode 100644 index 0000000..7ac282f --- /dev/null +++ b/WebCore/html/CSSPreloadScanner.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2010 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 CSSPreloadScanner_h +#define CSSPreloadScanner_h + +#include "PlatformString.h" +#include <wtf/Vector.h> + +namespace WebCore { + +class Document; +class HTMLToken; + +class CSSPreloadScanner : public Noncopyable { +public: + CSSPreloadScanner(Document*); + + void reset(); + void scan(const HTMLToken&, bool scanningBody); + +private: + enum State { + Initial, + MaybeComment, + Comment, + MaybeCommentEnd, + RuleStart, + Rule, + AfterRule, + RuleValue, + AfterRuleValue + }; + + inline void tokenize(UChar c); + void emitRule(); + + State m_state; + Vector<UChar, 16> m_rule; + Vector<UChar> m_ruleValue; + + bool m_scanningBody; + Document* m_document; +}; + +} + +#endif diff --git a/WebCore/html/File.idl b/WebCore/html/File.idl index 94287ff..2632a4d 100644 --- a/WebCore/html/File.idl +++ b/WebCore/html/File.idl @@ -30,7 +30,6 @@ module html { GenerateToJS ] File : Blob { readonly attribute DOMString name; - readonly attribute DOMString type; // FIXME: obsolete attributes. To be removed. readonly attribute DOMString fileName; diff --git a/WebCore/html/HTML5DocumentParser.cpp b/WebCore/html/HTML5DocumentParser.cpp deleted file mode 100644 index 28df14e..0000000 --- a/WebCore/html/HTML5DocumentParser.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (C) 2010 Google, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "HTML5DocumentParser.h" - -#include "Element.h" -#include "Frame.h" -#include "HTML5Lexer.h" -#include "HTML5ScriptRunner.h" -#include "HTML5TreeBuilder.h" -#include "HTMLDocument.h" -#include "Node.h" -#include "NotImplemented.h" -#include "XSSAuditor.h" - -#if ENABLE(INSPECTOR) -#include "InspectorTimelineAgent.h" -#endif - -namespace WebCore { - -namespace { - -class NestingLevelIncrementer : public Noncopyable { -public: - NestingLevelIncrementer(int& counter) - : m_counter(&counter) - { - ++(*m_counter); - } - - ~NestingLevelIncrementer() - { - --(*m_counter); - } - -private: - int* m_counter; -}; - -} // namespace - -HTML5DocumentParser::HTML5DocumentParser(HTMLDocument* document, bool reportErrors) - : DocumentParser() - , m_document(document) - , m_lexer(new HTML5Lexer) - , m_scriptRunner(new HTML5ScriptRunner(document, this)) - , m_treeConstructor(new HTML5TreeBuilder(m_lexer.get(), document, reportErrors)) - , m_endWasDelayed(false) - , m_writeNestingLevel(0) -{ - begin(); -} - -HTML5DocumentParser::~HTML5DocumentParser() -{ - // FIXME: We'd like to ASSERT that normal operation of this class clears - // out any delayed actions, but we can't because we're unceremoniously - // deleted. If there were a required call to some sort of cancel function, - // then we could ASSERT some invariants here. -} - -void HTML5DocumentParser::begin() -{ - // FIXME: Should we reset the lexer? -} - -void HTML5DocumentParser::pumpLexerIfPossible() -{ - if (m_parserStopped || m_treeConstructor->isPaused()) - return; - pumpLexer(); -} - -void HTML5DocumentParser::pumpLexer() -{ - // We tell the InspectorTimelineAgent about every pump, even if we - // end up pumping nothing. It can filter out empty pumps itself. - willPumpLexer(); - - ASSERT(!m_parserStopped); - ASSERT(!m_treeConstructor->isPaused()); - while (!m_parserStopped && m_lexer->nextToken(m_input.current(), m_token)) { - if (ScriptController* scriptController = script()) - scriptController->setEventHandlerLineNumber(lineNumber() + 1); - - m_treeConstructor->constructTreeFromToken(m_token); - m_token.clear(); - - if (ScriptController* scriptController = script()) - scriptController->setEventHandlerLineNumber(0); - - if (!m_treeConstructor->isPaused()) - continue; - - // The parser will pause itself when waiting on a script to load or run. - // ScriptRunner executes scripts at the right times and handles reentrancy. - int scriptStartLine = 0; - RefPtr<Element> scriptElement = m_treeConstructor->takeScriptToProcess(scriptStartLine); - bool shouldContinueParsing = m_scriptRunner->execute(scriptElement.release(), scriptStartLine); - m_treeConstructor->setPaused(!shouldContinueParsing); - if (!shouldContinueParsing) - return; - } - - didPumpLexer(); -} - -void HTML5DocumentParser::willPumpLexer() -{ -#if ENABLE(INSPECTOR) - // FIXME: m_input.current().length() is only accurate if we - // end up parsing the whole buffer in this pump. We should pass how - // much we parsed as part of didWriteHTML instead of willWriteHTML. - if (InspectorTimelineAgent* timelineAgent = m_document->inspectorTimelineAgent()) - timelineAgent->willWriteHTML(m_input.current().length(), m_lexer->lineNumber()); -#endif -} - -void HTML5DocumentParser::didPumpLexer() -{ -#if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_document->inspectorTimelineAgent()) - timelineAgent->didWriteHTML(m_lexer->lineNumber()); -#endif -} - -void HTML5DocumentParser::write(const SegmentedString& source, bool appendData) -{ - if (m_parserStopped) - return; - - NestingLevelIncrementer nestingLevelIncrementer(m_writeNestingLevel); - - if (appendData) { - m_input.appendToEnd(source); - if (m_writeNestingLevel > 1) { - // We've gotten data off the network in a nested call to write(). - // We don't want to consume any more of the input stream now. Do - // not worry. We'll consume this data in a less-nested write(). - return; - } - } else - m_input.insertAtCurrentInsertionPoint(source); - - pumpLexerIfPossible(); - endIfDelayed(); -} - -void HTML5DocumentParser::end() -{ - pumpLexerIfPossible(); - // Informs the the rest of WebCore that parsing is really finished. - m_treeConstructor->finished(); -} - -void HTML5DocumentParser::attemptToEnd() -{ - // finish() indicates we will not receive any more data. If we are waiting on - // an external script to load, we can't finish parsing quite yet. - - if (inWrite() || isWaitingForScripts() || executingScript()) { - m_endWasDelayed = true; - return; - } - end(); -} - -void HTML5DocumentParser::endIfDelayed() -{ - if (!m_endWasDelayed || isWaitingForScripts() || executingScript()) - return; - - m_endWasDelayed = false; - end(); -} - -void HTML5DocumentParser::finish() -{ - // We're not going to get any more data off the network, so we close the - // input stream to indicate EOF. - m_input.close(); - attemptToEnd(); -} - -int HTML5DocumentParser::executingScript() const -{ - return m_scriptRunner->inScriptExecution(); -} - -int HTML5DocumentParser::lineNumber() const -{ - return m_lexer->lineNumber(); -} - -int HTML5DocumentParser::columnNumber() const -{ - return m_lexer->columnNumber(); -} - -LegacyHTMLTreeConstructor* HTML5DocumentParser::htmlTreeConstructor() const -{ - return m_treeConstructor->legacyTreeConstructor(); -} - -bool HTML5DocumentParser::isWaitingForScripts() const -{ - return m_treeConstructor->isPaused(); -} - -void HTML5DocumentParser::resumeParsingAfterScriptExecution() -{ - ASSERT(!m_scriptRunner->inScriptExecution()); - ASSERT(!m_treeConstructor->isPaused()); - pumpLexerIfPossible(); - - // The document already finished parsing we were just waiting on scripts when finished() was called. - endIfDelayed(); -} - -void HTML5DocumentParser::watchForLoad(CachedResource* cachedScript) -{ - ASSERT(!cachedScript->isLoaded()); - // addClient would call notifyFinished if the load were complete. - // Callers do not expect to be re-entered from this call, so they should - // not an already-loaded CachedResource. - cachedScript->addClient(this); -} - -void HTML5DocumentParser::stopWatchingForLoad(CachedResource* cachedScript) -{ - cachedScript->removeClient(this); -} - -bool HTML5DocumentParser::shouldLoadExternalScriptFromSrc(const AtomicString& srcValue) -{ - if (!m_XSSAuditor) - return true; - return m_XSSAuditor->canLoadExternalScriptFromSrc(srcValue); -} - -void HTML5DocumentParser::executeScript(const ScriptSourceCode& sourceCode) -{ - ASSERT(m_scriptRunner->inScriptExecution()); - if (!m_document->frame()) - return; - InsertionPointRecord savedInsertionPoint(m_input); - m_document->frame()->script()->executeScript(sourceCode); -} - -void HTML5DocumentParser::notifyFinished(CachedResource* cachedResource) -{ - ASSERT(!m_scriptRunner->inScriptExecution()); - ASSERT(m_treeConstructor->isPaused()); - // Note: We only ever wait on one script at a time, so we always know this - // is the one we were waiting on and can un-pause the tree builder. - m_treeConstructor->setPaused(false); - bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForLoad(cachedResource); - m_treeConstructor->setPaused(!shouldContinueParsing); - if (shouldContinueParsing) - resumeParsingAfterScriptExecution(); -} - -void HTML5DocumentParser::executeScriptsWaitingForStylesheets() -{ - // Ignore calls unless we have a script blocking the parser waiting on a - // stylesheet load. Otherwise we are currently parsing and this - // is a re-entrant call from encountering a </ style> tag. - if (!m_scriptRunner->hasScriptsWaitingForStylesheets()) - return; - ASSERT(!m_scriptRunner->inScriptExecution()); - ASSERT(m_treeConstructor->isPaused()); - // Note: We only ever wait on one script at a time, so we always know this - // is the one we were waiting on and can un-pause the tree builder. - m_treeConstructor->setPaused(false); - bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForStylesheets(); - m_treeConstructor->setPaused(!shouldContinueParsing); - if (shouldContinueParsing) - resumeParsingAfterScriptExecution(); -} - -ScriptController* HTML5DocumentParser::script() const -{ - return m_document->frame() ? m_document->frame()->script() : 0; -} - -} diff --git a/WebCore/html/HTML5DocumentParser.h b/WebCore/html/HTML5DocumentParser.h deleted file mode 100644 index 4a75cec..0000000 --- a/WebCore/html/HTML5DocumentParser.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2010 Google, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTML5Tokenizer_h -#define HTML5Tokenizer_h - -#include "CachedResourceClient.h" -#include "HTML5ScriptRunnerHost.h" -#include "HTML5Token.h" -#include "SegmentedString.h" -#include "DocumentParser.h" -#include <wtf/OwnPtr.h> - -namespace WebCore { - -class HTMLDocument; -class LegacyHTMLTreeConstructor; -class HTML5Lexer; -class HTML5ScriptRunner; -class HTML5TreeBuilder; -class ScriptController; -class ScriptSourceCode; - -class HTML5DocumentParser : public DocumentParser, HTML5ScriptRunnerHost, CachedResourceClient { -public: - HTML5DocumentParser(HTMLDocument*, bool reportErrors); - virtual ~HTML5DocumentParser(); - - // DocumentParser - virtual void begin(); - virtual void write(const SegmentedString&, bool appendData); - virtual void end(); - virtual void finish(); - virtual int executingScript() const; - virtual bool isWaitingForScripts() const; - virtual void executeScriptsWaitingForStylesheets(); - virtual int lineNumber() const; - virtual int columnNumber() const; - // FIXME: HTMLFormControlElement accesses the LegacyHTMLTreeConstructor via this method. - // Remove this when the LegacyHTMLTreeConstructor is no longer used. - virtual LegacyHTMLTreeConstructor* htmlTreeConstructor() const; - - // HTML5ScriptRunnerHost - virtual void watchForLoad(CachedResource*); - virtual void stopWatchingForLoad(CachedResource*); - virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&); - virtual void executeScript(const ScriptSourceCode&); - - // CachedResourceClient - virtual void notifyFinished(CachedResource*); - -private: - // The InputStream is made up of a sequence of SegmentedStrings: - // - // [--current--][--next--][--next--] ... [--next--] - // /\ (also called m_last) - // L_ current insertion point - // - // The current segmented string is stored in InputStream. Each of the - // afterInsertionPoint buffers are stored in InsertionPointRecords on the - // stack. - // - // We remove characters from the "current" string in the InputStream. - // document.write() will add characters at the current insertion point, - // which appends them to the "current" string. - // - // m_last is a pointer to the last of the afterInsertionPoint strings. - // The network adds data at the end of the InputStream, which appends - // them to the "last" string. - class InputStream { - public: - InputStream() - : m_last(&m_first) - { - } - - void appendToEnd(const SegmentedString& string) - { - m_last->append(string); - } - - void insertAtCurrentInsertionPoint(const SegmentedString& string) - { - m_first.append(string); - } - - void close() { m_last->close(); } - - SegmentedString& current() { return m_first; } - - void splitInto(SegmentedString& next) - { - next = m_first; - m_first = SegmentedString(); - if (m_last == &m_first) { - // We used to only have one SegmentedString in the InputStream - // but now we have two. That means m_first is no longer also - // the m_last string, |next| is now the last one. - m_last = &next; - } - } - - void mergeFrom(SegmentedString& next) - { - m_first.append(next); - if (m_last == &next) { - // The string |next| used to be the last SegmentedString in - // the InputStream. Now that it's been merged into m_first, - // that makes m_first the last one. - m_last = &m_first; - } - if (next.isClosed()) { - // We also need to merge the "closed" state from next to - // m_first. Arguably, this work could be done in append(). - m_first.close(); - } - } - - private: - SegmentedString m_first; - SegmentedString* m_last; - }; - - class InsertionPointRecord { - public: - InsertionPointRecord(InputStream& inputStream) - : m_inputStream(&inputStream) - { - m_inputStream->splitInto(m_next); - } - - ~InsertionPointRecord() - { - m_inputStream->mergeFrom(m_next); - } - - private: - InputStream* m_inputStream; - SegmentedString m_next; - }; - - void willPumpLexer(); - void didPumpLexer(); - - void pumpLexer(); - void pumpLexerIfPossible(); - void resumeParsingAfterScriptExecution(); - - void attemptToEnd(); - void endIfDelayed(); - bool inWrite() const { return m_writeNestingLevel > 0; } - - ScriptController* script() const; - - InputStream m_input; - - // We hold m_token here because it might be partially complete. - HTML5Token m_token; - - HTMLDocument* m_document; - OwnPtr<HTML5Lexer> m_lexer; - OwnPtr<HTML5ScriptRunner> m_scriptRunner; - OwnPtr<HTML5TreeBuilder> m_treeConstructor; - bool m_endWasDelayed; - int m_writeNestingLevel; -}; - -} - -#endif diff --git a/WebCore/html/HTML5Lexer.h b/WebCore/html/HTML5Lexer.h deleted file mode 100644 index fe321e2..0000000 --- a/WebCore/html/HTML5Lexer.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * Copyright (C) 2010 Google, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTML5Lexer_h -#define HTML5Lexer_h - -#include "AtomicString.h" -#include "SegmentedString.h" -#include <wtf/Noncopyable.h> -#include <wtf/Vector.h> - -namespace WebCore { - - class HTML5Token; - - class HTML5Lexer : public Noncopyable { - public: - enum State { - DataState, - CharacterReferenceInDataState, - RCDATAState, - CharacterReferenceInRCDATAState, - RAWTEXTState, - ScriptDataState, - PLAINTEXTState, - TagOpenState, - EndTagOpenState, - TagNameState, - RCDATALessThanSignState, - RCDATAEndTagOpenState, - RCDATAEndTagNameState, - RAWTEXTLessThanSignState, - RAWTEXTEndTagOpenState, - RAWTEXTEndTagNameState, - ScriptDataLessThanSignState, - ScriptDataEndTagOpenState, - ScriptDataEndTagNameState, - ScriptDataEscapeStartState, - ScriptDataEscapeStartDashState, - ScriptDataEscapedState, - ScriptDataEscapedDashState, - ScriptDataEscapedDashDashState, - ScriptDataEscapedLessThanSignState, - ScriptDataEscapedEndTagOpenState, - ScriptDataEscapedEndTagNameState, - ScriptDataDoubleEscapeStartState, - ScriptDataDoubleEscapedState, - ScriptDataDoubleEscapedDashState, - ScriptDataDoubleEscapedDashDashState, - ScriptDataDoubleEscapedLessThanSignState, - ScriptDataDoubleEscapeEndState, - BeforeAttributeNameState, - AttributeNameState, - AfterAttributeNameState, - BeforeAttributeValueState, - AttributeValueDoubleQuotedState, - AttributeValueSingleQuotedState, - AttributeValueUnquotedState, - CharacterReferenceInAttributeValueState, - AfterAttributeValueQuotedState, - SelfClosingStartTagState, - BogusCommentState, - MarkupDeclarationOpenState, - CommentStartState, - CommentStartDashState, - CommentState, - CommentEndDashState, - CommentEndState, - CommentEndBangState, - CommentEndSpaceState, - DOCTYPEState, - BeforeDOCTYPENameState, - DOCTYPENameState, - AfterDOCTYPENameState, - AfterDOCTYPEPublicKeywordState, - BeforeDOCTYPEPublicIdentifierState, - DOCTYPEPublicIdentifierDoubleQuotedState, - DOCTYPEPublicIdentifierSingleQuotedState, - AfterDOCTYPEPublicIdentifierState, - BetweenDOCTYPEPublicAndSystemIdentifiersState, - AfterDOCTYPESystemKeywordState, - BeforeDOCTYPESystemIdentifierState, - DOCTYPESystemIdentifierDoubleQuotedState, - DOCTYPESystemIdentifierSingleQuotedState, - AfterDOCTYPESystemIdentifierState, - BogusDOCTYPEState, - CDATASectionState, - }; - - HTML5Lexer(); - ~HTML5Lexer(); - - void reset(); - - // This function returns true if it emits a token. Otherwise, callers - // must provide the same (in progress) token on the next call (unless - // they call reset() first). - bool nextToken(SegmentedString&, HTML5Token&); - - int lineNumber() const { return m_lineNumber; } - int columnNumber() const { return 1; } // Matches HTMLDocumentParser.h behavior. - - void setState(State state) { m_state = state; } - - // Hack to skip leading newline in <pre>/<listing> for authoring ease. - // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-inbody - void skipLeadingNewLineForListing() { m_skipLeadingNewLineForListing = true; } - - private: - // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream - class InputStreamPreprocessor : public Noncopyable { - public: - InputStreamPreprocessor() - : m_nextInputCharacter('\0') - , m_skipNextNewLine(false) - { - } - - UChar nextInputCharacter() const { return m_nextInputCharacter; } - - // Returns whether we succeeded in peeking at the next character. - // The only way we can fail to peek is if there are no more - // characters in |source| (after collapsing \r\n, etc). - bool peek(SegmentedString& source, int& lineNumber) - { - m_nextInputCharacter = *source; - if (m_nextInputCharacter == '\n' && m_skipNextNewLine) { - m_skipNextNewLine = false; - source.advancePastNewline(lineNumber); - if (source.isEmpty()) - return false; - m_nextInputCharacter = *source; - } - if (m_nextInputCharacter == '\r') { - m_nextInputCharacter = '\n'; - m_skipNextNewLine = true; - } else { - m_skipNextNewLine = false; - // FIXME: The spec indicates that the surrogate pair range as well as - // a number of specific character values are parse errors and should be replaced - // by the replacement character. We suspect this is a problem with the spec as doing - // that filtering breaks surrogate pair handling and causes us not to match Minefield. - if (m_nextInputCharacter == '\0') - m_nextInputCharacter = 0xFFFD; - } - return true; - } - - // Returns whether there are more characters in |source| after advancing. - bool advance(SegmentedString& source, int& lineNumber) - { - source.advance(lineNumber); - if (source.isEmpty()) - return false; - return peek(source, lineNumber); - } - - private: - // http://www.whatwg.org/specs/web-apps/current-work/#next-input-character - UChar m_nextInputCharacter; - bool m_skipNextNewLine; - }; - - inline void emitCharacter(UChar); - inline void emitParseError(); - inline void emitCurrentToken(); - inline void emitCodePoint(unsigned); - - inline bool processEntity(SegmentedString& source); - - inline bool temporaryBufferIs(const String&); - - // Sometimes we speculatively consume input characters and we don't - // know whether they represent end tags or RCDATA, etc. These - // functions help manage these state. - inline void addToPossibleEndTag(UChar cc); - inline bool isAppropriateEndTag(); - - inline bool shouldEmitBufferedCharacterToken(const SegmentedString&); - - State m_state; - - Vector<UChar, 32> m_appropriateEndTagName; - - // m_token is owned by the caller. If nextToken is not on the stack, - // this member might be pointing to unallocated memory. - HTML5Token* m_token; - int m_lineNumber; - - bool m_skipLeadingNewLineForListing; - - // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer - Vector<UChar, 32> m_temporaryBuffer; - - // We occationally want to emit both a character token and an end tag - // token (e.g., when lexing script). We buffer the name of the end tag - // token here so we remember it next time we re-enter the lexer. - Vector<UChar, 32> m_bufferedEndTagName; - - // http://www.whatwg.org/specs/web-apps/current-work/#additional-allowed-character - UChar m_additionalAllowedCharacter; - - // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream - InputStreamPreprocessor m_inputStreamPreprocessor; - }; - -} - -#endif diff --git a/WebCore/html/HTML5TreeBuilder.cpp b/WebCore/html/HTML5TreeBuilder.cpp deleted file mode 100644 index 79e1e0e..0000000 --- a/WebCore/html/HTML5TreeBuilder.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2010 Google, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "HTML5TreeBuilder.h" - -#include "Element.h" -#include "HTML5Lexer.h" -#include "HTML5Token.h" -#include "HTMLDocument.h" -#include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" -#include "HTMLDocumentParser.h" -#include "NotImplemented.h" -#include <wtf/UnusedParam.h> - -namespace WebCore { - -using namespace HTMLNames; - -static const int uninitializedLineNumberValue = -1; - -HTML5TreeBuilder::HTML5TreeBuilder(HTML5Lexer* lexer, HTMLDocument* document, bool reportErrors) - : m_document(document) - , m_reportErrors(reportErrors) - , m_isPaused(false) - , m_insertionMode(Initial) - , m_lexer(lexer) - , m_legacyTreeConstructor(new LegacyHTMLTreeConstructor(document, reportErrors)) - , m_lastScriptElementStartLine(uninitializedLineNumberValue) - , m_scriptToProcessStartLine(uninitializedLineNumberValue) -{ -} - -HTML5TreeBuilder::~HTML5TreeBuilder() -{ -} - -static void convertToOldStyle(HTML5Token& token, Token& oldStyleToken) -{ - switch (token.type()) { - case HTML5Token::Uninitialized: - case HTML5Token::DOCTYPE: - ASSERT_NOT_REACHED(); - break; - case HTML5Token::EndOfFile: - ASSERT_NOT_REACHED(); - notImplemented(); - break; - case HTML5Token::StartTag: - case HTML5Token::EndTag: { - oldStyleToken.beginTag = (token.type() == HTML5Token::StartTag); - oldStyleToken.selfClosingTag = token.selfClosing(); - oldStyleToken.tagName = AtomicString(token.name().data(), token.name().size()); - HTML5Token::AttributeList& attributes = token.attributes(); - for (HTML5Token::AttributeList::iterator iter = attributes.begin(); - iter != attributes.end(); ++iter) { - if (!iter->m_name.isEmpty()) { - String name = String(StringImpl::adopt(iter->m_name)); - String value = String(StringImpl::adopt(iter->m_value)); - RefPtr<Attribute> mappedAttribute = Attribute::createMapped(name, value); - if (!oldStyleToken.attrs) - oldStyleToken.attrs = NamedNodeMap::create(); - oldStyleToken.attrs->insertAttribute(mappedAttribute.release(), false); - } - } - break; - } - case HTML5Token::Comment: - oldStyleToken.tagName = commentAtom; - oldStyleToken.text = StringImpl::create(token.comment().data(), token.comment().size()); - break; - case HTML5Token::Character: - oldStyleToken.tagName = textAtom; - oldStyleToken.text = StringImpl::create(token.characters().data(), token.characters().size()); - break; - } -} - -void HTML5TreeBuilder::handleScriptStartTag() -{ - notImplemented(); // The HTML frgment case? - m_lexer->setState(HTML5Lexer::ScriptDataState); - notImplemented(); // Save insertion mode. -} - -void HTML5TreeBuilder::handleScriptEndTag(Element* scriptElement, int scriptStartLine) -{ - ASSERT(!m_scriptToProcess); // Caller never called takeScriptToProcess! - ASSERT(m_scriptToProcessStartLine == uninitializedLineNumberValue); // Caller never called takeScriptToProcess! - notImplemented(); // Save insertion mode and insertion point? - - // Pause ourselves so that parsing stops until the script can be processed by the caller. - m_isPaused = true; - m_scriptToProcess = scriptElement; - // Lexer line numbers are 0-based, ScriptSourceCode expects 1-based lines, - // so we convert here before passing the line number off to HTML5ScriptRunner. - m_scriptToProcessStartLine = scriptStartLine + 1; -} - -PassRefPtr<Element> HTML5TreeBuilder::takeScriptToProcess(int& scriptStartLine) -{ - // Unpause ourselves, callers may pause us again when processing the script. - // The HTML5 spec is written as though scripts are executed inside the tree - // builder. We pause the parser to exit the tree builder, and then resume - // before running scripts. - m_isPaused = false; - scriptStartLine = m_scriptToProcessStartLine; - m_scriptToProcessStartLine = uninitializedLineNumberValue; - return m_scriptToProcess.release(); -} - -PassRefPtr<Node> HTML5TreeBuilder::passTokenToLegacyParser(HTML5Token& token) -{ - if (token.type() == HTML5Token::DOCTYPE) { - DoctypeToken doctypeToken; - doctypeToken.m_name.append(token.name().data(), token.name().size()); - doctypeToken.m_publicID = token.publicIdentifier(); - doctypeToken.m_systemID = token.systemIdentifier(); - doctypeToken.m_forceQuirks = token.forceQuirks(); - - m_legacyTreeConstructor->parseDoctypeToken(&doctypeToken); - return 0; - } - - // For now, we translate into an old-style token for testing. - Token oldStyleToken; - convertToOldStyle(token, oldStyleToken); - - RefPtr<Node> result = m_legacyTreeConstructor->parseToken(&oldStyleToken); - if (token.type() == HTML5Token::StartTag) { - // This work is supposed to be done by the parser, but - // when using the old parser for we have to do this manually. - if (oldStyleToken.tagName == scriptTag) { - handleScriptStartTag(); - m_lastScriptElement = static_pointer_cast<Element>(result); - m_lastScriptElementStartLine = m_lexer->lineNumber(); - } else if (oldStyleToken.tagName == textareaTag || oldStyleToken.tagName == titleTag) - m_lexer->setState(HTML5Lexer::RCDATAState); - else if (oldStyleToken.tagName == styleTag || oldStyleToken.tagName == iframeTag - || oldStyleToken.tagName == xmpTag || oldStyleToken.tagName == noembedTag) { - // FIXME: noscript and noframes may conditionally enter this state as well. - m_lexer->setState(HTML5Lexer::RAWTEXTState); - } else if (oldStyleToken.tagName == plaintextTag) - m_lexer->setState(HTML5Lexer::PLAINTEXTState); - else if (oldStyleToken.tagName == preTag || oldStyleToken.tagName == listingTag) - m_lexer->skipLeadingNewLineForListing(); - } - if (token.type() == HTML5Token::EndTag) { - if (oldStyleToken.tagName == scriptTag && insertionMode() != AfterFrameset) { - if (m_lastScriptElement) { - ASSERT(m_lastScriptElementStartLine != uninitializedLineNumberValue); - handleScriptEndTag(m_lastScriptElement.get(), m_lastScriptElementStartLine); - m_lastScriptElement = 0; - m_lastScriptElementStartLine = uninitializedLineNumberValue; - } - } else if (oldStyleToken.tagName == framesetTag) - setInsertionMode(AfterFrameset); - } - return result.release(); -} - -PassRefPtr<Node> HTML5TreeBuilder::constructTreeFromToken(HTML5Token& token) -{ - // Make MSVC ignore our unreachable code for now. - if (true) - return passTokenToLegacyParser(token); - - // HTML5 expects the tokenizer to call the parser every time a character is - // emitted. We instead collect characters and call the parser with a batch. - // In order to make our first-pass parser code simple, processToken matches - // the spec in only handling one character at a time. - if (token.type() == HTML5Token::Character) { - HTML5Token::DataVector characters = token.characters(); - HTML5Token::DataVector::const_iterator itr = characters.begin(); - for (;itr; ++itr) - processToken(token, *itr); - return 0; // FIXME: Should we be returning the Text node? - } - return processToken(token); -} - -PassRefPtr<Node> HTML5TreeBuilder::processToken(HTML5Token& token, UChar currentCharacter) -{ - UNUSED_PARAM(token); - UNUSED_PARAM(currentCharacter); - // Implementation coming in the next patch. - return 0; -} - -void HTML5TreeBuilder::finished() -{ - // We should call m_document->finishedParsing() here, except - // m_legacyTreeConstructor->finished() does it for us. - m_legacyTreeConstructor->finished(); -} - -} diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp index d5faf8f..6f9b17c 100644 --- a/WebCore/html/HTMLAnchorElement.cpp +++ b/WebCore/html/HTMLAnchorElement.cpp @@ -42,7 +42,7 @@ namespace WebCore { using namespace HTMLNames; HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document* document) - : HTMLElement(tagName, document, CreateHTMLElement) + : HTMLElement(tagName, document) , m_wasShiftKeyDownOnMouseDown(false) , m_linkRelations(0) { diff --git a/WebCore/html/HTMLAnchorElement.idl b/WebCore/html/HTMLAnchorElement.idl index 03b3986..846162f 100644 --- a/WebCore/html/HTMLAnchorElement.idl +++ b/WebCore/html/HTMLAnchorElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,17 +21,17 @@ module html { interface HTMLAnchorElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect=accesskey] DOMString accessKey; - attribute [ConvertNullToNullString, Reflect] DOMString charset; - attribute [ConvertNullToNullString, Reflect] DOMString coords; - attribute [ConvertNullToNullString, ReflectURL] DOMString href; - attribute [ConvertNullToNullString, Reflect] DOMString hreflang; - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString rel; - attribute [ConvertNullToNullString, Reflect] DOMString rev; - attribute [ConvertNullToNullString, Reflect] DOMString shape; - attribute [ConvertNullToNullString, Reflect] DOMString target; - attribute [ConvertNullToNullString, Reflect] DOMString type; + attribute [Reflect] DOMString accessKey; + attribute [Reflect] DOMString charset; + attribute [Reflect] DOMString coords; + attribute [ReflectURL] DOMString href; + attribute [Reflect] DOMString hreflang; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString rel; + attribute [Reflect] DOMString rev; + attribute [Reflect] DOMString shape; + attribute [Reflect] DOMString target; + attribute [Reflect] DOMString type; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C readonly attribute DOMString hash; diff --git a/WebCore/html/HTMLAppletElement.idl b/WebCore/html/HTMLAppletElement.idl index f5984f0..388b5cb 100644 --- a/WebCore/html/HTMLAppletElement.idl +++ b/WebCore/html/HTMLAppletElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -25,25 +25,25 @@ module html { DelegatingGetOwnPropertySlot, CustomCall ] HTMLAppletElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString align; - attribute [ConvertNullToNullString, Reflect] DOMString alt; - attribute [ConvertNullToNullString, Reflect] DOMString archive; - attribute [ConvertNullToNullString, Reflect] DOMString code; - attribute [ConvertNullToNullString, Reflect=codebase] DOMString codeBase; - attribute [ConvertNullToNullString, Reflect] DOMString height; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString alt; + attribute [Reflect] DOMString archive; + attribute [Reflect] DOMString code; + attribute [Reflect] DOMString codeBase; + attribute [Reflect] DOMString height; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString, Reflect] DOMString hspace; + attribute [Reflect] DOMString hspace; #else - attribute [ConvertFromString] long hspace; + attribute [Reflect] long hspace; #endif - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString object; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString object; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString, Reflect] DOMString vspace; + attribute [Reflect] DOMString vspace; #else - attribute [ConvertFromString] long vspace; + attribute [Reflect] long vspace; #endif - attribute [ConvertNullToNullString, Reflect] DOMString width; + attribute [Reflect] DOMString width; }; } diff --git a/WebCore/html/HTMLAreaElement.idl b/WebCore/html/HTMLAreaElement.idl index 210d6e5..0f6fd72 100644 --- a/WebCore/html/HTMLAreaElement.idl +++ b/WebCore/html/HTMLAreaElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,13 +21,13 @@ module html { interface HTMLAreaElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect=accesskey] DOMString accessKey; - attribute [ConvertNullToNullString, Reflect] DOMString alt; - attribute [ConvertNullToNullString, Reflect] DOMString coords; - attribute [ConvertNullToNullString, ReflectURL] DOMString href; - attribute boolean noHref; - attribute [ConvertNullToNullString, Reflect] DOMString shape; - attribute [ConvertNullToNullString, Reflect] DOMString target; + attribute [Reflect] DOMString accessKey; + attribute [Reflect] DOMString alt; + attribute [Reflect] DOMString coords; + attribute [ReflectURL] DOMString href; + attribute [Reflect] boolean noHref; + attribute [Reflect] DOMString shape; + attribute [Reflect] DOMString target; // IE Extensions readonly attribute DOMString hash; diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in index 90b249a..b45ba9e 100644 --- a/WebCore/html/HTMLAttributeNames.in +++ b/WebCore/html/HTMLAttributeNames.in @@ -43,6 +43,7 @@ aria-valuemax aria-valuemin aria-valuenow aria-valuetext +async autocomplete autofocus autoplay @@ -254,6 +255,7 @@ size sortable sortdirection span +speech spellcheck src standby diff --git a/WebCore/html/HTMLAudioElement.cpp b/WebCore/html/HTMLAudioElement.cpp index 0b229ff..d94e146 100644 --- a/WebCore/html/HTMLAudioElement.cpp +++ b/WebCore/html/HTMLAudioElement.cpp @@ -43,12 +43,12 @@ HTMLAudioElement::HTMLAudioElement(const QualifiedName& tagName, Document* docum PassRefPtr<HTMLAudioElement> HTMLAudioElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLAudioElement(tagName, document); + return adoptRef(new HTMLAudioElement(tagName, document)); } PassRefPtr<HTMLAudioElement> HTMLAudioElement::createForJSConstructor(Document* document, const String& src) { - RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(audioTag, document); + RefPtr<HTMLAudioElement> audio = adoptRef(new HTMLAudioElement(audioTag, document)); audio->setPreload("auto"); if (!src.isNull()) { audio->setSrc(src); diff --git a/WebCore/html/HTMLBRElement.cpp b/WebCore/html/HTMLBRElement.cpp index 88ddf3b..e8f4520 100644 --- a/WebCore/html/HTMLBRElement.cpp +++ b/WebCore/html/HTMLBRElement.cpp @@ -40,12 +40,12 @@ HTMLBRElement::HTMLBRElement(const QualifiedName& tagName, Document* document) PassRefPtr<HTMLBRElement> HTMLBRElement::create(Document* document) { - return new HTMLBRElement(brTag, document); + return adoptRef(new HTMLBRElement(brTag, document)); } PassRefPtr<HTMLBRElement> HTMLBRElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLBRElement(tagName, document); + return adoptRef(new HTMLBRElement(tagName, document)); } bool HTMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLBRElement.idl b/WebCore/html/HTMLBRElement.idl index 4048911..a6d215d 100644 --- a/WebCore/html/HTMLBRElement.idl +++ b/WebCore/html/HTMLBRElement.idl @@ -20,7 +20,7 @@ module html { interface HTMLBRElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString clear; + attribute [Reflect] DOMString clear; }; } diff --git a/WebCore/html/HTMLBaseElement.cpp b/WebCore/html/HTMLBaseElement.cpp index 184b9fc..a3095d1 100644 --- a/WebCore/html/HTMLBaseElement.cpp +++ b/WebCore/html/HTMLBaseElement.cpp @@ -42,7 +42,7 @@ inline HTMLBaseElement::HTMLBaseElement(const QualifiedName& tagName, Document* PassRefPtr<HTMLBaseElement> HTMLBaseElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLBaseElement(tagName, document); + return adoptRef(new HTMLBaseElement(tagName, document)); } void HTMLBaseElement::parseMappedAttribute(Attribute* attr) diff --git a/WebCore/html/HTMLBaseElement.idl b/WebCore/html/HTMLBaseElement.idl index 087faca..8bf82a9 100644 --- a/WebCore/html/HTMLBaseElement.idl +++ b/WebCore/html/HTMLBaseElement.idl @@ -20,8 +20,8 @@ module html { interface HTMLBaseElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString href; - attribute [ConvertNullToNullString, Reflect] DOMString target; + attribute [Reflect] DOMString href; + attribute [Reflect] DOMString target; }; } diff --git a/WebCore/html/HTMLBaseFontElement.cpp b/WebCore/html/HTMLBaseFontElement.cpp index 1ac9ce6..39a5591 100644 --- a/WebCore/html/HTMLBaseFontElement.cpp +++ b/WebCore/html/HTMLBaseFontElement.cpp @@ -37,7 +37,7 @@ inline HTMLBaseFontElement::HTMLBaseFontElement(const QualifiedName& tagName, Do PassRefPtr<HTMLBaseFontElement> HTMLBaseFontElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLBaseFontElement(tagName, document); + return adoptRef(new HTMLBaseFontElement(tagName, document)); } int HTMLBaseFontElement::size() const diff --git a/WebCore/html/HTMLBaseFontElement.idl b/WebCore/html/HTMLBaseFontElement.idl index d55654e..a0ac127 100644 --- a/WebCore/html/HTMLBaseFontElement.idl +++ b/WebCore/html/HTMLBaseFontElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2009, 2010 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 @@ -20,12 +20,12 @@ module html { interface HTMLBaseFontElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString color; - attribute [ConvertNullToNullString, Reflect] DOMString face; + attribute [Reflect] DOMString color; + attribute [Reflect] DOMString face; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C attribute [ConvertToString] DOMString size; // this changed to a long, but our existing API is a string #else - attribute long size; + attribute [Reflect] long size; #endif }; } diff --git a/WebCore/html/HTMLBlockquoteElement.cpp b/WebCore/html/HTMLBlockquoteElement.cpp index 88437d8..cacd8b4 100644 --- a/WebCore/html/HTMLBlockquoteElement.cpp +++ b/WebCore/html/HTMLBlockquoteElement.cpp @@ -37,12 +37,12 @@ HTMLBlockquoteElement::HTMLBlockquoteElement(const QualifiedName& tagName, Docum PassRefPtr<HTMLBlockquoteElement> HTMLBlockquoteElement::create(Document* document) { - return new HTMLBlockquoteElement(blockquoteTag, document); + return adoptRef(new HTMLBlockquoteElement(blockquoteTag, document)); } PassRefPtr<HTMLBlockquoteElement> HTMLBlockquoteElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLBlockquoteElement(tagName, document); + return adoptRef(new HTMLBlockquoteElement(tagName, document)); } } diff --git a/WebCore/html/HTMLBlockquoteElement.idl b/WebCore/html/HTMLBlockquoteElement.idl index b819236..f0045c7 100644 --- a/WebCore/html/HTMLBlockquoteElement.idl +++ b/WebCore/html/HTMLBlockquoteElement.idl @@ -20,7 +20,7 @@ module html { interface HTMLBlockquoteElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString cite; + attribute [Reflect] DOMString cite; }; } diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp index d52ab6e..35dbd9d 100644 --- a/WebCore/html/HTMLBodyElement.cpp +++ b/WebCore/html/HTMLBodyElement.cpp @@ -52,12 +52,12 @@ HTMLBodyElement::HTMLBodyElement(const QualifiedName& tagName, Document* documen PassRefPtr<HTMLBodyElement> HTMLBodyElement::create(Document* document) { - return new HTMLBodyElement(bodyTag, document); + return adoptRef(new HTMLBodyElement(bodyTag, document)); } PassRefPtr<HTMLBodyElement> HTMLBodyElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLBodyElement(tagName, document); + return adoptRef(new HTMLBodyElement(tagName, document)); } HTMLBodyElement::~HTMLBodyElement() diff --git a/WebCore/html/HTMLBodyElement.idl b/WebCore/html/HTMLBodyElement.idl index c92dcd3..4709e3f 100644 --- a/WebCore/html/HTMLBodyElement.idl +++ b/WebCore/html/HTMLBodyElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,12 +21,12 @@ module html { interface HTMLBodyElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect=alink] DOMString aLink; - attribute [ConvertNullToNullString, Reflect] DOMString background; - attribute [ConvertNullToNullString, Reflect=bgcolor] DOMString bgColor; - attribute [ConvertNullToNullString, Reflect] DOMString link; - attribute [ConvertNullToNullString, Reflect] DOMString text; - attribute [ConvertNullToNullString, Reflect=vlink] DOMString vLink; + attribute [Reflect] DOMString aLink; + attribute [Reflect] DOMString background; + attribute [Reflect] DOMString bgColor; + attribute [Reflect] DOMString link; + attribute [Reflect] DOMString text; + attribute [Reflect] DOMString vLink; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler attributes diff --git a/WebCore/html/HTMLButtonElement.cpp b/WebCore/html/HTMLButtonElement.cpp index 2775b82..9f2cc9d 100644 --- a/WebCore/html/HTMLButtonElement.cpp +++ b/WebCore/html/HTMLButtonElement.cpp @@ -50,7 +50,7 @@ inline HTMLButtonElement::HTMLButtonElement(const QualifiedName& tagName, Docume PassRefPtr<HTMLButtonElement> HTMLButtonElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLButtonElement(tagName, document, form); + return adoptRef(new HTMLButtonElement(tagName, document, form)); } RenderObject* HTMLButtonElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/html/HTMLButtonElement.idl b/WebCore/html/HTMLButtonElement.idl index cf9f648..279e858 100644 --- a/WebCore/html/HTMLButtonElement.idl +++ b/WebCore/html/HTMLButtonElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,21 +21,26 @@ module html { interface HTMLButtonElement : HTMLElement { - readonly attribute HTMLFormElement form; - attribute boolean formNoValidate; - readonly attribute ValidityState validity; - attribute [ConvertNullToNullString] DOMString accessKey; - attribute boolean disabled; - attribute boolean autofocus; - attribute [ConvertNullToNullString] DOMString name; - readonly attribute DOMString type; - attribute [ConvertNullToNullString] DOMString value; - readonly attribute boolean willValidate; - readonly attribute DOMString validationMessage; - boolean checkValidity(); + readonly attribute HTMLFormElement form; + + attribute [Reflect] boolean formNoValidate; + readonly attribute ValidityState validity; + + attribute [Reflect] DOMString accessKey; + attribute [Reflect] boolean disabled; + attribute [Reflect] boolean autofocus; + attribute [Reflect] DOMString name; + readonly attribute DOMString type; + attribute [Reflect] DOMString value; + + readonly attribute boolean willValidate; + readonly attribute DOMString validationMessage; + boolean checkValidity(); void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void click(); - readonly attribute NodeList labels; + + readonly attribute NodeList labels; }; } diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp index 72343aa..c1bf8ec 100644 --- a/WebCore/html/HTMLCanvasElement.cpp +++ b/WebCore/html/HTMLCanvasElement.cpp @@ -65,12 +65,12 @@ HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document* doc PassRefPtr<HTMLCanvasElement> HTMLCanvasElement::create(Document* document) { - return new HTMLCanvasElement(canvasTag, document); + return adoptRef(new HTMLCanvasElement(canvasTag, document)); } PassRefPtr<HTMLCanvasElement> HTMLCanvasElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLCanvasElement(tagName, document); + return adoptRef(new HTMLCanvasElement(tagName, document)); } HTMLCanvasElement::~HTMLCanvasElement() diff --git a/WebCore/html/HTMLDListElement.cpp b/WebCore/html/HTMLDListElement.cpp index e3720e0..1a9d5a2 100644 --- a/WebCore/html/HTMLDListElement.cpp +++ b/WebCore/html/HTMLDListElement.cpp @@ -37,7 +37,7 @@ inline HTMLDListElement::HTMLDListElement(const QualifiedName& tagName, Document PassRefPtr<HTMLDListElement> HTMLDListElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLDListElement(tagName, document); + return adoptRef(new HTMLDListElement(tagName, document)); } bool HTMLDListElement::compact() const diff --git a/WebCore/html/HTMLDListElement.idl b/WebCore/html/HTMLDListElement.idl index 57c5c57..1a9326f 100644 --- a/WebCore/html/HTMLDListElement.idl +++ b/WebCore/html/HTMLDListElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLDListElement : HTMLElement { - attribute boolean compact; + attribute [Reflect] boolean compact; }; } diff --git a/WebCore/html/HTMLDataGridCellElement.cpp b/WebCore/html/HTMLDataGridCellElement.cpp index 3085680..9596d63 100644 --- a/WebCore/html/HTMLDataGridCellElement.cpp +++ b/WebCore/html/HTMLDataGridCellElement.cpp @@ -42,7 +42,7 @@ inline HTMLDataGridCellElement::HTMLDataGridCellElement(const QualifiedName& nam PassRefPtr<HTMLDataGridCellElement> HTMLDataGridCellElement::create(const QualifiedName& name, Document* document) { - return new HTMLDataGridCellElement(name, document); + return adoptRef(new HTMLDataGridCellElement(name, document)); } String HTMLDataGridCellElement::label() const diff --git a/WebCore/html/HTMLDataGridColElement.cpp b/WebCore/html/HTMLDataGridColElement.cpp index 8486d4d..196c7b6 100644 --- a/WebCore/html/HTMLDataGridColElement.cpp +++ b/WebCore/html/HTMLDataGridColElement.cpp @@ -46,7 +46,7 @@ inline HTMLDataGridColElement::HTMLDataGridColElement(const QualifiedName& name, PassRefPtr<HTMLDataGridColElement> HTMLDataGridColElement::create(const QualifiedName& name, Document* document) { - return new HTMLDataGridColElement(name, document); + return adoptRef(new HTMLDataGridColElement(name, document)); } HTMLDataGridElement* HTMLDataGridColElement::findDataGridAncestor() const diff --git a/WebCore/html/HTMLDataGridElement.cpp b/WebCore/html/HTMLDataGridElement.cpp index 5753748..82edf8f 100644 --- a/WebCore/html/HTMLDataGridElement.cpp +++ b/WebCore/html/HTMLDataGridElement.cpp @@ -47,7 +47,7 @@ inline HTMLDataGridElement::HTMLDataGridElement(const QualifiedName& tagName, Do PassRefPtr<HTMLDataGridElement> HTMLDataGridElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLDataGridElement(tagName, document); + return adoptRef(new HTMLDataGridElement(tagName, document)); } HTMLDataGridElement::~HTMLDataGridElement() diff --git a/WebCore/html/HTMLDataGridRowElement.cpp b/WebCore/html/HTMLDataGridRowElement.cpp index bab2a92..8e08c7c 100644 --- a/WebCore/html/HTMLDataGridRowElement.cpp +++ b/WebCore/html/HTMLDataGridRowElement.cpp @@ -42,7 +42,7 @@ inline HTMLDataGridRowElement::HTMLDataGridRowElement(const QualifiedName& name, PassRefPtr<HTMLDataGridRowElement> HTMLDataGridRowElement::create(const QualifiedName& name, Document* document) { - return new HTMLDataGridRowElement(name, document); + return adoptRef(new HTMLDataGridRowElement(name, document)); } bool HTMLDataGridRowElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLDataListElement.cpp b/WebCore/html/HTMLDataListElement.cpp index a9a60a1..3404348 100644 --- a/WebCore/html/HTMLDataListElement.cpp +++ b/WebCore/html/HTMLDataListElement.cpp @@ -44,7 +44,7 @@ inline HTMLDataListElement::HTMLDataListElement(const QualifiedName& tagName, Do PassRefPtr<HTMLDataListElement> HTMLDataListElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLDataListElement(tagName, document); + return adoptRef(new HTMLDataListElement(tagName, document)); } bool HTMLDataListElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLDirectoryElement.idl b/WebCore/html/HTMLDirectoryElement.idl index c88e2e0..b096974 100644 --- a/WebCore/html/HTMLDirectoryElement.idl +++ b/WebCore/html/HTMLDirectoryElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLDirectoryElement : HTMLElement { - attribute boolean compact; + attribute [Reflect] boolean compact; }; } diff --git a/WebCore/html/HTMLDivElement.cpp b/WebCore/html/HTMLDivElement.cpp index 72f532f..f35b25b 100644 --- a/WebCore/html/HTMLDivElement.cpp +++ b/WebCore/html/HTMLDivElement.cpp @@ -40,12 +40,12 @@ HTMLDivElement::HTMLDivElement(const QualifiedName& tagName, Document* document) PassRefPtr<HTMLDivElement> HTMLDivElement::create(Document* document) { - return new HTMLDivElement(divTag, document); + return adoptRef(new HTMLDivElement(divTag, document)); } PassRefPtr<HTMLDivElement> HTMLDivElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLDivElement(tagName, document); + return adoptRef(new HTMLDivElement(tagName, document)); } bool HTMLDivElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLDivElement.idl b/WebCore/html/HTMLDivElement.idl index 9f0b581..90fb84f 100644 --- a/WebCore/html/HTMLDivElement.idl +++ b/WebCore/html/HTMLDivElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLDivElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; + attribute [Reflect] DOMString align; }; } diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index b066f8a..bc9de97 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -64,11 +64,11 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" -#include "HTML5DocumentParser.h" +#include "HTMLDocumentParser.h" #include "HTMLBodyElement.h" #include "HTMLElementFactory.h" #include "HTMLNames.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" #include "InspectorController.h" #include "KURL.h" #include "Page.h" @@ -81,8 +81,8 @@ namespace WebCore { using namespace HTMLNames; -HTMLDocument::HTMLDocument(Frame* frame) - : Document(frame, false, true) +HTMLDocument::HTMLDocument(Frame* frame, const KURL& url) + : Document(frame, url, false, true) { clearXMLVersion(); setParseMode(Compat); @@ -292,9 +292,9 @@ DocumentParser* HTMLDocument::createParser() #endif if (settings() && settings()->html5ParserEnabled()) - return new HTML5DocumentParser(this, reportErrors); + return new HTMLDocumentParser(this, reportErrors); - return new HTMLDocumentParser(this, reportErrors); + return new LegacyHTMLDocumentParser(this, reportErrors); } // -------------------------------------------------------------------------- diff --git a/WebCore/html/HTMLDocument.h b/WebCore/html/HTMLDocument.h index 5b1f636..646e100 100644 --- a/WebCore/html/HTMLDocument.h +++ b/WebCore/html/HTMLDocument.h @@ -35,9 +35,9 @@ class HTMLElement; class HTMLDocument : public Document, public CachedResourceClient { public: - static PassRefPtr<HTMLDocument> create(Frame* frame) + static PassRefPtr<HTMLDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new HTMLDocument(frame)); + return adoptRef(new HTMLDocument(frame, url)); } virtual ~HTMLDocument(); @@ -80,7 +80,7 @@ public: bool hasExtraNamedItem(AtomicStringImpl* name); protected: - HTMLDocument(Frame*); + HTMLDocument(Frame*, const KURL&); #ifdef ANDROID_INSTRUMENT // Overridden to resolve the ambiguous diff --git a/WebCore/html/HTMLDocumentParser.cpp b/WebCore/html/HTMLDocumentParser.cpp index e59cb74..79ca805 100644 --- a/WebCore/html/HTMLDocumentParser.cpp +++ b/WebCore/html/HTMLDocumentParser.cpp @@ -1,60 +1,44 @@ /* - Copyright (C) 1997 Martin Jones (mjones@kde.org) - (C) 1997 Torben Weis (weis@kde.org) - (C) 1998 Waldo Bastian (bastian@kde.org) - (C) 1999 Lars Knoll (knoll@kde.org) - (C) 1999 Antti Koivisto (koivisto@kde.org) - (C) 2001 Dirk Mueller (mueller@kde.org) - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com) - Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - - 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. -*/ + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "config.h" #include "HTMLDocumentParser.h" -#include "Attribute.h" -#include "CSSHelper.h" -#include "Cache.h" -#include "CachedScript.h" -#include "DocLoader.h" #include "DocumentFragment.h" -#include "Event.h" -#include "EventNames.h" +#include "Element.h" #include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "HTMLElement.h" -#include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" -#include "HTMLScriptElement.h" -#include "HTMLViewSourceDocument.h" -#include "ImageLoader.h" -#include "InspectorTimelineAgent.h" -#include "Page.h" -#include "PreloadScanner.h" -#include "ScriptController.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" +#include "HTMLParserScheduler.h" +#include "HTMLTokenizer.h" +#include "HTMLPreloadScanner.h" +#include "HTMLScriptRunner.h" +#include "HTMLTreeBuilder.h" +#include "HTMLDocument.h" #include "XSSAuditor.h" -#include <wtf/ASCIICType.h> #include <wtf/CurrentTime.h> +<<<<<<< HEAD #include "HTMLEntityNames.cpp" #ifdef ANDROID_INSTRUMENT @@ -65,361 +49,86 @@ using namespace WTF; using namespace std; +======= +#if ENABLE(INSPECTOR) +#include "InspectorTimelineAgent.h" +#endif +>>>>>>> webkit.org at r61871 namespace WebCore { -using namespace HTMLNames; - -// This value is used to define how many characters the parser will process before -// yeilding control. -// To increase responsivness reduce the parser chunk size. -static const int defaultTokenizerChunkSize = 4096; - -// FIXME: We would like this constant to be 200ms. -// Yielding more aggressively results in increased responsiveness and better incremental rendering. -// It slows down overall page-load on slower machines, though, so for now we set a value of 500. -// For smaller chunks (above) decrease the value of TimerDelay as the the parser should not -// yield for as long a period otherwise it will take way to long to load a page. -static const double defaultTokenizerTimeDelay = 0.500; - -static const char commentStart [] = "<!--"; -static const char doctypeStart [] = "<!doctype"; -static const char publicStart [] = "public"; -static const char systemStart [] = "system"; -static const char scriptEnd [] = "</script"; -static const char xmpEnd [] = "</xmp"; -static const char styleEnd [] = "</style"; -static const char textareaEnd [] = "</textarea"; -static const char titleEnd [] = "</title"; -static const char iframeEnd [] = "</iframe"; - -// Full support for MS Windows extensions to Latin-1. -// Technically these extensions should only be activated for pages -// marked "windows-1252" or "cp1252", but -// in the standard Microsoft way, these extensions infect hundreds of thousands -// of web pages. Note that people with non-latin-1 Microsoft extensions -// are SOL. -// -// See: http://www.microsoft.com/globaldev/reference/WinCP.asp -// http://www.bbsinc.com/iso8859.html -// http://www.obviously.com/ -// -// There may be better equivalents - -// We only need this for entities. For non-entity text, we handle this in the text encoding. - -static const UChar windowsLatin1ExtensionArray[32] = { - 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F - 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, // 90-97 - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178 // 98-9F -}; - -static inline UChar fixUpChar(UChar c) -{ - if ((c & ~0x1F) != 0x0080) - return c; - return windowsLatin1ExtensionArray[c - 0x80]; -} +namespace { -static inline bool tagMatch(const char* s1, const UChar* s2, unsigned length) -{ - for (unsigned i = 0; i != length; ++i) { - unsigned char c1 = s1[i]; - unsigned char uc1 = toASCIIUpper(static_cast<char>(c1)); - UChar c2 = s2[i]; - if (c1 != c2 && uc1 != c2) - return false; +class NestingLevelIncrementer : public Noncopyable { +public: + explicit NestingLevelIncrementer(int& counter) + : m_counter(&counter) + { + ++(*m_counter); } - return true; -} -inline void Token::addAttribute(AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode) -{ - if (!attrName.isEmpty()) { - ASSERT(!attrName.contains('/')); - RefPtr<Attribute> a = Attribute::createMapped(attrName, attributeValue); - if (!attrs) { - attrs = NamedNodeMap::create(); - attrs->reserveInitialCapacity(10); - } - attrs->insertAttribute(a.release(), viewSourceMode); + ~NestingLevelIncrementer() + { + --(*m_counter); } - attrName = emptyAtom; -} +private: + int* m_counter; +}; -// ---------------------------------------------------------------------------- - -HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* doc, bool reportErrors) - : DocumentParser() - , m_buffer(0) - , m_scriptCode(0) - , m_scriptCodeSize(0) - , m_scriptCodeCapacity(0) - , m_scriptCodeResync(0) - , m_executingScript(0) - , m_requestingScript(false) - , m_hasScriptsWaitingForStylesheets(false) - , m_timer(this, &HTMLDocumentParser::timerFired) - , m_externalScriptsTimer(this, &HTMLDocumentParser::executeExternalScriptsTimerFired) - , m_doc(doc) - , m_treeConstructor(new LegacyHTMLTreeConstructor(doc, reportErrors)) - , m_inWrite(false) - , m_fragment(false) - , m_scriptingPermission(FragmentScriptingAllowed) -{ - begin(); -} +} // namespace -HTMLDocumentParser::HTMLDocumentParser(HTMLViewSourceDocument* doc) - : DocumentParser(true) - , m_buffer(0) - , m_scriptCode(0) - , m_scriptCodeSize(0) - , m_scriptCodeCapacity(0) - , m_scriptCodeResync(0) - , m_executingScript(0) - , m_requestingScript(false) - , m_hasScriptsWaitingForStylesheets(false) - , m_timer(this, &HTMLDocumentParser::timerFired) - , m_externalScriptsTimer(this, &HTMLDocumentParser::executeExternalScriptsTimerFired) - , m_doc(doc) - , m_inWrite(false) - , m_fragment(false) - , m_scriptingPermission(FragmentScriptingAllowed) +HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors) + : DocumentParser(document) + , m_tokenizer(new HTMLTokenizer) + , m_scriptRunner(new HTMLScriptRunner(document, this)) + , m_treeBuilder(new HTMLTreeBuilder(m_tokenizer.get(), document, reportErrors)) + , m_parserScheduler(new HTMLParserScheduler(this)) + , m_endWasDelayed(false) + , m_writeNestingLevel(0) { begin(); } -HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) - : m_buffer(0) - , m_scriptCode(0) - , m_scriptCodeSize(0) - , m_scriptCodeCapacity(0) - , m_scriptCodeResync(0) - , m_executingScript(0) - , m_requestingScript(false) - , m_hasScriptsWaitingForStylesheets(false) - , m_timer(this, &HTMLDocumentParser::timerFired) - , m_externalScriptsTimer(this, &HTMLDocumentParser::executeExternalScriptsTimerFired) - , m_doc(frag->document()) - , m_treeConstructor(new LegacyHTMLTreeConstructor(frag, scriptingPermission)) - , m_inWrite(false) - , m_fragment(true) - , m_scriptingPermission(scriptingPermission) +// FIXME: Member variables should be grouped into self-initializing structs to +// minimize code duplication between these constructors. +HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) + : DocumentParser(fragment->document()) + , m_tokenizer(new HTMLTokenizer) + , m_treeBuilder(new HTMLTreeBuilder(m_tokenizer.get(), fragment, scriptingPermission)) + , m_endWasDelayed(false) + , m_writeNestingLevel(0) { begin(); } -void HTMLDocumentParser::reset() +HTMLDocumentParser::~HTMLDocumentParser() { - ASSERT(m_executingScript == 0); - - while (!m_pendingScripts.isEmpty()) { - CachedScript* cs = m_pendingScripts.takeFirst().get(); - ASSERT(cache()->disabled() || cs->accessCount() > 0); - cs->removeClient(this); - } - - fastFree(m_buffer); - m_buffer = m_dest = 0; - m_bufferSize = 0; - - fastFree(m_scriptCode); - m_scriptCode = 0; - m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; - - m_timer.stop(); - m_externalScriptsTimer.stop(); - - m_state.setAllowYield(false); - m_state.setForceSynchronous(false); - - m_currentToken.reset(); - m_doctypeToken.reset(); - m_doctypeSearchCount = 0; - m_doctypeSecondarySearchCount = 0; - m_hasScriptsWaitingForStylesheets = false; + // FIXME: We'd like to ASSERT that normal operation of this class clears + // out any delayed actions, but we can't because we're unceremoniously + // deleted. If there were a required call to some sort of cancel function, + // then we could ASSERT some invariants here. } void HTMLDocumentParser::begin() { - m_executingScript = 0; - m_requestingScript = false; - m_hasScriptsWaitingForStylesheets = false; - m_state.setLoadingExtScript(false); - reset(); - m_bufferSize = 254; - m_buffer = static_cast<UChar*>(fastMalloc(sizeof(UChar) * 254)); - m_dest = m_buffer; - tquote = NoQuote; - searchCount = 0; - m_state.setEntityState(NoEntity); - m_scriptTagSrcAttrValue = String(); - m_pendingSrc.clear(); - m_currentPrependingSrc = 0; - m_noMoreData = false; - m_brokenComments = false; - m_brokenServer = false; - m_lineNumber = 0; - m_currentScriptTagStartLineNumber = 0; - m_currentTagStartLineNumber = 0; - m_state.setForceSynchronous(false); - - Page* page = m_doc->page(); - if (page && page->hasCustomHTMLTokenizerTimeDelay()) - m_tokenizerTimeDelay = page->customHTMLTokenizerTimeDelay(); - else - m_tokenizerTimeDelay = defaultTokenizerTimeDelay; - - if (page && page->hasCustomHTMLTokenizerChunkSize()) - m_tokenizerChunkSize = page->customHTMLTokenizerChunkSize(); - else - m_tokenizerChunkSize = defaultTokenizerChunkSize; -} - -void HTMLDocumentParser::setForceSynchronous(bool force) -{ - m_state.setForceSynchronous(force); + // FIXME: Should we reset the tokenizer? } -HTMLDocumentParser::State HTMLDocumentParser::processListing(SegmentedString list, State state) +void HTMLDocumentParser::stopParsing() { - // This function adds the listing 'list' as - // preformatted text-tokens to the token-collection - while (!list.isEmpty()) { - if (state.skipLF()) { - state.setSkipLF(false); - if (*list == '\n') { - list.advance(); - continue; - } - } - - checkBuffer(); - - if (*list == '\n' || *list == '\r') { - if (state.discardLF()) - // Ignore this LF - state.setDiscardLF(false); // We have discarded 1 LF - else - *m_dest++ = '\n'; - - /* Check for MS-DOS CRLF sequence */ - if (*list == '\r') - state.setSkipLF(true); - - list.advance(); - } else { - state.setDiscardLF(false); - *m_dest++ = *list; - list.advance(); - } - } - - return state; + DocumentParser::stopParsing(); + m_parserScheduler.clear(); // Deleting the scheduler will clear any timers. } -HTMLDocumentParser::State HTMLDocumentParser::parseNonHTMLText(SegmentedString& src, State state) +bool HTMLDocumentParser::processingData() const { - ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); - ASSERT(!state.hasTagState()); - ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1); - if (state.inScript() && !m_currentScriptTagStartLineNumber) - m_currentScriptTagStartLineNumber = m_lineNumber; - - if (state.inComment()) - state = parseComment(src, state); - - int lastDecodedEntityPosition = -1; - while (!src.isEmpty()) { - checkScriptBuffer(); - UChar ch = *src; - - if (!m_scriptCodeResync && !m_brokenComments && - !state.inXmp() && ch == '-' && m_scriptCodeSize >= 3 && !src.escaped() && - m_scriptCode[m_scriptCodeSize - 3] == '<' && m_scriptCode[m_scriptCodeSize - 2] == '!' && m_scriptCode[m_scriptCodeSize - 1] == '-' && - (lastDecodedEntityPosition < m_scriptCodeSize - 3)) { - state.setInComment(true); - state = parseComment(src, state); - continue; - } - if (m_scriptCodeResync && !tquote && ch == '>') { - src.advancePastNonNewline(); - m_scriptCodeSize = m_scriptCodeResync - 1; - m_scriptCodeResync = 0; - m_scriptCode[m_scriptCodeSize] = m_scriptCode[m_scriptCodeSize + 1] = 0; - if (state.inScript()) - state = scriptHandler(state); - else { - state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); - processToken(); - if (state.inStyle()) { - m_currentToken.tagName = styleTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inTextArea()) { - m_currentToken.tagName = textareaTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inTitle()) { - m_currentToken.tagName = titleTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inXmp()) { - m_currentToken.tagName = xmpTag.localName(); - m_currentToken.beginTag = false; - } else if (state.inIFrame()) { - m_currentToken.tagName = iframeTag.localName(); - m_currentToken.beginTag = false; - } - processToken(); - state.setInStyle(false); - state.setInScript(false); - state.setInTextArea(false); - state.setInTitle(false); - state.setInXmp(false); - state.setInIFrame(false); - tquote = NoQuote; - m_scriptCodeSize = m_scriptCodeResync = 0; - } - return state; - } - // possible end of tagname, lets check. - if (!m_scriptCodeResync && !state.escaped() && !src.escaped() && (ch == '>' || ch == '/' || isASCIISpace(ch)) && - m_scriptCodeSize >= m_searchStopperLength && - tagMatch(m_searchStopper, m_scriptCode + m_scriptCodeSize - m_searchStopperLength, m_searchStopperLength) && - (lastDecodedEntityPosition < m_scriptCodeSize - m_searchStopperLength)) { - m_scriptCodeResync = m_scriptCodeSize-m_searchStopperLength+1; - tquote = NoQuote; - continue; - } - if (m_scriptCodeResync && !state.escaped()) { - if (ch == '\"') - tquote = (tquote == NoQuote) ? DoubleQuote : ((tquote == SingleQuote) ? SingleQuote : NoQuote); - else if (ch == '\'') - tquote = (tquote == NoQuote) ? SingleQuote : (tquote == DoubleQuote) ? DoubleQuote : NoQuote; - else if (tquote != NoQuote && (ch == '\r' || ch == '\n')) - tquote = NoQuote; - } - state.setEscaped(!state.escaped() && ch == '\\'); - if (!m_scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') { - UChar* scriptCodeDest = m_scriptCode + m_scriptCodeSize; - src.advancePastNonNewline(); - state = parseEntity(src, scriptCodeDest, state, m_cBufferPos, true, false); - if (scriptCodeDest == m_scriptCode + m_scriptCodeSize) - lastDecodedEntityPosition = m_scriptCodeSize; - else - m_scriptCodeSize = scriptCodeDest - m_scriptCode; - } else { - m_scriptCode[m_scriptCodeSize++] = ch; - src.advance(m_lineNumber); - } - } - - return state; + return isScheduledForResume() || inWrite(); } -HTMLDocumentParser::State HTMLDocumentParser::scriptHandler(State state) +void HTMLDocumentParser::pumpTokenizerIfPossible(SynchronousMode mode) { +<<<<<<< HEAD // We are inside a <script> bool doScriptExec = false; int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based @@ -613,1156 +322,152 @@ HTMLDocumentParser::State HTMLDocumentParser::scriptExecution(const ScriptSource return state; } +======= + if (m_parserStopped || m_treeBuilder->isPaused()) + return; +>>>>>>> webkit.org at r61871 -HTMLDocumentParser::State HTMLDocumentParser::parseComment(SegmentedString& src, State state) -{ - // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus. - checkScriptBuffer(src.length()); - while (!src.isEmpty()) { - UChar ch = *src; - m_scriptCode[m_scriptCodeSize++] = ch; - if (ch == '>') { - bool handleBrokenComments = m_brokenComments && !(state.inScript() || state.inStyle()); - int endCharsCount = 1; // start off with one for the '>' character - if (m_scriptCodeSize > 2 && m_scriptCode[m_scriptCodeSize-3] == '-' && m_scriptCode[m_scriptCodeSize-2] == '-') { - endCharsCount = 3; - } else if (m_scriptCodeSize > 3 && m_scriptCode[m_scriptCodeSize-4] == '-' && m_scriptCode[m_scriptCodeSize-3] == '-' && - m_scriptCode[m_scriptCodeSize-2] == '!') { - // Other browsers will accept --!> as a close comment, even though it's - // not technically valid. - endCharsCount = 4; - } - if (handleBrokenComments || endCharsCount > 1) { - src.advancePastNonNewline(); - if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) { - checkScriptBuffer(); - m_scriptCode[m_scriptCodeSize] = 0; - m_scriptCode[m_scriptCodeSize + 1] = 0; - m_currentToken.tagName = commentAtom; - m_currentToken.beginTag = true; - state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize - endCharsCount), state); - processToken(); - m_currentToken.tagName = commentAtom; - m_currentToken.beginTag = false; - processToken(); - m_scriptCodeSize = 0; - } - state.setInComment(false); - return state; // Finished parsing comment - } - } - src.advance(m_lineNumber); + // Once a resume is scheduled, HTMLParserScheduler controls when we next pump. + if (isScheduledForResume()) { + ASSERT(mode == AllowYield); + return; } - return state; + pumpTokenizer(mode); } -HTMLDocumentParser::State HTMLDocumentParser::parseServer(SegmentedString& src, State state) +bool HTMLDocumentParser::isScheduledForResume() const { - checkScriptBuffer(src.length()); - while (!src.isEmpty()) { - UChar ch = *src; - m_scriptCode[m_scriptCodeSize++] = ch; - if (ch == '>' && m_scriptCodeSize > 1 && m_scriptCode[m_scriptCodeSize - 2] == '%') { - src.advancePastNonNewline(); - state.setInServer(false); - m_scriptCodeSize = 0; - return state; // Finished parsing server include - } - src.advance(m_lineNumber); - } - return state; + return m_parserScheduler && m_parserScheduler->isScheduledForResume(); } -HTMLDocumentParser::State HTMLDocumentParser::parseProcessingInstruction(SegmentedString& src, State state) +// Used by HTMLParserScheduler +void HTMLDocumentParser::resumeParsingAfterYield() { - UChar oldchar = 0; - while (!src.isEmpty()) { - UChar chbegin = *src; - if (chbegin == '\'') - tquote = tquote == SingleQuote ? NoQuote : SingleQuote; - else if (chbegin == '\"') - tquote = tquote == DoubleQuote ? NoQuote : DoubleQuote; - // Look for '?>' - // Some crappy sites omit the "?" before it, so - // we look for an unquoted '>' instead. (IE compatible) - else if (chbegin == '>' && (!tquote || oldchar == '?')) { - // We got a '?>' sequence - state.setInProcessingInstruction(false); - src.advancePastNonNewline(); - state.setDiscardLF(true); - return state; // Finished parsing comment! - } - src.advance(m_lineNumber); - oldchar = chbegin; - } - - return state; + // We should never be here unless we can pump immediately. Call pumpTokenizer() + // directly so that ASSERTS will fire if we're wrong. + pumpTokenizer(AllowYield); } -HTMLDocumentParser::State HTMLDocumentParser::parseText(SegmentedString& src, State state) +bool HTMLDocumentParser::runScriptsForPausedTreeBuilder() { - while (!src.isEmpty()) { - UChar cc = *src; - - if (state.skipLF()) { - state.setSkipLF(false); - if (cc == '\n') { - src.advancePastNewline(m_lineNumber); - continue; - } - } - - // do we need to enlarge the buffer? - checkBuffer(); + ASSERT(m_treeBuilder->isPaused()); - if (cc == '\r') { - state.setSkipLF(true); - *m_dest++ = '\n'; - } else - *m_dest++ = cc; - src.advance(m_lineNumber); - } - - return state; + int scriptStartLine = 0; + RefPtr<Element> scriptElement = m_treeBuilder->takeScriptToProcess(scriptStartLine); + // We will not have a scriptRunner when parsing a DocumentFragment. + if (!m_scriptRunner) + return true; + return m_scriptRunner->execute(scriptElement.release(), scriptStartLine); } - -HTMLDocumentParser::State HTMLDocumentParser::parseEntity(SegmentedString& src, UChar*& dest, State state, unsigned& cBufferPos, bool start, bool parsingTag) +void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode) { - if (start) { - cBufferPos = 0; - state.setEntityState(SearchEntity); - EntityUnicodeValue = 0; - } + ASSERT(!m_parserStopped); + ASSERT(!m_treeBuilder->isPaused()); + ASSERT(!isScheduledForResume()); - while (!src.isEmpty()) { - UChar cc = *src; - switch (state.entityState()) { - case NoEntity: - ASSERT(state.entityState() != NoEntity); - return state; - - case SearchEntity: - if (cc == '#') { - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - state.setEntityState(NumericSearch); - } else - state.setEntityState(EntityName); - break; + // We tell the InspectorTimelineAgent about every pump, even if we + // end up pumping nothing. It can filter out empty pumps itself. + willPumpLexer(); - case NumericSearch: - if (cc == 'x' || cc == 'X') { - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - state.setEntityState(Hexadecimal); - } else if (cc >= '0' && cc <= '9') - state.setEntityState(Decimal); - else - state.setEntityState(SearchSemicolon); + HTMLParserScheduler::PumpSession session; + // FIXME: This loop body has is now too long and needs cleanup. + while (mode == ForceSynchronous || (!m_parserStopped && m_parserScheduler->shouldContinueParsing(session))) { + if (!m_tokenizer->nextToken(m_input.current(), m_token)) break; - case Hexadecimal: { - int ll = min(src.length(), 10 - cBufferPos); - while (ll--) { - cc = *src; - if (!((cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'f') || (cc >= 'A' && cc <= 'F'))) { - state.setEntityState(SearchSemicolon); - break; - } - int digit; - if (cc < 'A') - digit = cc - '0'; - else - digit = (cc - 'A' + 10) & 0xF; // handle both upper and lower case without a branch - EntityUnicodeValue = EntityUnicodeValue * 16 + digit; - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - } - if (cBufferPos == 10) - state.setEntityState(SearchSemicolon); - break; - } - case Decimal: - { - int ll = min(src.length(), 9-cBufferPos); - while (ll--) { - cc = *src; - - if (!(cc >= '0' && cc <= '9')) { - state.setEntityState(SearchSemicolon); - break; - } - - EntityUnicodeValue = EntityUnicodeValue * 10 + (cc - '0'); - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - } - if (cBufferPos == 9) - state.setEntityState(SearchSemicolon); + m_treeBuilder->constructTreeFromToken(m_token); + m_token.clear(); + + // The parser will pause itself when waiting on a script to load or run. + if (!m_treeBuilder->isPaused()) + continue; + + // If we're paused waiting for a script, we try to execute scripts before continuing. + bool shouldContinueParsing = runScriptsForPausedTreeBuilder(); + m_treeBuilder->setPaused(!shouldContinueParsing); + if (!shouldContinueParsing) break; + } + + if (isWaitingForScripts()) { + ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); + if (!m_preloadScanner) { + m_preloadScanner.set(new HTMLPreloadScanner(m_document)); + m_preloadScanner->appendToEnd(m_input.current()); } - case EntityName: - { - int ll = min(src.length(), 9-cBufferPos); - while (ll--) { - cc = *src; - - if (!((cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9') || (cc >= 'A' && cc <= 'Z'))) { - state.setEntityState(SearchSemicolon); - break; - } - - m_cBuffer[cBufferPos++] = cc; - src.advancePastNonNewline(); - } - if (cBufferPos == 9) - state.setEntityState(SearchSemicolon); - if (state.entityState() == SearchSemicolon) { - if (cBufferPos > 1) { - // Since the maximum length of entity name is 9, - // so a single char array which is allocated on - // the stack, its length is 10, should be OK. - // Also if we have an illegal character, we treat it - // as illegal entity name. - unsigned testedEntityNameLen = 0; - char tmpEntityNameBuffer[10]; - - ASSERT(cBufferPos < 10); - for (; testedEntityNameLen < cBufferPos; ++testedEntityNameLen) { - if (m_cBuffer[testedEntityNameLen] > 0x7e) - break; - tmpEntityNameBuffer[testedEntityNameLen] = m_cBuffer[testedEntityNameLen]; - } - - const Entity *e; - - if (testedEntityNameLen == cBufferPos) - e = findEntity(tmpEntityNameBuffer, cBufferPos); - else - e = 0; - - if (e) - EntityUnicodeValue = e->code; - - // be IE compatible - if (parsingTag && EntityUnicodeValue > 255 && *src != ';') - EntityUnicodeValue = 0; - } - } - else - break; - } - case SearchSemicolon: - // Don't allow values that are more than 21 bits. - if (EntityUnicodeValue > 0 && EntityUnicodeValue <= 0x10FFFF) { - if (!inViewSourceMode()) { - if (*src == ';') - src.advancePastNonNewline(); - if (EntityUnicodeValue <= 0xFFFF) { - checkBuffer(); - src.push(fixUpChar(EntityUnicodeValue)); - } else { - // Convert to UTF-16, using surrogate code points. - checkBuffer(2); - src.push(U16_LEAD(EntityUnicodeValue)); - src.push(U16_TRAIL(EntityUnicodeValue)); - } - } else { - // FIXME: We should eventually colorize entities by sending them as a special token. - // 12 bytes required: up to 10 bytes in m_cBuffer plus the - // leading '&' and trailing ';' - checkBuffer(12); - *dest++ = '&'; - for (unsigned i = 0; i < cBufferPos; i++) - dest[i] = m_cBuffer[i]; - dest += cBufferPos; - if (*src == ';') { - *dest++ = ';'; - src.advancePastNonNewline(); - } - } - } else { - // 11 bytes required: up to 10 bytes in m_cBuffer plus the - // leading '&' - checkBuffer(11); - // ignore the sequence, add it to the buffer as plaintext - *dest++ = '&'; - for (unsigned i = 0; i < cBufferPos; i++) - dest[i] = m_cBuffer[i]; - dest += cBufferPos; - } - - state.setEntityState(NoEntity); - return state; - } + m_preloadScanner->scan(); } - return state; + didPumpLexer(); } -HTMLDocumentParser::State HTMLDocumentParser::parseDoctype(SegmentedString& src, State state) +void HTMLDocumentParser::willPumpLexer() { - ASSERT(state.inDoctype()); - while (!src.isEmpty() && state.inDoctype()) { - UChar c = *src; - bool isWhitespace = c == '\r' || c == '\n' || c == '\t' || c == ' '; - switch (m_doctypeToken.state()) { - case DoctypeBegin: { - m_doctypeToken.setState(DoctypeBeforeName); - if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeBeforeName: { - if (c == '>') { - // Malformed. Just exit. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeName); - break; - } - case DoctypeName: { - if (c == '>') { - // Valid doctype. Emit it. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (isWhitespace) { - m_doctypeSearchCount = 0; // Used now to scan for PUBLIC - m_doctypeSecondarySearchCount = 0; // Used now to scan for SYSTEM - m_doctypeToken.setState(DoctypeAfterName); - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else { - src.advancePastNonNewline(); - m_doctypeToken.m_name.append(c); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeAfterName: { - if (c == '>') { - // Valid doctype. Emit it. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (!isWhitespace) { - src.advancePastNonNewline(); - if (toASCIILower(c) == publicStart[m_doctypeSearchCount]) { - m_doctypeSearchCount++; - if (m_doctypeSearchCount == 6) - // Found 'PUBLIC' sequence - m_doctypeToken.setState(DoctypeBeforePublicID); - } else if (m_doctypeSearchCount > 0) { - m_doctypeSearchCount = 0; - m_doctypeToken.setState(DoctypeBogus); - } else if (toASCIILower(c) == systemStart[m_doctypeSecondarySearchCount]) { - m_doctypeSecondarySearchCount++; - if (m_doctypeSecondarySearchCount == 6) - // Found 'SYSTEM' sequence - m_doctypeToken.setState(DoctypeBeforeSystemID); - } else { - m_doctypeSecondarySearchCount = 0; - m_doctypeToken.setState(DoctypeBogus); - } - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else { - src.advance(m_lineNumber); // Whitespace keeps us in the after name state. - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeBeforePublicID: { - if (c == '\"' || c == '\'') { - tquote = c == '\"' ? DoubleQuote : SingleQuote; - m_doctypeToken.setState(DoctypePublicID); - src.advancePastNonNewline(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - } - case DoctypePublicID: { - if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { - src.advancePastNonNewline(); - m_doctypeToken.setState(DoctypeAfterPublicID); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else { - m_doctypeToken.m_publicID.append(c); - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - } - case DoctypeAfterPublicID: - if (c == '\"' || c == '\'') { - tquote = c == '\"' ? DoubleQuote : SingleQuote; - m_doctypeToken.setState(DoctypeSystemID); - src.advancePastNonNewline(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Valid doctype. Emit it now. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - case DoctypeBeforeSystemID: - if (c == '\"' || c == '\'') { - tquote = c == '\"' ? DoubleQuote : SingleQuote; - m_doctypeToken.setState(DoctypeSystemID); - src.advancePastNonNewline(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - case DoctypeSystemID: - if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { - src.advancePastNonNewline(); - m_doctypeToken.setState(DoctypeAfterSystemID); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else if (c == '>') { - // Considered bogus. Don't process the doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else { - m_doctypeToken.m_systemID.append(c); - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - case DoctypeAfterSystemID: - if (c == '>') { - // Valid doctype. Emit it now. - src.advancePastNonNewline(); - state.setInDoctype(false); - processDoctypeToken(); - } else if (isWhitespace) { - src.advance(m_lineNumber); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } else - m_doctypeToken.setState(DoctypeBogus); - break; - case DoctypeBogus: - if (c == '>') { - // Done with the bogus doctype. - src.advancePastNonNewline(); - state.setInDoctype(false); - if (inViewSourceMode()) - processDoctypeToken(); - } else { - src.advance(m_lineNumber); // Just keep scanning for '>' - if (inViewSourceMode()) - m_doctypeToken.m_source.append(c); - } - break; - default: - break; - } - } - return state; +#if ENABLE(INSPECTOR) + // FIXME: m_input.current().length() is only accurate if we + // end up parsing the whole buffer in this pump. We should pass how + // much we parsed as part of didWriteHTML instead of willWriteHTML. + if (InspectorTimelineAgent* timelineAgent = m_document->inspectorTimelineAgent()) + timelineAgent->willWriteHTML(m_input.current().length(), m_tokenizer->lineNumber()); +#endif } -HTMLDocumentParser::State HTMLDocumentParser::parseTag(SegmentedString& src, State state) +void HTMLDocumentParser::didPumpLexer() { - ASSERT(!state.hasEntityState()); - - unsigned cBufferPos = m_cBufferPos; - - bool lastIsSlash = false; - - while (!src.isEmpty()) { - checkBuffer(); - switch (state.tagState()) { - case NoTag: - { - m_cBufferPos = cBufferPos; - return state; - } - case TagName: - { - if (searchCount > 0) { - if (*src == commentStart[searchCount]) { - searchCount++; - if (searchCount == 2) - m_doctypeSearchCount++; // A '!' is also part of a doctype, so we are moving through that still as well. - else - m_doctypeSearchCount = 0; - if (searchCount == 4) { - // Found '<!--' sequence - src.advancePastNonNewline(); - m_dest = m_buffer; // ignore the previous part of this tag - state.setInComment(true); - state.setTagState(NoTag); - - // Fix bug 34302 at kde.bugs.org. Go ahead and treat - // <!--> as a valid comment, since both mozilla and IE on windows - // can handle this case. Only do this in quirks mode. -dwh - if (!src.isEmpty() && *src == '>' && m_doc->inCompatMode()) { - state.setInComment(false); - src.advancePastNonNewline(); - if (!src.isEmpty()) - m_cBuffer[cBufferPos++] = *src; - } else - state = parseComment(src, state); - - m_cBufferPos = cBufferPos; - return state; // Finished parsing tag! - } - m_cBuffer[cBufferPos++] = *src; - src.advancePastNonNewline(); - break; - } else - searchCount = 0; // Stop looking for '<!--' sequence - } - - if (m_doctypeSearchCount > 0) { - if (toASCIILower(*src) == doctypeStart[m_doctypeSearchCount]) { - m_doctypeSearchCount++; - m_cBuffer[cBufferPos++] = *src; - src.advancePastNonNewline(); - if (m_doctypeSearchCount == 9) { - // Found '<!DOCTYPE' sequence - state.setInDoctype(true); - state.setTagState(NoTag); - m_doctypeToken.reset(); - if (inViewSourceMode()) - m_doctypeToken.m_source.append(m_cBuffer, cBufferPos); - state = parseDoctype(src, state); - m_cBufferPos = cBufferPos; - return state; - } - break; - } else - m_doctypeSearchCount = 0; // Stop looking for '<!DOCTYPE' sequence - } - - bool finish = false; - unsigned int ll = min(src.length(), CBUFLEN - cBufferPos); - while (ll--) { - UChar curchar = *src; - if (isASCIISpace(curchar) || curchar == '>' || curchar == '<') { - finish = true; - break; - } - - // tolower() shows up on profiles. This is faster! - if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) - m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); - else - m_cBuffer[cBufferPos++] = curchar; - src.advancePastNonNewline(); - } - - // Disadvantage: we add the possible rest of the tag - // as attribute names. ### judge if this causes problems - if (finish || CBUFLEN == cBufferPos) { - bool beginTag; - UChar* ptr = m_cBuffer; - unsigned int len = cBufferPos; - m_cBuffer[cBufferPos] = '\0'; - if ((cBufferPos > 0) && (*ptr == '/')) { - // End Tag - beginTag = false; - ptr++; - len--; - } - else - // Start Tag - beginTag = true; - - // Ignore the / in fake xml tags like <br/>. We trim off the "/" so that we'll get "br" as the tag name and not "br/". - if (len > 1 && ptr[len-1] == '/' && !inViewSourceMode()) - ptr[--len] = '\0'; - - // Now that we've shaved off any invalid / that might have followed the name), make the tag. - // FIXME: FireFox and WinIE turn !foo nodes into comments, we ignore comments. (fast/parser/tag-with-exclamation-point.html) - if (ptr[0] != '!' || inViewSourceMode()) { - m_currentToken.tagName = AtomicString(ptr); - m_currentToken.beginTag = beginTag; - } - m_dest = m_buffer; - state.setTagState(SearchAttribute); - cBufferPos = 0; - } - break; - } - case SearchAttribute: - while (!src.isEmpty()) { - UChar curchar = *src; - // In this mode just ignore any quotes we encounter and treat them like spaces. - if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"') { - if (curchar == '<' || curchar == '>') - state.setTagState(SearchEnd); - else - state.setTagState(AttributeName); - - cBufferPos = 0; - break; - } - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - src.advance(m_lineNumber); - } - break; - case AttributeName: - { - m_rawAttributeBeforeValue.clear(); - int ll = min(src.length(), CBUFLEN - cBufferPos); - while (ll--) { - UChar curchar = *src; - // If we encounter a "/" when scanning an attribute name, treat it as a delimiter. This allows the - // cases like <input type=checkbox checked/> to work (and accommodates XML-style syntax as per HTML5). - if (curchar <= '>' && (curchar >= '<' || isASCIISpace(curchar) || curchar == '/')) { - m_cBuffer[cBufferPos] = '\0'; - m_attrName = AtomicString(m_cBuffer); - m_dest = m_buffer; - *m_dest++ = 0; - state.setTagState(SearchEqual); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('a'); - break; - } - - // tolower() shows up on profiles. This is faster! - if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) - m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); - else - m_cBuffer[cBufferPos++] = curchar; - - m_rawAttributeBeforeValue.append(curchar); - src.advance(m_lineNumber); - } - if (cBufferPos == CBUFLEN) { - m_cBuffer[cBufferPos] = '\0'; - m_attrName = AtomicString(m_cBuffer); - m_dest = m_buffer; - *m_dest++ = 0; - state.setTagState(SearchEqual); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('a'); - } - break; - } - case SearchEqual: - while (!src.isEmpty()) { - UChar curchar = *src; - - if (lastIsSlash && curchar == '>') { - // This is a quirk (with a long sad history). We have to do this - // since widgets do <script src="foo.js"/> and expect the tag to close. - if (m_currentToken.tagName == scriptTag) - m_currentToken.selfClosingTag = true; - m_currentToken.brokenXMLStyle = true; - } - - // In this mode just ignore any quotes or slashes we encounter and treat them like spaces. - if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"' && curchar != '/') { - if (curchar == '=') { - state.setTagState(SearchValue); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advancePastNonNewline(); - } else { - m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode()); - m_dest = m_buffer; - state.setTagState(SearchAttribute); - lastIsSlash = false; - } - break; - } - - lastIsSlash = curchar == '/'; - - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advance(m_lineNumber); - } - break; - case SearchValue: - while (!src.isEmpty()) { - UChar curchar = *src; - if (!isASCIISpace(curchar)) { - if (curchar == '\'' || curchar == '\"') { - tquote = curchar == '\"' ? DoubleQuote : SingleQuote; - state.setTagState(QuotedValue); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advancePastNonNewline(); - } else - state.setTagState(Value); - - break; - } - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - m_rawAttributeBeforeValue.append(curchar); - src.advance(m_lineNumber); - } - break; - case QuotedValue: - while (!src.isEmpty()) { - checkBuffer(); - - UChar curchar = *src; - if (curchar <= '>' && !src.escaped()) { - if (curchar == '>' && m_attrName.isEmpty()) { - // Handle a case like <img '>. Just go ahead and be willing - // to close the whole tag. Don't consume the character and - // just go back into SearchEnd while ignoring the whole - // value. - // FIXME: Note that this is actually not a very good solution. - // It doesn't handle the general case of - // unmatched quotes among attributes that have names. -dwh - while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) - m_dest--; // remove trailing newlines - AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); - if (!attributeValue.contains('/')) - m_attrName = attributeValue; // Just make the name/value match. (FIXME: Is this some WinIE quirk?) - m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('x'); - state.setTagState(SearchAttribute); - m_dest = m_buffer; - tquote = NoQuote; - break; - } - - if (curchar == '&') { - src.advancePastNonNewline(); - state = parseEntity(src, m_dest, state, cBufferPos, true, true); - break; - } - - if ((tquote == SingleQuote && curchar == '\'') || (tquote == DoubleQuote && curchar == '\"')) { - // some <input type=hidden> rely on trailing spaces. argh - while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) - m_dest--; // remove trailing newlines - AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); - if (m_attrName.isEmpty() && !attributeValue.contains('/')) { - m_attrName = attributeValue; // Make the name match the value. (FIXME: Is this a WinIE quirk?) - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('x'); - } else if (inViewSourceMode()) - m_currentToken.addViewSourceChar('v'); - - if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeConstructor->skipMode() && m_attrName == srcAttr) { - String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); - if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(attributeValue)) - attributeValue = blankURL().string(); - } - - m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); - m_dest = m_buffer; - state.setTagState(SearchAttribute); - tquote = NoQuote; - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - src.advancePastNonNewline(); - break; - } - } - - *m_dest++ = curchar; - src.advance(m_lineNumber); - } - break; - case Value: - while (!src.isEmpty()) { - checkBuffer(); - UChar curchar = *src; - if (curchar <= '>' && !src.escaped()) { - // parse Entities - if (curchar == '&') { - src.advancePastNonNewline(); - state = parseEntity(src, m_dest, state, cBufferPos, true, true); - break; - } - // no quotes. Every space means end of value - // '/' does not delimit in IE! - if (isASCIISpace(curchar) || curchar == '>') { - AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); - - if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeConstructor->skipMode() && m_attrName == srcAttr) { - String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); - if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(attributeValue)) - attributeValue = blankURL().string(); - } - - m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); - if (inViewSourceMode()) - m_currentToken.addViewSourceChar('v'); - m_dest = m_buffer; - state.setTagState(SearchAttribute); - break; - } - } - - *m_dest++ = curchar; - src.advance(m_lineNumber); - } - break; - case SearchEnd: - { - while (!src.isEmpty()) { - UChar ch = *src; - if (ch == '>' || ch == '<') - break; - if (ch == '/') - m_currentToken.selfClosingTag = true; - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(ch); - src.advance(m_lineNumber); - } - if (src.isEmpty()) - break; - - searchCount = 0; // Stop looking for '<!--' sequence - state.setTagState(NoTag); - tquote = NoQuote; - - if (*src != '<') - src.advance(m_lineNumber); - - if (m_currentToken.tagName == nullAtom) { //stop if tag is unknown - m_cBufferPos = cBufferPos; - return state; - } - - AtomicString tagName = m_currentToken.tagName; - - // Handle <script src="foo"/> like Mozilla/Opera. We have to do this now for Dashboard - // compatibility. - bool isSelfClosingScript = m_currentToken.selfClosingTag && m_currentToken.beginTag && m_currentToken.tagName == scriptTag; - bool beginTag = !m_currentToken.selfClosingTag && m_currentToken.beginTag; - if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeConstructor->skipMode()) { - Attribute* a = 0; - m_scriptTagSrcAttrValue = String(); - m_scriptTagCharsetAttrValue = String(); - if (m_currentToken.attrs && !m_fragment) { - if (m_doc->frame() && m_doc->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) { - if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) - m_scriptTagSrcAttrValue = m_doc->completeURL(deprecatedParseURL(a->value())).string(); - } - } - } - - RefPtr<Node> n = processToken(); - m_cBufferPos = cBufferPos; - if (n || inViewSourceMode()) { - State savedState = state; - SegmentedString savedSrc = src; - long savedLineno = m_lineNumber; - if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) { - if (beginTag) - state.setDiscardLF(true); // Discard the first LF after we open a pre. - } else if (tagName == scriptTag) { - ASSERT(!m_scriptNode); - m_scriptNode = static_pointer_cast<HTMLScriptElement>(n); - if (m_scriptNode) - m_scriptTagCharsetAttrValue = m_scriptNode->scriptCharset(); - if (beginTag) { - m_searchStopper = scriptEnd; - m_searchStopperLength = 8; - state.setInScript(true); - state = parseNonHTMLText(src, state); - } else if (isSelfClosingScript) { // Handle <script src="foo"/> - state.setInScript(true); - state = scriptHandler(state); - } - } else if (tagName == styleTag) { - if (beginTag) { - m_searchStopper = styleEnd; - m_searchStopperLength = 7; - state.setInStyle(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == textareaTag) { - if (beginTag) { - m_searchStopper = textareaEnd; - m_searchStopperLength = 10; - state.setInTextArea(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == titleTag) { - if (beginTag) { - m_searchStopper = titleEnd; - m_searchStopperLength = 7; - state.setInTitle(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == xmpTag) { - if (beginTag) { - m_searchStopper = xmpEnd; - m_searchStopperLength = 5; - state.setInXmp(true); - state = parseNonHTMLText(src, state); - } - } else if (tagName == iframeTag) { - if (beginTag) { - m_searchStopper = iframeEnd; - m_searchStopperLength = 8; - state.setInIFrame(true); - state = parseNonHTMLText(src, state); - } - } - if (src.isEmpty() && (state.inTitle() || inViewSourceMode()) && !state.inComment() && !(state.inScript() && m_currentScriptTagStartLineNumber)) { - // We just ate the rest of the document as the #text node under the special tag! - // Reset the state then retokenize without special handling. - // Let the parser clean up the missing close tag. - // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're - // at the end of the document unless m_noMoreData is also true. We need - // to detect this case elsewhere, and save the state somewhere other - // than a local variable. - state = savedState; - src = savedSrc; - m_lineNumber = savedLineno; - m_scriptCodeSize = 0; - } - } - if (tagName == plaintextTag) - state.setInPlainText(beginTag); - return state; // Finished parsing tag! - } - } // end switch - } - m_cBufferPos = cBufferPos; - return state; +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = m_document->inspectorTimelineAgent()) + timelineAgent->didWriteHTML(m_tokenizer->lineNumber()); +#endif } -inline bool HTMLDocumentParser::continueProcessing(int& processedCount, double startTime, State &state) +void HTMLDocumentParser::write(const SegmentedString& source, bool isFromNetwork) { - // We don't want to be checking elapsed time with every character, so we only check after we've - // processed a certain number of characters. - bool allowedYield = state.allowYield(); - state.setAllowYield(false); - if (!state.loadingExtScript() && !state.forceSynchronous() && !m_executingScript && (processedCount > m_tokenizerChunkSize || allowedYield)) { - processedCount = 0; - if (currentTime() - startTime > m_tokenizerTimeDelay) { - /* FIXME: We'd like to yield aggressively to give stylesheets the opportunity to - load, but this hurts overall performance on slower machines. For now turn this - off. - || (!m_doc->haveStylesheetsLoaded() && - (m_doc->documentElement()->id() != ID_HTML || m_doc->body()))) {*/ - // Schedule the timer to keep processing as soon as possible. - m_timer.startOneShot(0); - return false; - } - } + if (m_parserStopped) + return; - processedCount++; - return true; -} + NestingLevelIncrementer nestingLevelIncrementer(m_writeNestingLevel); -// Turns the statemachine one crank using the passed in State object. -// This does not modify m_state directly in order to be reentrant. -ALWAYS_INLINE void HTMLDocumentParser::advance(State& state) -{ - // do we need to enlarge the buffer? - checkBuffer(); - - UChar cc = *m_src; - - bool wasSkipLF = state.skipLF(); - if (wasSkipLF) - state.setSkipLF(false); - - if (wasSkipLF && (cc == '\n')) - m_src.advance(); - else if (state.needsSpecialWriteHandling()) { - // it's important to keep needsSpecialWriteHandling with the flags this block tests - if (state.hasEntityState()) - state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); - else if (state.inPlainText()) - state = parseText(m_src, state); - else if (state.inAnyNonHTMLText()) - state = parseNonHTMLText(m_src, state); - else if (state.inComment()) - state = parseComment(m_src, state); - else if (state.inDoctype()) - state = parseDoctype(m_src, state); - else if (state.inServer()) - state = parseServer(m_src, state); - else if (state.inProcessingInstruction()) - state = parseProcessingInstruction(m_src, state); - else if (state.hasTagState()) - state = parseTag(m_src, state); - else if (state.startTag()) { - state.setStartTag(false); - - switch (cc) { - case '/': - break; - case '!': { - // <!-- comment --> or <!DOCTYPE ...> - searchCount = 1; // Look for '<!--' sequence to start comment or '<!DOCTYPE' sequence to start doctype - m_doctypeSearchCount = 1; - break; - } - case '?': { - // xml processing instruction - state.setInProcessingInstruction(true); - tquote = NoQuote; - state = parseProcessingInstruction(m_src, state); - return; - } - case '%': - if (!m_brokenServer) { - // <% server stuff, handle as comment %> - state.setInServer(true); - tquote = NoQuote; - state = parseServer(m_src, state); - return; - } - // else fall through - default: { - if (((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) { - // Start of a Start-Tag - } else { - // Invalid tag - // Add as is - *m_dest = '<'; - m_dest++; - return; - } - } - }; // end case - - processToken(); - - m_cBufferPos = 0; - state.setTagState(TagName); - state = parseTag(m_src, state); - } - } else if (cc == '&' && !m_src.escaped()) { - m_src.advancePastNonNewline(); - state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState()); - } else if (cc == '<' && !m_src.escaped()) { - m_currentTagStartLineNumber = m_lineNumber; - m_src.advancePastNonNewline(); - state.setStartTag(true); - state.setDiscardLF(false); - } else if (cc == '\n' || cc == '\r') { - if (state.discardLF()) - // Ignore this LF - state.setDiscardLF(false); // We have discarded 1 LF - else { - // Process this LF - *m_dest++ = '\n'; - if (cc == '\r' && !m_src.excludeLineNumbers()) - m_lineNumber++; + if (isFromNetwork) { + m_input.appendToEnd(source); + if (m_preloadScanner) + m_preloadScanner->appendToEnd(source); + + if (m_writeNestingLevel > 1) { + // We've gotten data off the network in a nested call to write(). + // We don't want to consume any more of the input stream now. Do + // not worry. We'll consume this data in a less-nested write(). + return; } + } else + m_input.insertAtCurrentInsertionPoint(source); - /* Check for MS-DOS CRLF sequence */ - if (cc == '\r') - state.setSkipLF(true); - m_src.advance(m_lineNumber); - } else { - state.setDiscardLF(false); - *m_dest++ = cc; - m_src.advancePastNonNewline(); - } + pumpTokenizerIfPossible(isFromNetwork ? AllowYield : ForceSynchronous); + endIfDelayed(); } -void HTMLDocumentParser::willWriteHTML(const SegmentedString& source) +void HTMLDocumentParser::end() { - #if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent()) - timelineAgent->willWriteHTML(source.length(), m_lineNumber); - #endif -} + ASSERT(!isScheduledForResume()); + // NOTE: This pump should only ever emit buffered character tokens, + // so ForceSynchronous vs. AllowYield should be meaningless. + pumpTokenizerIfPossible(ForceSynchronous); -void HTMLDocumentParser::didWriteHTML() -{ - #if ENABLE(INSPECTOR) - if (InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent()) - timelineAgent->didWriteHTML(m_lineNumber); - #endif + // Informs the the rest of WebCore that parsing is really finished (and deletes this). + m_treeBuilder->finished(); } -void HTMLDocumentParser::write(const SegmentedString& str, bool appendData) +void HTMLDocumentParser::attemptToEnd() { - if (!m_buffer) - return; - - if (m_parserStopped) - return; + // finish() indicates we will not receive any more data. If we are waiting on + // an external script to load, we can't finish parsing quite yet. - SegmentedString source(str); - if (m_executingScript) - source.setExcludeLineNumbers(); - - if ((m_executingScript && appendData) || !m_pendingScripts.isEmpty()) { - // don't parse; we will do this later - if (m_currentPrependingSrc) - m_currentPrependingSrc->append(source); - else { - m_pendingSrc.append(source); -#if PRELOAD_SCANNER_ENABLED - if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) - m_preloadScanner->write(source); -#endif - } + if (inWrite() || isWaitingForScripts() || inScriptExecution() || isScheduledForResume()) { + m_endWasDelayed = true; return; } +<<<<<<< HEAD #if PRELOAD_SCANNER_ENABLED if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) @@ -1812,321 +517,151 @@ void HTMLDocumentParser::write(const SegmentedString& str, bool appendData) // After parsing, go ahead and dispatch image beforeload events. ImageLoader::dispatchPendingBeforeLoadEvents(); +======= + end(); +>>>>>>> webkit.org at r61871 } -void HTMLDocumentParser::stopParsing() +void HTMLDocumentParser::endIfDelayed() { - DocumentParser::stopParsing(); - m_timer.stop(); + // We don't check inWrite() here since inWrite() will be true if this was + // called from write(). + if (!m_endWasDelayed || isWaitingForScripts() || inScriptExecution() || isScheduledForResume()) + return; - // FIXME: Why is HTMLDocumentParser the only DocumentParser which calls checkCompleted? - // The FrameLoader needs to know that the parser has finished with its data, - // regardless of whether it happened naturally or due to manual intervention. - if (!m_fragment && m_doc->frame()) - m_doc->frame()->loader()->checkCompleted(); + m_endWasDelayed = false; + end(); } -bool HTMLDocumentParser::processingData() const +void HTMLDocumentParser::finish() { - return m_timer.isActive() || m_inWrite; + // We're not going to get any more data off the network, so we close the + // input stream to indicate EOF. + m_input.close(); + attemptToEnd(); } -void HTMLDocumentParser::timerFired(Timer<HTMLDocumentParser>*) +bool HTMLDocumentParser::finishWasCalled() { - if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) { - // Restart the timer and let layout win. This is basically a way of ensuring that the layout - // timer has higher priority than our timer. - m_timer.startOneShot(0); - return; - } - - // Invoke write() as though more data came in. This might cause us to get deleted. - write(SegmentedString(), true); + return m_input.isClosed(); } -void HTMLDocumentParser::end() +// This function is virtual and just for the DocumentParser interface. +bool HTMLDocumentParser::isExecutingScript() const { - ASSERT(!m_timer.isActive()); - m_timer.stop(); // Only helps if assertion above fires, but do it anyway. - - if (m_buffer) { - // parseTag is using the buffer for different matters - if (!m_state.hasTagState()) - processToken(); - - fastFree(m_scriptCode); - m_scriptCode = 0; - m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; - - fastFree(m_buffer); - m_buffer = 0; - } - - if (!inViewSourceMode()) - m_treeConstructor->finished(); - else - m_doc->finishedParsing(); + return inScriptExecution(); } -void HTMLDocumentParser::finish() +// This function is non-virtual and used throughout the implementation. +bool HTMLDocumentParser::inScriptExecution() const { - // do this as long as we don't find matching comment ends - while ((m_state.inComment() || m_state.inServer()) && m_scriptCode && m_scriptCodeSize) { - // we've found an unmatched comment start - if (m_state.inComment()) - m_brokenComments = true; - else - m_brokenServer = true; - checkScriptBuffer(); - m_scriptCode[m_scriptCodeSize] = 0; - m_scriptCode[m_scriptCodeSize + 1] = 0; - int pos; - String food; - if (m_state.inScript() || m_state.inStyle() || m_state.inTextArea()) - food = String(m_scriptCode, m_scriptCodeSize); - else if (m_state.inServer()) { - food = "<"; - food.append(m_scriptCode, m_scriptCodeSize); - } else { - pos = find(m_scriptCode, m_scriptCodeSize, '>'); - food = String(m_scriptCode + pos + 1, m_scriptCodeSize - pos - 1); - } - fastFree(m_scriptCode); - m_scriptCode = 0; - m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; - m_state.setInComment(false); - m_state.setInServer(false); - if (!food.isEmpty()) - write(food, true); - } - // this indicates we will not receive any more data... but if we are waiting on - // an external script to load, we can't finish parsing until that is done - m_noMoreData = true; - if (!m_inWrite && !m_state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) - end(); // this actually causes us to be deleted + if (!m_scriptRunner) + return false; + return m_scriptRunner->inScriptExecution(); } -PassRefPtr<Node> HTMLDocumentParser::processToken() +int HTMLDocumentParser::lineNumber() const { - ScriptController* scriptController = (!m_fragment && m_doc->frame()) ? m_doc->frame()->script() : 0; - if (scriptController && scriptController->canExecuteScripts(NotAboutToExecuteScript)) - // FIXME: Why isn't this m_currentScriptTagStartLineNumber? I suspect this is wrong. - scriptController->setEventHandlerLineNumber(m_currentTagStartLineNumber + 1); // Script line numbers are 1 based. - if (m_dest > m_buffer) { - m_currentToken.text = StringImpl::createStrippingNullCharacters(m_buffer, m_dest - m_buffer); - if (m_currentToken.tagName != commentAtom) - m_currentToken.tagName = textAtom; - } else if (m_currentToken.tagName == nullAtom) { - m_currentToken.reset(); - if (scriptController) - scriptController->setEventHandlerLineNumber(m_lineNumber + 1); // Script line numbers are 1 based. - return 0; - } - - m_dest = m_buffer; - - RefPtr<Node> n; - - if (!m_parserStopped) { - if (NamedNodeMap* map = m_currentToken.attrs.get()) - map->shrinkToLength(); - if (inViewSourceMode()) - static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceToken(&m_currentToken); - else - // pass the token over to the parser, the parser DOES NOT delete the token - n = m_treeConstructor->parseToken(&m_currentToken); - } - m_currentToken.reset(); - if (scriptController) - scriptController->setEventHandlerLineNumber(0); - - return n.release(); + return m_tokenizer->lineNumber(); } -void HTMLDocumentParser::processDoctypeToken() +int HTMLDocumentParser::columnNumber() const { - if (inViewSourceMode()) - static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceDoctypeToken(&m_doctypeToken); - else - m_treeConstructor->parseDoctypeToken(&m_doctypeToken); + return m_tokenizer->columnNumber(); } -HTMLDocumentParser::~HTMLDocumentParser() +LegacyHTMLTreeBuilder* HTMLDocumentParser::htmlTreeBuilder() const { - ASSERT(!m_inWrite); - reset(); + return m_treeBuilder->legacyTreeBuilder(); } - -void HTMLDocumentParser::enlargeBuffer(int len) +bool HTMLDocumentParser::isWaitingForScripts() const { - // Resize policy: Always at least double the size of the buffer each time. - int delta = max(len, m_bufferSize); - - // Check for overflow. - // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. - static const int maxSize = INT_MAX / sizeof(UChar); - if (delta > maxSize - m_bufferSize) - CRASH(); - - int newSize = m_bufferSize + delta; - int oldOffset = m_dest - m_buffer; - m_buffer = static_cast<UChar*>(fastRealloc(m_buffer, newSize * sizeof(UChar))); - m_dest = m_buffer + oldOffset; - m_bufferSize = newSize; + return m_treeBuilder->isPaused(); } -void HTMLDocumentParser::enlargeScriptBuffer(int len) +void HTMLDocumentParser::resumeParsingAfterScriptExecution() { - // Resize policy: Always at least double the size of the buffer each time. - int delta = max(len, m_scriptCodeCapacity); - - // Check for overflow. - // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. - static const int maxSize = INT_MAX / sizeof(UChar); - if (delta > maxSize - m_scriptCodeCapacity) - CRASH(); - - int newSize = m_scriptCodeCapacity + delta; - // If we allow fastRealloc(ptr, 0), it will call CRASH(). We run into this - // case if the HTML being parsed begins with "<!--" and there's more data - // coming. - if (!newSize) { - ASSERT(!m_scriptCode); - return; - } + ASSERT(!inScriptExecution()); + ASSERT(!m_treeBuilder->isPaused()); - m_scriptCode = static_cast<UChar*>(fastRealloc(m_scriptCode, newSize * sizeof(UChar))); - m_scriptCodeCapacity = newSize; -} + pumpTokenizerIfPossible(AllowYield); -void HTMLDocumentParser::executeScriptsWaitingForStylesheets() -{ - ASSERT(m_doc->haveStylesheetsLoaded()); - - if (m_hasScriptsWaitingForStylesheets) - notifyFinished(0); + // The document already finished parsing we were just waiting on scripts when finished() was called. + endIfDelayed(); } -void HTMLDocumentParser::notifyFinished(CachedResource*) +void HTMLDocumentParser::watchForLoad(CachedResource* cachedScript) { - executeExternalScriptsIfReady(); + cachedScript->addClient(this); } -void HTMLDocumentParser::executeExternalScriptsIfReady() +void HTMLDocumentParser::stopWatchingForLoad(CachedResource* cachedScript) { - ASSERT(!m_pendingScripts.isEmpty()); - - // Make external scripts wait for external stylesheets. - // FIXME: This needs to be done for inline scripts too. - m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded(); - if (m_hasScriptsWaitingForStylesheets) - return; - - bool finished = false; - - double startTime = currentTime(); - while (!finished && m_pendingScripts.first()->isLoaded()) { - if (!continueExecutingExternalScripts(startTime)) - break; - - CachedScript* cs = m_pendingScripts.takeFirst().get(); - ASSERT(cache()->disabled() || cs->accessCount() > 0); - - setSrc(SegmentedString()); - - // make sure we forget about the script before we execute the new one - // infinite recursion might happen otherwise - ScriptSourceCode sourceCode(cs); - bool errorOccurred = cs->errorOccurred(); - cs->removeClient(this); - - RefPtr<Node> n = m_scriptNode.release(); - - if (errorOccurred) - n->dispatchEvent(Event::create(eventNames().errorEvent, true, false)); - else { - if (static_cast<HTMLScriptElement*>(n.get())->shouldExecuteAsJavaScript()) - m_state = scriptExecution(sourceCode, m_state); -#if ENABLE(XHTMLMP) - else - m_doc->setShouldProcessNoscriptElement(true); -#endif - n->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); - } - - // The state of m_pendingScripts.isEmpty() can change inside the scriptExecution() - // call above, so test afterwards. - finished = m_pendingScripts.isEmpty(); - if (finished) { - ASSERT(!m_hasScriptsWaitingForStylesheets); - m_state.setLoadingExtScript(false); - } else if (m_hasScriptsWaitingForStylesheets) { - // m_hasScriptsWaitingForStylesheets flag might have changed during the script execution. - // If it did we are now blocked waiting for stylesheets and should not execute more scripts until they arrive. - finished = true; - } - - // 'm_requestingScript' is true when we are called synchronously from - // scriptHandler(). In that case scriptHandler() will take care - // of m_pendingSrc. - if (!m_requestingScript) { - SegmentedString rest = m_pendingSrc; - m_pendingSrc.clear(); - write(rest, false); - // we might be deleted at this point, do not access any members. - } - } + cachedScript->removeClient(this); } -void HTMLDocumentParser::executeExternalScriptsTimerFired(Timer<HTMLDocumentParser>*) +bool HTMLDocumentParser::shouldLoadExternalScriptFromSrc(const AtomicString& srcValue) { - if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) { - // Restart the timer and do layout first. - m_externalScriptsTimer.startOneShot(0); - return; - } - - // Continue executing external scripts. - executeExternalScriptsIfReady(); + if (!m_XSSAuditor) + return true; + return m_XSSAuditor->canLoadExternalScriptFromSrc(srcValue); } -bool HTMLDocumentParser::continueExecutingExternalScripts(double startTime) +void HTMLDocumentParser::notifyFinished(CachedResource* cachedResource) { - if (m_externalScriptsTimer.isActive()) - return false; - - if (currentTime() - startTime > m_tokenizerTimeDelay) { - // Schedule the timer to keep processing as soon as possible. - m_externalScriptsTimer.startOneShot(0); - return false; + ASSERT(m_scriptRunner); + // Ignore calls unless we have a script blocking the parser waiting + // for its own load. Otherwise this may be a load callback from + // CachedResource::addClient because the script was already in the cache. + // HTMLScriptRunner may not be ready to handle running that script yet. + if (!m_scriptRunner->hasScriptsWaitingForLoad()) { + ASSERT(m_scriptRunner->inScriptExecution()); + return; } - return true; + ASSERT(!inScriptExecution()); + ASSERT(m_treeBuilder->isPaused()); + // Note: We only ever wait on one script at a time, so we always know this + // is the one we were waiting on and can un-pause the tree builder. + m_treeBuilder->setPaused(false); + bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForLoad(cachedResource); + m_treeBuilder->setPaused(!shouldContinueParsing); + if (shouldContinueParsing) + resumeParsingAfterScriptExecution(); } -bool HTMLDocumentParser::isWaitingForScripts() const +void HTMLDocumentParser::executeScriptsWaitingForStylesheets() { - return m_state.loadingExtScript(); + // Document only calls this when the Document owns the DocumentParser + // so this will not be called in the DocumentFragment case. + ASSERT(m_scriptRunner); + // Ignore calls unless we have a script blocking the parser waiting on a + // stylesheet load. Otherwise we are currently parsing and this + // is a re-entrant call from encountering a </ style> tag. + if (!m_scriptRunner->hasScriptsWaitingForStylesheets()) + return; + ASSERT(!m_scriptRunner->inScriptExecution()); + ASSERT(m_treeBuilder->isPaused()); + // Note: We only ever wait on one script at a time, so we always know this + // is the one we were waiting on and can un-pause the tree builder. + m_treeBuilder->setPaused(false); + bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForStylesheets(); + m_treeBuilder->setPaused(!shouldContinueParsing); + if (shouldContinueParsing) + resumeParsingAfterScriptExecution(); } -void HTMLDocumentParser::setSrc(const SegmentedString& source) +ScriptController* HTMLDocumentParser::script() const { - m_src = source; + return m_document->frame() ? m_document->frame()->script() : 0; } -void parseHTMLDocumentFragment(const String& source, DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) +void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) { HTMLDocumentParser parser(fragment, scriptingPermission); - parser.setForceSynchronous(true); - parser.write(source, true); + parser.write(source, false); parser.finish(); - ASSERT(!parser.processingData()); // make sure we're done (see 3963151) -} - -UChar decodeNamedEntity(const char* name) -{ - const Entity* e = findEntity(name, strlen(name)); - return e ? e->code : 0; + ASSERT(!parser.processingData()); // Make sure we're done. <rdar://problem/3963151> } } diff --git a/WebCore/html/HTMLDocumentParser.h b/WebCore/html/HTMLDocumentParser.h index 6072a7e..c2e752f 100644 --- a/WebCore/html/HTMLDocumentParser.h +++ b/WebCore/html/HTMLDocumentParser.h @@ -1,448 +1,131 @@ /* - Copyright (C) 1997 Martin Jones (mjones@kde.org) - (C) 1997 Torben Weis (weis@kde.org) - (C) 1998 Waldo Bastian (bastian@kde.org) - (C) 2001 Dirk Mueller (mueller@kde.org) - Copyright (C) 2003, 2004, 2005, 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. -*/ + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTMLTokenizer_h -#define HTMLTokenizer_h +#ifndef HTMLDocumentParser_h +#define HTMLDocumentParser_h #include "CachedResourceClient.h" -#include "CachedResourceHandle.h" -#include "MappedAttributeEntry.h" -#include "NamedNodeMap.h" +#include "FragmentScriptingPermission.h" +#include "HTMLScriptRunnerHost.h" +#include "HTMLToken.h" +#include "HTMLInputStream.h" #include "SegmentedString.h" -#include "Timer.h" #include "DocumentParser.h" -#include <wtf/Deque.h> +#include "Timer.h" #include <wtf/OwnPtr.h> -#include <wtf/Vector.h> namespace WebCore { -class CachedScript; -class DocumentFragment; class Document; +class DocumentFragment; class HTMLDocument; -class HTMLScriptElement; -class HTMLViewSourceDocument; -class FrameView; -class LegacyHTMLTreeConstructor; -class Node; -class PreloadScanner; +class HTMLParserScheduler; +class HTMLTokenizer; +class HTMLScriptRunner; +class HTMLTreeBuilder; +class HTMLPreloadScanner; +class LegacyHTMLTreeBuilder; +class ScriptController; class ScriptSourceCode; -/** - * @internal - * represents one HTML tag. Consists of a numerical id, and the list - * of attributes. Can also represent text. In this case the id = 0 and - * text contains the text. - */ -struct Token { - Token() - : beginTag(true) - , selfClosingTag(false) - , brokenXMLStyle(false) - , m_sourceInfo(0) - { } - ~Token() { } - - void addAttribute(AtomicString& attrName, const AtomicString& v, bool viewSourceMode); - - bool isOpenTag(const QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; } - bool isCloseTag(const QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; } - - void reset() - { - attrs = 0; - text = 0; - tagName = nullAtom; - beginTag = true; - selfClosingTag = false; - brokenXMLStyle = false; - if (m_sourceInfo) - m_sourceInfo->clear(); - } - - void addViewSourceChar(UChar c) { if (!m_sourceInfo.get()) m_sourceInfo.set(new Vector<UChar>); m_sourceInfo->append(c); } - - RefPtr<NamedNodeMap> attrs; - RefPtr<StringImpl> text; - AtomicString tagName; - bool beginTag; - bool selfClosingTag; - bool brokenXMLStyle; - OwnPtr<Vector<UChar> > m_sourceInfo; -}; - -enum DoctypeState { - DoctypeBegin, - DoctypeBeforeName, - DoctypeName, - DoctypeAfterName, - DoctypeBeforePublicID, - DoctypePublicID, - DoctypeAfterPublicID, - DoctypeBeforeSystemID, - DoctypeSystemID, - DoctypeAfterSystemID, - DoctypeBogus -}; - -class DoctypeToken { -public: - DoctypeToken() {} - - void reset() - { - m_name.clear(); - m_publicID.clear(); - m_systemID.clear(); - m_state = DoctypeBegin; - m_source.clear(); - m_forceQuirks = false; - } - - DoctypeState state() { return m_state; } - void setState(DoctypeState s) { m_state = s; } - - Vector<UChar> m_name; - Vector<UChar> m_publicID; - Vector<UChar> m_systemID; - DoctypeState m_state; - - Vector<UChar> m_source; - - bool m_forceQuirks; // Used by the HTML5 parser. -}; - -//----------------------------------------------------------------------------- - -// FIXME: This class does too much. Right now it is both an HTML lexer as well -// as handling all of the non-lexer-specific junk related to tokenizing HTML -// (like dealing with <script> tags). The HTML lexer bits should be pushed -// down into a separate HTML lexer class. - -class HTMLDocumentParser : public DocumentParser, public CachedResourceClient { +class HTMLDocumentParser : public DocumentParser, HTMLScriptRunnerHost, CachedResourceClient { public: + // FIXME: These constructors should be made private and replaced by create() methods. HTMLDocumentParser(HTMLDocument*, bool reportErrors); - HTMLDocumentParser(HTMLViewSourceDocument*); - HTMLDocumentParser(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + HTMLDocumentParser(DocumentFragment*, FragmentScriptingPermission); virtual ~HTMLDocumentParser(); - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool forceSynchronous() const { return m_state.forceSynchronous(); } - virtual void setForceSynchronous(bool force); - virtual bool isWaitingForScripts() const; - virtual void stopParsing(); - virtual bool processingData() const; - virtual int executingScript() const { return m_executingScript; } - - virtual int lineNumber() const { return m_lineNumber; } - virtual int columnNumber() const { return 1; } - - bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); } - - virtual void executeScriptsWaitingForStylesheets(); + // Exposed for HTMLParserScheduler + void resumeParsingAfterYield(); - virtual LegacyHTMLTreeConstructor* htmlTreeConstructor() const { return m_treeConstructor.get(); } - virtual HTMLDocumentParser* asHTMLDocumentParser() { return this; } + static void parseDocumentFragment(const String&, DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); private: - class State; - - // Where we are in parsing a tag - void begin(); - void end(); - - void reset(); - - void willWriteHTML(const SegmentedString&); - ALWAYS_INLINE void advance(State&); - void didWriteHTML(); - - PassRefPtr<Node> processToken(); - void processDoctypeToken(); - - State processListing(SegmentedString, State); - State parseComment(SegmentedString&, State); - State parseDoctype(SegmentedString&, State); - State parseServer(SegmentedString&, State); - State parseText(SegmentedString&, State); - State parseNonHTMLText(SegmentedString&, State); - State parseTag(SegmentedString&, State); - State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag); - State parseProcessingInstruction(SegmentedString&, State); - State scriptHandler(State); - State scriptExecution(const ScriptSourceCode&, State); - void setSrc(const SegmentedString&); - - // check if we have enough space in the buffer. - // if not enlarge it - inline void checkBuffer(int len = 10) - { - if ((m_dest - m_buffer) > m_bufferSize - len) - enlargeBuffer(len); - } - - inline void checkScriptBuffer(int len = 10) - { - if (m_scriptCodeSize + len >= m_scriptCodeCapacity) - enlargeScriptBuffer(len); - } - - void enlargeBuffer(int len); - void enlargeScriptBuffer(int len); - - bool continueProcessing(int& processedCount, double startTime, State&); - void timerFired(Timer<HTMLDocumentParser>*); - void allDataProcessed(); - - // from CachedResourceClient - void notifyFinished(CachedResource*); - - void executeExternalScriptsIfReady(); - void executeExternalScriptsTimerFired(Timer<HTMLDocumentParser>*); - bool continueExecutingExternalScripts(double startTime); - - // Internal buffers - /////////////////// - UChar* m_buffer; - int m_bufferSize; - UChar* m_dest; - - Token m_currentToken; - - // This buffer holds the raw characters we've seen between the beginning of - // the attribute name and the first character of the attribute value. - Vector<UChar, 32> m_rawAttributeBeforeValue; - - // DocumentParser flags - ////////////////// - // are we in quotes within a html tag - enum { NoQuote, SingleQuote, DoubleQuote } tquote; - - // Are we in a &... character entity description? - enum EntityState { - NoEntity = 0, - SearchEntity = 1, - NumericSearch = 2, - Hexadecimal = 3, - Decimal = 4, - EntityName = 5, - SearchSemicolon = 6 - }; - unsigned EntityUnicodeValue; - - enum TagState { - NoTag = 0, - TagName = 1, - SearchAttribute = 2, - AttributeName = 3, - SearchEqual = 4, - SearchValue = 5, - QuotedValue = 6, - Value = 7, - SearchEnd = 8 - }; - - class State { - public: - State() : m_bits(0) { } - - TagState tagState() const { return static_cast<TagState>(m_bits & TagMask); } - void setTagState(TagState t) { m_bits = (m_bits & ~TagMask) | t; } - EntityState entityState() const { return static_cast<EntityState>((m_bits & EntityMask) >> EntityShift); } - void setEntityState(EntityState e) { m_bits = (m_bits & ~EntityMask) | (e << EntityShift); } - - bool inScript() const { return testBit(InScript); } - void setInScript(bool v) { setBit(InScript, v); } - bool inStyle() const { return testBit(InStyle); } - void setInStyle(bool v) { setBit(InStyle, v); } - bool inXmp() const { return testBit(InXmp); } - void setInXmp(bool v) { setBit(InXmp, v); } - bool inTitle() const { return testBit(InTitle); } - void setInTitle(bool v) { setBit(InTitle, v); } - bool inIFrame() const { return testBit(InIFrame); } - void setInIFrame(bool v) { setBit(InIFrame, v); } - bool inPlainText() const { return testBit(InPlainText); } - void setInPlainText(bool v) { setBit(InPlainText, v); } - bool inProcessingInstruction() const { return testBit(InProcessingInstruction); } - void setInProcessingInstruction(bool v) { return setBit(InProcessingInstruction, v); } - bool inComment() const { return testBit(InComment); } - void setInComment(bool v) { setBit(InComment, v); } - bool inDoctype() const { return testBit(InDoctype); } - void setInDoctype(bool v) { setBit(InDoctype, v); } - bool inTextArea() const { return testBit(InTextArea); } - void setInTextArea(bool v) { setBit(InTextArea, v); } - bool escaped() const { return testBit(Escaped); } - void setEscaped(bool v) { setBit(Escaped, v); } - bool inServer() const { return testBit(InServer); } - void setInServer(bool v) { setBit(InServer, v); } - bool skipLF() const { return testBit(SkipLF); } - void setSkipLF(bool v) { setBit(SkipLF, v); } - bool startTag() const { return testBit(StartTag); } - void setStartTag(bool v) { setBit(StartTag, v); } - bool discardLF() const { return testBit(DiscardLF); } - void setDiscardLF(bool v) { setBit(DiscardLF, v); } - bool allowYield() const { return testBit(AllowYield); } - void setAllowYield(bool v) { setBit(AllowYield, v); } - bool loadingExtScript() const { return testBit(LoadingExtScript); } - void setLoadingExtScript(bool v) { setBit(LoadingExtScript, v); } - bool forceSynchronous() const { return testBit(ForceSynchronous); } - void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); } - - bool inAnyNonHTMLText() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); } - bool hasTagState() const { return m_bits & TagMask; } - bool hasEntityState() const { return m_bits & EntityMask; } - - bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame | TagMask | EntityMask | InPlainText | InComment | InDoctype | InServer | InProcessingInstruction | StartTag); } - - private: - static const int EntityShift = 4; - enum StateBits { - TagMask = (1 << 4) - 1, - EntityMask = (1 << 7) - (1 << 4), - InScript = 1 << 7, - InStyle = 1 << 8, - // Bit 9 unused - InXmp = 1 << 10, - InTitle = 1 << 11, - InPlainText = 1 << 12, - InProcessingInstruction = 1 << 13, - InComment = 1 << 14, - InTextArea = 1 << 15, - Escaped = 1 << 16, - InServer = 1 << 17, - SkipLF = 1 << 18, - StartTag = 1 << 19, - DiscardLF = 1 << 20, // FIXME: should clarify difference between skip and discard - AllowYield = 1 << 21, - LoadingExtScript = 1 << 22, - ForceSynchronous = 1 << 23, - InIFrame = 1 << 24, - InDoctype = 1 << 25 - }; - - void setBit(StateBits bit, bool value) - { - if (value) - m_bits |= bit; - else - m_bits &= ~bit; - } - bool testBit(StateBits bit) const { return m_bits & bit; } - - unsigned m_bits; + // DocumentParser + virtual void begin(); + virtual void write(const SegmentedString&, bool isFromNetwork); + virtual void finish(); + virtual bool finishWasCalled(); + virtual bool processingData() const; + virtual void stopParsing(); + virtual bool isWaitingForScripts() const; + virtual bool isExecutingScript() const; + virtual void executeScriptsWaitingForStylesheets(); + virtual int lineNumber() const; + virtual int columnNumber() const; + // FIXME: HTMLFormControlElement accesses the LegacyHTMLTreeBuilder via this method. + // Remove this when the LegacyHTMLTreeBuilder is no longer used. + virtual LegacyHTMLTreeBuilder* htmlTreeBuilder() const; + + // HTMLScriptRunnerHost + virtual void watchForLoad(CachedResource*); + virtual void stopWatchingForLoad(CachedResource*); + virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&); + virtual HTMLInputStream& inputStream() { return m_input; } + + // CachedResourceClient + virtual void notifyFinished(CachedResource*); + + void willPumpLexer(); + void didPumpLexer(); + + enum SynchronousMode { + AllowYield, + ForceSynchronous, }; + void pumpTokenizer(SynchronousMode); + void pumpTokenizerIfPossible(SynchronousMode); - State m_state; - - DoctypeToken m_doctypeToken; - int m_doctypeSearchCount; - int m_doctypeSecondarySearchCount; - - bool m_brokenServer; - - // Name of an attribute that we just scanned. - AtomicString m_attrName; + bool runScriptsForPausedTreeBuilder(); + void resumeParsingAfterScriptExecution(); - // Used to store the code of a scripting sequence - UChar* m_scriptCode; - // Size of the script sequenze stored in @ref #scriptCode - int m_scriptCodeSize; - // Maximal size that can be stored in @ref #scriptCode - int m_scriptCodeCapacity; - // resync point of script code size - int m_scriptCodeResync; - - // Stores characters if we are scanning for a string like "</script>" - UChar searchBuffer[10]; - - // Counts where we are in the string we are scanning for - int searchCount; - // the stopper string - const char* m_searchStopper; - int m_searchStopperLength; - - // if no more data is coming, just parse what we have (including ext scripts that - // may be still downloading) and finish - bool m_noMoreData; - // URL to get source code of script from - String m_scriptTagSrcAttrValue; - String m_scriptTagCharsetAttrValue; - // the HTML code we will parse after the external script we are waiting for has loaded - SegmentedString m_pendingSrc; - - // the HTML code we will parse after this particular script has - // loaded, but before all pending HTML - SegmentedString* m_currentPrependingSrc; - - // true if we are executing a script while parsing a document. This causes the parsing of - // the output of the script to be postponed until after the script has finished executing - int m_executingScript; - Deque<CachedResourceHandle<CachedScript> > m_pendingScripts; - RefPtr<HTMLScriptElement> m_scriptNode; - - bool m_requestingScript; - bool m_hasScriptsWaitingForStylesheets; - - // if we found one broken comment, there are most likely others as well - // store a flag to get rid of the O(n^2) behaviour in such a case. - bool m_brokenComments; - // current line number - int m_lineNumber; - int m_currentScriptTagStartLineNumber; - int m_currentTagStartLineNumber; + void attemptToEnd(); + void endIfDelayed(); + void end(); - double m_tokenizerTimeDelay; - int m_tokenizerChunkSize; + bool isScheduledForResume() const; + bool inScriptExecution() const; + bool inWrite() const { return m_writeNestingLevel > 0; } - // The timer for continued processing. - Timer<HTMLDocumentParser> m_timer; + ScriptController* script() const; - // The timer for continued executing external scripts. - Timer<HTMLDocumentParser> m_externalScriptsTimer; + HTMLInputStream m_input; -// This buffer can hold arbitrarily long user-defined attribute names, such as in EMBED tags. -// So any fixed number might be too small, but rather than rewriting all usage of this buffer -// we'll just make it large enough to handle all imaginable cases. -#define CBUFLEN 1024 - UChar m_cBuffer[CBUFLEN + 2]; - unsigned int m_cBufferPos; + // We hold m_token here because it might be partially complete. + HTMLToken m_token; - SegmentedString m_src; - Document* m_doc; - OwnPtr<LegacyHTMLTreeConstructor> m_treeConstructor; - bool m_inWrite; - bool m_fragment; - FragmentScriptingPermission m_scriptingPermission; + OwnPtr<HTMLTokenizer> m_tokenizer; + OwnPtr<HTMLScriptRunner> m_scriptRunner; + OwnPtr<HTMLTreeBuilder> m_treeBuilder; + OwnPtr<HTMLPreloadScanner> m_preloadScanner; + OwnPtr<HTMLParserScheduler> m_parserScheduler; - OwnPtr<PreloadScanner> m_preloadScanner; + bool m_endWasDelayed; + int m_writeNestingLevel; }; -void parseHTMLDocumentFragment(const String&, DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); - -UChar decodeNamedEntity(const char*); - -} // namespace WebCore +} -#endif // HTMLTokenizer_h +#endif diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index 8f2bead..0726977 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -39,13 +39,11 @@ #include "HTMLElementFactory.h" #include "HTMLFormElement.h" #include "HTMLNames.h" -#include "HTMLDocumentParser.h" #include "RenderWordBreak.h" #include "ScriptEventListener.h" #include "Settings.h" #include "Text.h" #include "TextIterator.h" -#include "XMLDocumentParser.h" #include "markup.h" #include <wtf/StdLibExtras.h> @@ -58,7 +56,7 @@ using std::max; PassRefPtr<HTMLElement> HTMLElement::create(const QualifiedName& tagName, Document* document) { - return adoptRef(new HTMLElement(tagName, document, CreateHTMLElement)); + return adoptRef(new HTMLElement(tagName, document)); } String HTMLElement::nodeName() const @@ -549,13 +547,13 @@ Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi return static_cast<Element*>(returnValue); } -void HTMLElement::insertAdjacentHTML(const String& where, const String& html, ExceptionCode& ec) +void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec) { RefPtr<DocumentFragment> fragment = document()->createDocumentFragment(); if (document()->isHTMLDocument()) - parseHTMLDocumentFragment(html, fragment.get()); + fragment->parseHTML(markup); else { - if (!parseXMLDocumentFragment(html, fragment.get(), this)) + if (!fragment->parseXML(markup, this)) // FIXME: We should propagate a syntax error exception out here. return; } diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h index db9cb98..03449c9 100644 --- a/WebCore/html/HTMLElement.h +++ b/WebCore/html/HTMLElement.h @@ -82,7 +82,7 @@ public: static void addHTMLAlignmentToStyledElement(StyledElement*, Attribute*); protected: - HTMLElement(const QualifiedName& tagName, Document*, ConstructionType = CreateHTMLElementZeroRefCount); + HTMLElement(const QualifiedName& tagName, Document*); void addHTMLAlignment(Attribute*); @@ -111,8 +111,8 @@ private: Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&); }; -inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document, ConstructionType type) - : StyledElement(tagName, document, type) +inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document) + : StyledElement(tagName, document, CreateHTMLElement) { ASSERT(tagName.localName().impl()); } diff --git a/WebCore/html/HTMLElement.idl b/WebCore/html/HTMLElement.idl index 627dda2..863f28c 100644 --- a/WebCore/html/HTMLElement.idl +++ b/WebCore/html/HTMLElement.idl @@ -26,14 +26,15 @@ module html { ] HTMLElement : Element { // iht.com relies on id returning the empty string when no id is present. // Other browsers do this as well. So we don't convert null to JS null. - attribute [ConvertNullToNullString, Reflect] DOMString id; - attribute [ConvertNullToNullString, Reflect] DOMString title; - attribute [ConvertNullToNullString, Reflect] DOMString lang; - attribute [ConvertNullToNullString, Reflect] DOMString dir; - attribute [ConvertNullToNullString, Reflect=class] DOMString className; + attribute [Reflect] DOMString id; + attribute [Reflect] DOMString title; + attribute [Reflect] DOMString lang; + attribute [Reflect] DOMString dir; + attribute [Reflect=class] DOMString className; - attribute long tabIndex; - attribute boolean draggable; + attribute long tabIndex; + attribute boolean draggable; + attribute [Reflect] boolean hidden; // Extensions attribute [ConvertNullToNullString] DOMString innerHTML diff --git a/WebCore/html/HTMLEmbedElement.idl b/WebCore/html/HTMLEmbedElement.idl index 576bca9..4997210 100644 --- a/WebCore/html/HTMLEmbedElement.idl +++ b/WebCore/html/HTMLEmbedElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -25,25 +25,24 @@ module html { DelegatingGetOwnPropertySlot, CustomCall ] HTMLEmbedElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString align; + attribute [Reflect] DOMString align; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString, Reflect] DOMString height; + attribute [Reflect] DOMString height; #else - attribute [ConvertFromString] long height; + attribute [Reflect] long height; #endif - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString src; - attribute [ConvertNullToNullString, Reflect] DOMString type; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString src; + attribute [Reflect] DOMString type; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString, Reflect] DOMString width; + attribute [Reflect] DOMString width; #else - attribute [ConvertFromString] long width; + attribute [Reflect] long width; #endif #if defined(ENABLE_SVG) && ENABLE_SVG #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C || defined(ENABLE_SVG_DOM_OBJC_BINDINGS) && ENABLE_SVG_DOM_OBJC_BINDINGS - [SVGCheckSecurityDocument] SVGDocument getSVGDocument() - raises(DOMException); + [SVGCheckSecurityDocument] SVGDocument getSVGDocument() raises(DOMException); #endif #endif }; diff --git a/WebCore/html/HTML5EntityParser.cpp b/WebCore/html/HTMLEntityParser.cpp index f168245..3d8d48d 100644 --- a/WebCore/html/HTML5EntityParser.cpp +++ b/WebCore/html/HTMLEntityParser.cpp @@ -26,7 +26,7 @@ */ #include "config.h" -#include "HTML5EntityParser.h" +#include "HTMLEntityParser.h" #include <wtf/Vector.h> @@ -96,7 +96,7 @@ void unconsumeCharacters(SegmentedString& source, const Vector<UChar, 10>& consu } -unsigned consumeHTML5Entity(SegmentedString& source, bool& notEnoughCharacters, UChar additionalAllowedCharacter) +unsigned consumeHTMLEntity(SegmentedString& source, bool& notEnoughCharacters, UChar additionalAllowedCharacter) { ASSERT(!additionalAllowedCharacter || additionalAllowedCharacter == '"' || additionalAllowedCharacter == '\'' || additionalAllowedCharacter == '>'); ASSERT(!notEnoughCharacters); diff --git a/WebCore/html/HTML5EntityParser.h b/WebCore/html/HTMLEntityParser.h index f0a921f..d37b0c3 100644 --- a/WebCore/html/HTML5EntityParser.h +++ b/WebCore/html/HTMLEntityParser.h @@ -24,14 +24,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTML5EntityParser_h -#define HTML5EntityParser_h +#ifndef HTMLEntityParser_h +#define HTMLEntityParser_h #include "SegmentedString.h" namespace WebCore { -unsigned consumeHTML5Entity(SegmentedString&, bool& notEnoughCharacters, UChar additionalAllowedCharacter = '\0'); +unsigned consumeHTMLEntity(SegmentedString&, bool& notEnoughCharacters, UChar additionalAllowedCharacter = '\0'); } diff --git a/WebCore/html/HTMLFieldSetElement.cpp b/WebCore/html/HTMLFieldSetElement.cpp index 5e27786..ae0f8e7 100644 --- a/WebCore/html/HTMLFieldSetElement.cpp +++ b/WebCore/html/HTMLFieldSetElement.cpp @@ -41,7 +41,7 @@ inline HTMLFieldSetElement::HTMLFieldSetElement(const QualifiedName& tagName, Do PassRefPtr<HTMLFieldSetElement> HTMLFieldSetElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLFieldSetElement(tagName, document, form); + return adoptRef(new HTMLFieldSetElement(tagName, document, form)); } bool HTMLFieldSetElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLFontElement.cpp b/WebCore/html/HTMLFontElement.cpp index ab103b1..74320de 100644 --- a/WebCore/html/HTMLFontElement.cpp +++ b/WebCore/html/HTMLFontElement.cpp @@ -42,7 +42,7 @@ HTMLFontElement::HTMLFontElement(const QualifiedName& tagName, Document* documen PassRefPtr<HTMLFontElement> HTMLFontElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLFontElement(tagName, document); + return adoptRef(new HTMLFontElement(tagName, document)); } // Allows leading spaces. diff --git a/WebCore/html/HTMLFontElement.idl b/WebCore/html/HTMLFontElement.idl index fa7d908..141816d 100644 --- a/WebCore/html/HTMLFontElement.idl +++ b/WebCore/html/HTMLFontElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,9 +20,9 @@ module html { interface HTMLFontElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString color; - attribute [ConvertNullToNullString] DOMString face; - attribute [ConvertNullToNullString] DOMString size; + attribute [Reflect] DOMString color; + attribute [Reflect] DOMString face; + attribute [Reflect] DOMString size; }; } diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index 62474cc..0b1c55a 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -38,8 +38,8 @@ #include "HTMLFormElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLTreeBuilder.h" +#include "LegacyHTMLDocumentParser.h" #include "LabelsNodeList.h" #include "Page.h" #include "RenderBox.h" @@ -53,9 +53,9 @@ namespace WebCore { using namespace HTMLNames; -HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f, ConstructionType constructionType) - : HTMLElement(tagName, doc, constructionType) - , m_form(f) +HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) + : HTMLElement(tagName, document) + , m_form(form) , m_disabled(false) , m_readOnly(false) , m_required(false) @@ -178,11 +178,11 @@ void HTMLFormControlElement::removedFromTree(bool deep) { // If the form and element are both in the same tree, preserve the connection to the form. // Otherwise, null out our form and remove ourselves from the form's list of elements. - LegacyHTMLTreeConstructor* treeConstructor = 0; + LegacyHTMLTreeBuilder* treeBuilder = 0; if (DocumentParser* parser = document()->parser()) - treeConstructor = parser->htmlTreeConstructor(); + treeBuilder = parser->htmlTreeBuilder(); - if (m_form && !(treeConstructor && treeConstructor->isHandlingResidualStyleAcrossBlocks()) && findRoot(this) != findRoot(m_form)) { + if (m_form && !(treeBuilder && treeBuilder->isHandlingResidualStyleAcrossBlocks()) && findRoot(this) != findRoot(m_form)) { m_form->removeFormElement(this); m_form = 0; } @@ -223,7 +223,7 @@ bool HTMLFormControlElement::autofocus() const void HTMLFormControlElement::setAutofocus(bool b) { - setAttribute(autofocusAttr, b ? "autofocus" : 0); + setAttribute(autofocusAttr, b ? "" : 0); } bool HTMLFormControlElement::required() const @@ -233,7 +233,7 @@ bool HTMLFormControlElement::required() const void HTMLFormControlElement::setRequired(bool b) { - setAttribute(requiredAttr, b ? "required" : 0); + setAttribute(requiredAttr, b ? "" : 0); } static void updateFromElementCallback(Node* node) diff --git a/WebCore/html/HTMLFormControlElement.h b/WebCore/html/HTMLFormControlElement.h index b960381..87f6376 100644 --- a/WebCore/html/HTMLFormControlElement.h +++ b/WebCore/html/HTMLFormControlElement.h @@ -34,6 +34,8 @@ class RenderTextControl; class ValidityState; class VisibleSelection; +// FIXME: The HTML5 specification calls these form-associated elements. +// So consider renaming this to HTMLFormAssociatedElement. class HTMLFormControlElement : public HTMLElement { public: virtual ~HTMLFormControlElement(); @@ -44,7 +46,7 @@ public: bool formNoValidate() const; void setFormNoValidate(bool); - virtual void reset() {} + virtual void reset() { } virtual bool formControlValueMatchesRenderer() const { return m_valueMatchesRenderer; } virtual void setFormControlValueMatchesRenderer(bool b) { m_valueMatchesRenderer = b; } @@ -77,9 +79,8 @@ public: virtual bool isRadioButton() const { return false; } virtual bool canTriggerImplicitSubmission() const { return false; } - /* Override in derived classes to get the encoded name=value pair for submitting. - * Return true for a successful control (see HTML4-17.13.2). - */ + // Override in derived classes to get the encoded name=value pair for submitting. + // Return true for a successful control (see HTML4-17.13.2). virtual bool appendFormData(FormDataList&, bool) { return false; } virtual bool isSuccessfulSubmitButton() const { return false; } @@ -104,7 +105,7 @@ public: bool readOnly() const { return m_readOnly; } protected: - HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*, ConstructionType = CreateHTMLElementZeroRefCount); + HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*); virtual void parseMappedAttribute(Attribute*); virtual void attach(); @@ -120,6 +121,7 @@ protected: virtual void dispatchBlurEvent(); void removeFromForm(); + // This must be called any time the result of willValidate() has changed. void setNeedsWillValidateCheck(); virtual bool recalcWillValidate() const; @@ -147,16 +149,19 @@ private: bool m_readOnly : 1; bool m_required : 1; bool m_valueMatchesRenderer : 1; - // The initial value of m_willValidate depends on a subclass, and we can't + + // The initial value of m_willValidate depends on the derived class. We can't // initialize it with a virtual function in the constructor. m_willValidate - // is not deterministic during m_willValidateInitialized=false. + // is not deterministic as long as m_willValidateInitialized is false. mutable bool m_willValidateInitialized: 1; mutable bool m_willValidate : 1; + // Cache of validity()->valid(). - // "candidate for constraint validation" doesn't affect to m_isValid. + // But "candidate for constraint validation" doesn't affect m_isValid. bool m_isValid : 1; }; +// FIXME: Give this class its own header file. class HTMLFormControlElementWithState : public HTMLFormControlElement { public: virtual ~HTMLFormControlElementWithState(); @@ -175,6 +180,7 @@ private: virtual void finishParsingChildren(); }; +// FIXME: Give this class its own header file. class HTMLTextFormControlElement : public HTMLFormControlElementWithState { public: virtual ~HTMLTextFormControlElement(); @@ -206,14 +212,15 @@ private: virtual int cachedSelectionStart() const = 0; virtual int cachedSelectionEnd() const = 0; - // A subclass should return true if placeholder processing is needed. + // The derived class should return true if placeholder processing is needed. virtual bool supportsPlaceholder() const = 0; - // Returns true if user-editable value is empty. This is used to check placeholder visibility. + // Returns true if user-editable value is empty. Used to check placeholder visibility. virtual bool isEmptyValue() const = 0; // Called in dispatchFocusEvent(), after placeholder process, before calling parent's dispatchFocusEvent(). virtual void handleFocusEvent() { } // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent(). virtual void handleBlurEvent() { } + RenderTextControl* textRendererAfterUpdateLayout(); }; diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index 084470c..9d58934 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -26,7 +26,6 @@ #include "HTMLFormElement.h" #include "Attribute.h" -#include "CSSHelper.h" #include "DOMFormData.h" #include "DOMWindow.h" #include "Document.h" @@ -37,6 +36,7 @@ #include "FormData.h" #include "FormDataList.h" #include "FormState.h" +#include "FormSubmission.h" #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" @@ -86,12 +86,12 @@ HTMLFormElement::HTMLFormElement(const QualifiedName& tagName, Document* documen PassRefPtr<HTMLFormElement> HTMLFormElement::create(Document* document) { - return new HTMLFormElement(formTag, document); + return adoptRef(new HTMLFormElement(formTag, document)); } PassRefPtr<HTMLFormElement> HTMLFormElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLFormElement(tagName, document); + return adoptRef(new HTMLFormElement(tagName, document)); } HTMLFormElement::~HTMLFormElement() @@ -192,32 +192,77 @@ void HTMLFormElement::submitImplicitly(Event* event, bool fromImplicitSubmission prepareSubmit(event); } -TextEncoding HTMLFormElement::dataEncoding() const +static void appendMailtoPostFormDataToURL(KURL& url, const FormData& data, const String& encodingType) { - if (isMailtoForm()) - return UTF8Encoding(); + String body = data.flattenToString(); - return m_formDataBuilder.dataEncoding(document()); + if (equalIgnoringCase(encodingType, "text/plain")) { + // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20. + body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', ' ') + "\r\n"); + } + + Vector<char> bodyData; + bodyData.append("body=", 5); + FormDataBuilder::encodeStringAsFormData(bodyData, body.utf8()); + body = String(bodyData.data(), bodyData.size()).replace('+', "%20"); + + String query = url.query(); + if (!query.isEmpty()) + query.append('&'); + query.append(body); + url.setQuery(query); } -PassRefPtr<FormData> HTMLFormElement::createFormData() +PassRefPtr<FormSubmission> HTMLFormElement::prepareFormSubmission(Event* event, bool lockHistory, FormSubmissionTrigger trigger) { - RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding().encodingForFormSubmission()); + KURL actionURL = document()->completeURL(m_formDataBuilder.action().isEmpty() ? document()->url().string() : m_formDataBuilder.action()); + bool isMailtoForm = actionURL.protocolIs("mailto"); + + if (m_formDataBuilder.isPostMethod()) { + if (m_formDataBuilder.isMultiPartForm() && isMailtoForm) { + m_formDataBuilder.parseEncodingType("application/x-www-form-urlencoded"); + ASSERT(!m_formDataBuilder.isMultiPartForm()); + } + } else + m_formDataBuilder.setIsMultiPartForm(false); + + TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : m_formDataBuilder.dataEncoding(document()); + RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingForFormSubmission()); + Vector<pair<String, String> > formValues; + for (unsigned i = 0; i < m_associatedElements.size(); ++i) { HTMLFormControlElement* control = m_associatedElements[i]; if (!control->disabled()) control->appendFormData(*domFormData, m_formDataBuilder.isMultiPartForm()); + if (control->hasLocalName(inputTag)) { + HTMLInputElement* input = static_cast<HTMLInputElement*>(control); + if (input->isTextField()) { + formValues.append(pair<String, String>(input->name(), input->value())); + if (input->isSearchField()) + input->addSearchResult(); + } + } } - RefPtr<FormData> result = (m_formDataBuilder.isMultiPartForm()) ? FormData::createMultiPart(domFormData->items(), domFormData->encoding(), document()) : FormData::create(domFormData->items(), domFormData->encoding()); + RefPtr<FormData> formData; + String boundary; - result->setIdentifier(generateFormDataIdentifier()); - return result; -} + if (m_formDataBuilder.isMultiPartForm()) { + formData = FormData::createMultiPart(domFormData->items(), domFormData->encoding(), document()); + boundary = formData->boundary().data(); + } else { + formData = FormData::create(domFormData->items(), domFormData->encoding()); + if (m_formDataBuilder.isPostMethod() && isMailtoForm) { + // Convert the form data into a string that we put into the URL. + appendMailtoPostFormDataToURL(actionURL, *formData, m_formDataBuilder.encodingType()); + formData = FormData::create(); + } + } -bool HTMLFormElement::isMailtoForm() const -{ - return protocolIs(m_url, "mailto"); + formData->setIdentifier(generateFormDataIdentifier()); + FormSubmission::Method method = m_formDataBuilder.isPostMethod() ? FormSubmission::PostMethod : FormSubmission::GetMethod; + String targetOrBaseTarget = m_formDataBuilder.target().isEmpty() ? document()->baseTarget() : m_formDataBuilder.target(); + return FormSubmission::create(method, actionURL, targetOrBaseTarget, m_formDataBuilder.encodingType(), FormState::create(this, formValues, document()->frame(), trigger), formData.release(), boundary, lockHistory, event); } static inline HTMLFormControlElement* submitElementFromEvent(const Event* event) @@ -304,28 +349,6 @@ bool HTMLFormElement::prepareSubmit(Event* event) return m_doingsubmit; } -static void transferMailtoPostFormDataToURL(RefPtr<FormData>& data, KURL& url, const String& encodingType) -{ - String body = data->flattenToString(); - data = FormData::create(); - - if (equalIgnoringCase(encodingType, "text/plain")) { - // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20. - body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', ' ') + "\r\n"); - } - - Vector<char> bodyData; - bodyData.append("body=", 5); - FormDataBuilder::encodeStringAsFormData(bodyData, body.utf8()); - body = String(bodyData.data(), bodyData.size()).replace('+', "%20"); - - String query = url.query(); - if (!query.isEmpty()) - query.append('&'); - query.append(body); - url.setQuery(query); -} - void HTMLFormElement::submit(Frame* javaScriptActiveFrame) { if (javaScriptActiveFrame) @@ -351,18 +374,8 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockH HTMLFormControlElement* firstSuccessfulSubmitButton = 0; bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? - Vector<pair<String, String> > formValues; - for (unsigned i = 0; i < m_associatedElements.size(); ++i) { HTMLFormControlElement* control = m_associatedElements[i]; - if (control->hasLocalName(inputTag)) { - HTMLInputElement* input = static_cast<HTMLInputElement*>(control); - if (input->isTextField()) { - formValues.append(pair<String, String>(input->name(), input->value())); - if (input->isSearchField()) - input->addSearchResult(); - } - } if (needButtonActivation) { if (control->isActivatedSubmit()) needButtonActivation = false; @@ -371,37 +384,10 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockH } } - RefPtr<FormState> formState = FormState::create(this, formValues, frame, formSubmissionTrigger); - if (needButtonActivation && firstSuccessfulSubmitButton) firstSuccessfulSubmitButton->setActivatedSubmit(true); - - if (m_url.isEmpty()) - m_url = document()->url().string(); - if (m_formDataBuilder.isPostMethod()) { - if (m_formDataBuilder.isMultiPartForm() && isMailtoForm()) { - setEnctype("application/x-www-form-urlencoded"); - ASSERT(!m_formDataBuilder.isMultiPartForm()); - } - - RefPtr<FormData> data = createFormData(); - if (!m_formDataBuilder.isMultiPartForm()) { - - if (isMailtoForm()) { - // Convert the form data into a string that we put into the URL. - KURL url = document()->completeURL(m_url); - transferMailtoPostFormDataToURL(data, url, m_formDataBuilder.encodingType()); - m_url = url.string(); - } - - frame->loader()->submitForm("POST", m_url, data.release(), m_target, m_formDataBuilder.encodingType(), String(), lockHistory, event, formState.release()); - } else - frame->loader()->submitForm("POST", m_url, data.get(), m_target, m_formDataBuilder.encodingType(), data->boundary().data(), lockHistory, event, formState.release()); - } else { - m_formDataBuilder.setIsMultiPartForm(false); - frame->loader()->submitForm("GET", m_url, createFormData(), m_target, String(), String(), lockHistory, event, formState.release()); - } + frame->loader()->submitForm(prepareFormSubmission(event, lockHistory, formSubmissionTrigger)); if (needButtonActivation && firstSuccessfulSubmitButton) firstSuccessfulSubmitButton->setActivatedSubmit(false); @@ -433,9 +419,9 @@ void HTMLFormElement::reset() void HTMLFormElement::parseMappedAttribute(Attribute* attr) { if (attr->name() == actionAttr) - m_url = deprecatedParseURL(attr->value()); + m_formDataBuilder.parseAction(attr->value()); else if (attr->name() == targetAttr) - m_target = attr->value(); + m_formDataBuilder.setTarget(attr->value()); else if (attr->name() == methodAttr) m_formDataBuilder.parseMethodType(attr->value()); else if (attr->name() == enctypeAttr) @@ -648,7 +634,7 @@ void HTMLFormElement::getNamedElements(const AtomicString& name, Vector<RefPtr<N // see if we have seen something with this name before RefPtr<HTMLFormControlElement> aliasElem; - if (aliasElem = elementForAlias(name)) { + if ((aliasElem = elementForAlias(name))) { bool found = false; for (unsigned n = 0; n < namedItems.size(); n++) { if (namedItems[n] == aliasElem.get()) { diff --git a/WebCore/html/HTMLFormElement.h b/WebCore/html/HTMLFormElement.h index a49f443..b19ff07 100644 --- a/WebCore/html/HTMLFormElement.h +++ b/WebCore/html/HTMLFormElement.h @@ -34,6 +34,7 @@ namespace WebCore { class Event; class FormData; +class FormSubmission; class HTMLFormControlElement; class HTMLImageElement; class HTMLInputElement; @@ -135,9 +136,7 @@ private: void submit(Event*, bool activateSubmitButton, bool lockHistory, FormSubmissionTrigger); - bool isMailtoForm() const; - TextEncoding dataEncoding() const; - PassRefPtr<FormData> createFormData(); + PassRefPtr<FormSubmission> prepareFormSubmission(Event*, bool lockHistory, FormSubmissionTrigger); unsigned formElementIndex(HTMLFormControlElement*); // Returns true if the submission should be proceeded. bool validateInteractively(Event*); @@ -158,8 +157,6 @@ private: Vector<HTMLFormControlElement*> m_associatedElements; Vector<HTMLImageElement*> m_imageElements; - String m_url; - String m_target; bool m_autocomplete : 1; bool m_insubmit : 1; bool m_doingsubmit : 1; diff --git a/WebCore/html/HTMLFormElement.idl b/WebCore/html/HTMLFormElement.idl index 0654a7d..c5162f9 100644 --- a/WebCore/html/HTMLFormElement.idl +++ b/WebCore/html/HTMLFormElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -24,19 +24,20 @@ module html { HasIndexGetter, HasOverridingNameGetter ] HTMLFormElement : HTMLElement { - readonly attribute HTMLCollection elements; - readonly attribute long length; - attribute [ConvertNullToNullString] DOMString name; - attribute boolean noValidate; - attribute [ConvertNullToNullString] DOMString acceptCharset; - attribute [ConvertNullToNullString] DOMString action; - attribute [ConvertNullToNullString] DOMString encoding; /* Netscape/Firefox legacy attribute. Same as enctype. */ - attribute [ConvertNullToNullString] DOMString enctype; - attribute [ConvertNullToNullString] DOMString method; - attribute [ConvertNullToNullString] DOMString target; + readonly attribute HTMLCollection elements; + readonly attribute long length; + + attribute [Reflect] DOMString name; + attribute [Reflect] boolean noValidate; + attribute [Reflect=accept_charset] DOMString acceptCharset; + attribute [Reflect] DOMString action; + attribute [ConvertNullToNullString] DOMString encoding; /* Netscape/Firefox legacy attribute. Same as enctype. */ + attribute [ConvertNullToNullString] DOMString enctype; + attribute [Reflect] DOMString method; + attribute [Reflect] DOMString target; [CallWith=DynamicFrame] void submit(); void reset(); - boolean checkValidity(); + boolean checkValidity(); }; } diff --git a/WebCore/html/HTMLFrameElement.idl b/WebCore/html/HTMLFrameElement.idl index 453de0a..8f618c6 100644 --- a/WebCore/html/HTMLFrameElement.idl +++ b/WebCore/html/HTMLFrameElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,17 +22,17 @@ module html { interface HTMLFrameElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect=frameborder] DOMString frameBorder; - attribute [ConvertNullToNullString, Reflect=longdesc] DOMString longDesc; - attribute [ConvertNullToNullString, Reflect=marginheight] DOMString marginHeight; - attribute [ConvertNullToNullString, Reflect=marginwidth] DOMString marginWidth; - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute boolean noResize; - attribute [ConvertNullToNullString, Reflect] DOMString scrolling; - attribute [ConvertNullToNullString, CustomSetter, ReflectURL] DOMString src; + attribute [Reflect] DOMString frameBorder; + attribute [Reflect] DOMString longDesc; + attribute [Reflect] DOMString marginHeight; + attribute [Reflect] DOMString marginWidth; + attribute [Reflect] DOMString name; + attribute [Reflect] boolean noResize; + attribute [Reflect] DOMString scrolling; + attribute [ReflectURL, CustomSetter] DOMString src; // Introduced in DOM Level 2: - readonly attribute [CheckFrameSecurity] Document contentDocument; + readonly attribute [CheckFrameSecurity] Document contentDocument; // Extensions readonly attribute DOMWindow contentWindow; @@ -44,9 +44,10 @@ module html { #endif #endif - attribute [ConvertNullToNullString, CustomSetter] DOMString location; - readonly attribute long width; - readonly attribute long height; + attribute [ConvertNullToNullString, CustomSetter] DOMString location; + + readonly attribute long width; + readonly attribute long height; }; diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp index b21bf92..6cae891 100644 --- a/WebCore/html/HTMLFrameElementBase.cpp +++ b/WebCore/html/HTMLFrameElementBase.cpp @@ -104,7 +104,7 @@ void HTMLFrameElementBase::openURL(bool lockHistory, bool lockBackForwardList) if (!parentFrame) return; - parentFrame->loader()->requestFrame(this, m_URL, m_frameName, lockHistory, lockBackForwardList); + parentFrame->loader()->subframeLoader()->requestFrame(this, m_URL, m_frameName, lockHistory, lockBackForwardList); if (contentFrame()) contentFrame()->setInViewSourceMode(viewSourceMode()); } diff --git a/WebCore/html/HTMLFrameOwnerElement.cpp b/WebCore/html/HTMLFrameOwnerElement.cpp index a9538fd..a1a69f3 100644 --- a/WebCore/html/HTMLFrameOwnerElement.cpp +++ b/WebCore/html/HTMLFrameOwnerElement.cpp @@ -33,7 +33,7 @@ namespace WebCore { HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Document* document) - : HTMLElement(tagName, document, CreateHTMLElement) + : HTMLElement(tagName, document) , m_contentFrame(0) , m_sandboxFlags(SandboxNone) { diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp index 0181cc9..7be3fdd 100644 --- a/WebCore/html/HTMLFrameSetElement.cpp +++ b/WebCore/html/HTMLFrameSetElement.cpp @@ -56,7 +56,7 @@ HTMLFrameSetElement::HTMLFrameSetElement(const QualifiedName& tagName, Document* PassRefPtr<HTMLFrameSetElement> HTMLFrameSetElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLFrameSetElement(tagName, document); + return adoptRef(new HTMLFrameSetElement(tagName, document)); } bool HTMLFrameSetElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLFrameSetElement.idl b/WebCore/html/HTMLFrameSetElement.idl index 9763460..06aab6a 100644 --- a/WebCore/html/HTMLFrameSetElement.idl +++ b/WebCore/html/HTMLFrameSetElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserve + * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserve * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -23,8 +23,8 @@ module html { interface [ HasOverridingNameGetter ] HTMLFrameSetElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString cols; - attribute [ConvertNullToNullString] DOMString rows; + attribute [Reflect] DOMString cols; + attribute [Reflect] DOMString rows; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler attributes diff --git a/WebCore/html/HTMLHRElement.cpp b/WebCore/html/HTMLHRElement.cpp index b0fc6ff..c4ab28f 100644 --- a/WebCore/html/HTMLHRElement.cpp +++ b/WebCore/html/HTMLHRElement.cpp @@ -40,12 +40,12 @@ HTMLHRElement::HTMLHRElement(const QualifiedName& tagName, Document* document) PassRefPtr<HTMLHRElement> HTMLHRElement::create(Document* document) { - return new HTMLHRElement(hrTag, document); + return adoptRef(new HTMLHRElement(hrTag, document)); } PassRefPtr<HTMLHRElement> HTMLHRElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLHRElement(tagName, document); + return adoptRef(new HTMLHRElement(tagName, document)); } bool HTMLHRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLHRElement.idl b/WebCore/html/HTMLHRElement.idl index bb1fdcf..23a57da 100644 --- a/WebCore/html/HTMLHRElement.idl +++ b/WebCore/html/HTMLHRElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,10 +20,10 @@ module html { interface HTMLHRElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; - attribute boolean noShade; - attribute [ConvertNullToNullString] DOMString size; - attribute [ConvertNullToNullString] DOMString width; + attribute [Reflect] DOMString align; + attribute [Reflect] boolean noShade; + attribute [Reflect] DOMString size; + attribute [Reflect] DOMString width; }; } diff --git a/WebCore/html/HTMLHeadElement.cpp b/WebCore/html/HTMLHeadElement.cpp index df5acb4..0fb7a47 100644 --- a/WebCore/html/HTMLHeadElement.cpp +++ b/WebCore/html/HTMLHeadElement.cpp @@ -39,12 +39,12 @@ HTMLHeadElement::HTMLHeadElement(const QualifiedName& tagName, Document* documen PassRefPtr<HTMLHeadElement> HTMLHeadElement::create(Document* document) { - return new HTMLHeadElement(headTag, document); + return adoptRef(new HTMLHeadElement(headTag, document)); } PassRefPtr<HTMLHeadElement> HTMLHeadElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLHeadElement(tagName, document); + return adoptRef(new HTMLHeadElement(tagName, document)); } String HTMLHeadElement::profile() const diff --git a/WebCore/html/HTMLHeadElement.idl b/WebCore/html/HTMLHeadElement.idl index 8559dd3..59bdbf0 100644 --- a/WebCore/html/HTMLHeadElement.idl +++ b/WebCore/html/HTMLHeadElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLHeadElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString profile; + attribute [Reflect] DOMString profile; }; } diff --git a/WebCore/html/HTMLHeadingElement.cpp b/WebCore/html/HTMLHeadingElement.cpp index dd5ae66..484dea6 100644 --- a/WebCore/html/HTMLHeadingElement.cpp +++ b/WebCore/html/HTMLHeadingElement.cpp @@ -36,7 +36,7 @@ inline HTMLHeadingElement::HTMLHeadingElement(const QualifiedName& tagName, Docu PassRefPtr<HTMLHeadingElement> HTMLHeadingElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLHeadingElement(tagName, document); + return adoptRef(new HTMLHeadingElement(tagName, document)); } bool HTMLHeadingElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLHeadingElement.idl b/WebCore/html/HTMLHeadingElement.idl index 486a5bd..e419c1c 100644 --- a/WebCore/html/HTMLHeadingElement.idl +++ b/WebCore/html/HTMLHeadingElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLHeadingElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; + attribute [Reflect] DOMString align; }; } diff --git a/WebCore/html/HTMLHtmlElement.cpp b/WebCore/html/HTMLHtmlElement.cpp index 1949b59..46913a1 100644 --- a/WebCore/html/HTMLHtmlElement.cpp +++ b/WebCore/html/HTMLHtmlElement.cpp @@ -42,12 +42,12 @@ HTMLHtmlElement::HTMLHtmlElement(const QualifiedName& tagName, Document* documen PassRefPtr<HTMLHtmlElement> HTMLHtmlElement::create(Document* document) { - return new HTMLHtmlElement(htmlTag, document); + return adoptRef(new HTMLHtmlElement(htmlTag, document)); } PassRefPtr<HTMLHtmlElement> HTMLHtmlElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLHtmlElement(tagName, document); + return adoptRef(new HTMLHtmlElement(tagName, document)); } String HTMLHtmlElement::version() const diff --git a/WebCore/html/HTMLHtmlElement.idl b/WebCore/html/HTMLHtmlElement.idl index 9cee000..42ba861 100644 --- a/WebCore/html/HTMLHtmlElement.idl +++ b/WebCore/html/HTMLHtmlElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,9 +20,7 @@ module html { interface HTMLHtmlElement : HTMLElement { - - attribute [ConvertNullToNullString] DOMString version; - + attribute [Reflect] DOMString version; }; } diff --git a/WebCore/html/HTMLIFrameElement.idl b/WebCore/html/HTMLIFrameElement.idl index e1aed03..86abaf5 100644 --- a/WebCore/html/HTMLIFrameElement.idl +++ b/WebCore/html/HTMLIFrameElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,21 +21,20 @@ module html { interface HTMLIFrameElement : HTMLElement { - - attribute [ConvertNullToNullString, Reflect] DOMString align; - attribute [ConvertNullToNullString, Reflect=frameborder] DOMString frameBorder; - attribute [ConvertNullToNullString, Reflect] DOMString height; - attribute [ConvertNullToNullString, Reflect=longdesc] DOMString longDesc; - attribute [ConvertNullToNullString, Reflect=marginheight] DOMString marginHeight; - attribute [ConvertNullToNullString, Reflect=marginwidth] DOMString marginWidth; - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString sandbox; - attribute [ConvertNullToNullString, Reflect] DOMString scrolling; - attribute [ConvertNullToNullString, CustomSetter, Reflect] DOMString src; - attribute [ConvertNullToNullString, Reflect] DOMString width; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString frameBorder; + attribute [Reflect] DOMString height; + attribute [Reflect] DOMString longDesc; + attribute [Reflect] DOMString marginHeight; + attribute [Reflect] DOMString marginWidth; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString sandbox; + attribute [Reflect] DOMString scrolling; + attribute [CustomSetter, Reflect] DOMString src; + attribute [Reflect] DOMString width; // Introduced in DOM Level 2: - readonly attribute [CheckFrameSecurity] Document contentDocument; + readonly attribute [CheckFrameSecurity] Document contentDocument; // Extensions readonly attribute DOMWindow contentWindow; @@ -46,7 +45,6 @@ module html { raises(DOMException); #endif #endif - }; } diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index b149c95..5d5923d 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -55,12 +55,12 @@ HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* docum PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document* document) { - return new HTMLImageElement(imgTag, document); + return adoptRef(new HTMLImageElement(imgTag, document)); } PassRefPtr<HTMLImageElement> HTMLImageElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLImageElement(tagName, document, form); + return adoptRef(new HTMLImageElement(tagName, document, form)); } HTMLImageElement::~HTMLImageElement() @@ -71,7 +71,7 @@ HTMLImageElement::~HTMLImageElement() PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document* document, const int* optionalWidth, const int* optionalHeight) { - RefPtr<HTMLImageElement> image = new HTMLImageElement(imgTag, document); + RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, document)); if (optionalWidth) image->setWidth(*optionalWidth); if (optionalHeight > 0) diff --git a/WebCore/html/HTMLImageElement.idl b/WebCore/html/HTMLImageElement.idl index a5a468e..0fc7271 100644 --- a/WebCore/html/HTMLImageElement.idl +++ b/WebCore/html/HTMLImageElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -23,22 +23,22 @@ module html { interface [ GenerateNativeConverter ] HTMLImageElement : HTMLElement { - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString align; - attribute [ConvertNullToNullString, Reflect] DOMString alt; - attribute [ConvertNullToNullString, Reflect] DOMString border; - attribute long height; - attribute long hspace; - attribute boolean isMap; - attribute [ConvertNullToNullString, ReflectURL=longdesc] DOMString longDesc; - attribute [ConvertNullToNullString, ReflectURL] DOMString src; - attribute [ConvertNullToNullString, Reflect=usemap] DOMString useMap; - attribute long vspace; - attribute long width; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString alt; + attribute [Reflect] DOMString border; + attribute long height; + attribute [Reflect] long hspace; + attribute [Reflect] boolean isMap; + attribute [ReflectURL=longdesc] DOMString longDesc; + attribute [ReflectURL] DOMString src; + attribute [Reflect] DOMString useMap; + attribute [Reflect] long vspace; + attribute long width; // Extensions readonly attribute boolean complete; - attribute [ConvertNullToNullString, ReflectURL] DOMString lowsrc; + attribute [ReflectURL] DOMString lowsrc; readonly attribute long naturalHeight; readonly attribute long naturalWidth; readonly attribute long x; diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index 9be9bff..5e27449 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -5,6 +5,7 @@ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * (C) 2006 Alexey Proskuryakov (ap@nypop.com) * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) + * Copyright (C) 2010 Google 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 @@ -47,7 +48,7 @@ #include "HTMLImageLoader.h" #include "HTMLNames.h" #include "HTMLOptionElement.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" #include "MouseEvent.h" @@ -128,7 +129,7 @@ HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLInputElement(tagName, document, form); + return adoptRef(new HTMLInputElement(tagName, document, form)); } HTMLInputElement::~HTMLInputElement() @@ -2828,6 +2829,40 @@ void HTMLInputElement::setWapInputFormat(String& mask) } #endif - +#if ENABLE(INPUT_SPEECH) +bool HTMLInputElement::isSpeechEnabled() const +{ + switch (inputType()) { + // FIXME: Add support for RANGE, EMAIL, URL, COLOR and DATE/TIME input types. + case NUMBER: + case PASSWORD: + case SEARCH: + case TELEPHONE: + case TEXT: + return hasAttribute(speechAttr); + case BUTTON: + case CHECKBOX: + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case HIDDEN: + case IMAGE: + case ISINDEX: + case MONTH: + case RADIO: + case RANGE: + case RESET: + case SUBMIT: + case TIME: + case URL: + case WEEK: + return false; + } + return false; +} +#endif } // namespace diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h index a9a7bb0..5bcf01f 100644 --- a/WebCore/html/HTMLInputElement.h +++ b/WebCore/html/HTMLInputElement.h @@ -105,6 +105,9 @@ public: bool isNumberField() const { return m_type == NUMBER; } bool isEmailField() const { return m_type == EMAIL; } bool isUrlField() const { return m_type == URL; } +#if ENABLE(INPUT_SPEECH) + virtual bool isSpeechEnabled() const; +#endif bool checked() const { return m_checked; } void setChecked(bool, bool sendChangeEvent = false); @@ -207,6 +210,10 @@ public: HTMLOptionElement* selectedOption() const; #endif +#if ENABLE(WCSS) + void setWapInputFormat(String& mask); +#endif + protected: HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement* = 0); @@ -334,7 +341,6 @@ private: #endif #if ENABLE(WCSS) - void setWapInputFormat(String& mask); virtual InputElementData data() const { return m_data; } #endif diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl index 237d4c3..9b6bbbf 100644 --- a/WebCore/html/HTMLInputElement.idl +++ b/WebCore/html/HTMLInputElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,83 +21,80 @@ module html { interface HTMLInputElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString defaultValue; - attribute boolean defaultChecked; + attribute [ConvertNullToNullString] DOMString defaultValue; + attribute [Reflect=checked] boolean defaultChecked; readonly attribute HTMLFormElement form; - attribute boolean formNoValidate; - readonly attribute ValidityState validity; - attribute [ConvertNullToNullString] DOMString accept; - attribute [ConvertNullToNullString] DOMString accessKey; - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString alt; - attribute boolean checked; - attribute boolean disabled; - attribute boolean autofocus; + attribute [Reflect] boolean formNoValidate; + readonly attribute ValidityState validity; + attribute [Reflect] DOMString accept; + attribute [Reflect] DOMString accessKey; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString alt; + attribute boolean checked; + attribute [Reflect] boolean disabled; + attribute [Reflect] boolean autofocus; #if defined(ENABLE_DATALIST) && ENABLE_DATALIST readonly attribute HTMLElement list; #endif - attribute [ConvertNullToNullString, Reflect] DOMString max; - attribute long maxLength - setter raises(DOMException); - attribute [ConvertNullToNullString, Reflect] DOMString min; - attribute boolean multiple; - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString pattern; - attribute DOMString placeholder; - attribute boolean readOnly; - attribute boolean required; + attribute [Reflect] DOMString max; + attribute long maxLength setter raises(DOMException); + attribute [Reflect] DOMString min; + attribute [Reflect] boolean multiple; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString pattern; + attribute [Reflect] DOMString placeholder; + attribute [Reflect] boolean readOnly; + attribute [Reflect] boolean required; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [ConvertToString] DOMString size; // DOM level 2 changed this to a long, but our existing API is a string + attribute [ConvertToString] DOMString size; // DOM level 2 changed this to a long, but our existing API is a string #else - // FIXME: the spec says this should be a long, not an unsigned long - attribute unsigned long size; // Changed string -> long as part of DOM level 2 + // FIXME: The spec says this should be a long, not an unsigned long. + attribute unsigned long size; // Changed string -> long as part of DOM level 2 #endif - attribute [ConvertNullToNullString] DOMString src; - attribute [ConvertNullToNullString, Reflect] DOMString step; - attribute [ConvertNullToNullString, JSCCustomGetter] DOMString type; // readonly dropped as part of DOM level 2 - attribute [ConvertNullToNullString] DOMString useMap; - attribute [ConvertNullToNullString] DOMString value; + attribute [ReflectURL] DOMString src; + attribute [Reflect] DOMString step; + attribute [ConvertNullToNullString, JSCCustomGetter] DOMString type; // readonly dropped as part of DOM level 2 + attribute [Reflect] DOMString useMap; + attribute [ConvertNullToNullString] DOMString value; #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute Date valueAsDate setter raises(DOMException); + attribute Date valueAsDate setter raises(DOMException); #endif - attribute double valueAsNumber setter raises(DOMException); + attribute double valueAsNumber setter raises(DOMException); #if defined(ENABLE_DATALIST) && ENABLE_DATALIST readonly attribute HTMLOptionElement selectedOption; #endif - void stepUp(in [Optional] long n) - raises(DOMException); - void stepDown(in [Optional] long n) - raises(DOMException); + void stepUp(in [Optional] long n) raises(DOMException); + void stepDown(in [Optional] long n) raises(DOMException); - readonly attribute boolean willValidate; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); - void select(); - void click(); + readonly attribute boolean willValidate; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void select(); + void click(); #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - void setValueForUser(in [ConvertNullToNullString] DOMString value); + void setValueForUser(in [ConvertNullToNullString] DOMString value); #endif // WinIE extension: - attribute boolean indeterminate; + attribute boolean indeterminate; // WinIE & FireFox extension: - attribute [Custom] long selectionStart; - attribute [Custom] long selectionEnd; + attribute [Custom] long selectionStart; + attribute [Custom] long selectionEnd; [Custom] void setSelectionRange(in long start, in long end); #if defined(LANGUAGE_OBJECTIVE_C) // Objective-C extension: - readonly attribute DOMString altDisplayString; - readonly attribute URL absoluteImageURL; + readonly attribute DOMString altDisplayString; + readonly attribute URL absoluteImageURL; #endif readonly attribute FileList files; - readonly attribute NodeList labels; + readonly attribute NodeList labels; }; } diff --git a/WebCore/html/HTMLInputStream.h b/WebCore/html/HTMLInputStream.h new file mode 100644 index 0000000..9620388 --- /dev/null +++ b/WebCore/html/HTMLInputStream.h @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTMLInputStream_h +#define HTMLInputStream_h + +#include "SegmentedString.h" + +namespace WebCore { + +// The InputStream is made up of a sequence of SegmentedStrings: +// +// [--current--][--next--][--next--] ... [--next--] +// /\ (also called m_last) +// L_ current insertion point +// +// The current segmented string is stored in InputStream. Each of the +// afterInsertionPoint buffers are stored in InsertionPointRecords on the +// stack. +// +// We remove characters from the "current" string in the InputStream. +// document.write() will add characters at the current insertion point, +// which appends them to the "current" string. +// +// m_last is a pointer to the last of the afterInsertionPoint strings. +// The network adds data at the end of the InputStream, which appends +// them to the "last" string. +class HTMLInputStream : public Noncopyable { +public: + HTMLInputStream() + : m_last(&m_first) + { + } + + void appendToEnd(const SegmentedString& string) + { + m_last->append(string); + } + + void insertAtCurrentInsertionPoint(const SegmentedString& string) + { + m_first.append(string); + } + + void close() { m_last->close(); } + bool isClosed() { return m_last->isClosed(); } + + SegmentedString& current() { return m_first; } + + void splitInto(SegmentedString& next) + { + next = m_first; + m_first = SegmentedString(); + if (m_last == &m_first) { + // We used to only have one SegmentedString in the InputStream + // but now we have two. That means m_first is no longer also + // the m_last string, |next| is now the last one. + m_last = &next; + } + } + + void mergeFrom(SegmentedString& next) + { + m_first.append(next); + if (m_last == &next) { + // The string |next| used to be the last SegmentedString in + // the InputStream. Now that it's been merged into m_first, + // that makes m_first the last one. + m_last = &m_first; + } + if (next.isClosed()) { + // We also need to merge the "closed" state from next to + // m_first. Arguably, this work could be done in append(). + m_first.close(); + } + } + +private: + SegmentedString m_first; + SegmentedString* m_last; +}; + +class InsertionPointRecord : public Noncopyable { +public: + explicit InsertionPointRecord(HTMLInputStream& inputStream) + : m_inputStream(&inputStream) + { + m_inputStream->splitInto(m_next); + } + + ~InsertionPointRecord() + { + m_inputStream->mergeFrom(m_next); + } + +private: + HTMLInputStream* m_inputStream; + SegmentedString m_next; +}; + +} + +#endif diff --git a/WebCore/html/HTMLIsIndexElement.cpp b/WebCore/html/HTMLIsIndexElement.cpp index d382af5..dce67f6 100644 --- a/WebCore/html/HTMLIsIndexElement.cpp +++ b/WebCore/html/HTMLIsIndexElement.cpp @@ -41,12 +41,12 @@ HTMLIsIndexElement::HTMLIsIndexElement(const QualifiedName& tagName, Document* d PassRefPtr<HTMLIsIndexElement> HTMLIsIndexElement::create(Document* document, HTMLFormElement* form) { - return new HTMLIsIndexElement(isindexTag, document, form); + return adoptRef(new HTMLIsIndexElement(isindexTag, document, form)); } PassRefPtr<HTMLIsIndexElement> HTMLIsIndexElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLIsIndexElement(tagName, document, form); + return adoptRef(new HTMLIsIndexElement(tagName, document, form)); } void HTMLIsIndexElement::parseMappedAttribute(Attribute* attr) diff --git a/WebCore/html/HTMLIsIndexElement.idl b/WebCore/html/HTMLIsIndexElement.idl index d968fa7..028a180 100644 --- a/WebCore/html/HTMLIsIndexElement.idl +++ b/WebCore/html/HTMLIsIndexElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -21,7 +21,7 @@ module html { interface HTMLIsIndexElement : HTMLInputElement { readonly attribute HTMLFormElement form; - attribute [ConvertNullToNullString] DOMString prompt; + attribute [Reflect] DOMString prompt; }; } diff --git a/WebCore/html/HTMLKeygenElement.cpp b/WebCore/html/HTMLKeygenElement.cpp index 4318c65..74b3a0f 100644 --- a/WebCore/html/HTMLKeygenElement.cpp +++ b/WebCore/html/HTMLKeygenElement.cpp @@ -57,7 +57,7 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLKeygenElement(tagName, document, form); + return adoptRef(new HTMLKeygenElement(tagName, document, form)); } const AtomicString& HTMLKeygenElement::formControlType() const diff --git a/WebCore/html/HTMLLIElement.cpp b/WebCore/html/HTMLLIElement.cpp index 74c3468..ae96cc3 100644 --- a/WebCore/html/HTMLLIElement.cpp +++ b/WebCore/html/HTMLLIElement.cpp @@ -42,12 +42,12 @@ HTMLLIElement::HTMLLIElement(const QualifiedName& tagName, Document* document) PassRefPtr<HTMLLIElement> HTMLLIElement::create(Document* document) { - return new HTMLLIElement(liTag, document); + return adoptRef(new HTMLLIElement(liTag, document)); } PassRefPtr<HTMLLIElement> HTMLLIElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLLIElement(tagName, document); + return adoptRef(new HTMLLIElement(tagName, document)); } bool HTMLLIElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLLIElement.idl b/WebCore/html/HTMLLIElement.idl index 946ec18..2dc541b 100644 --- a/WebCore/html/HTMLLIElement.idl +++ b/WebCore/html/HTMLLIElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,8 +20,8 @@ module html { interface HTMLLIElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString type; - attribute long value; + attribute [Reflect] DOMString type; + attribute [Reflect] long value; }; } diff --git a/WebCore/html/HTMLLabelElement.cpp b/WebCore/html/HTMLLabelElement.cpp index ed0fab6..6b3069a 100644 --- a/WebCore/html/HTMLLabelElement.cpp +++ b/WebCore/html/HTMLLabelElement.cpp @@ -56,7 +56,7 @@ inline HTMLLabelElement::HTMLLabelElement(const QualifiedName& tagName, Document PassRefPtr<HTMLLabelElement> HTMLLabelElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLLabelElement(tagName, document); + return adoptRef(new HTMLLabelElement(tagName, document)); } bool HTMLLabelElement::isFocusable() const diff --git a/WebCore/html/HTMLLabelElement.idl b/WebCore/html/HTMLLabelElement.idl index dddc89c..c946bc4 100644 --- a/WebCore/html/HTMLLabelElement.idl +++ b/WebCore/html/HTMLLabelElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,8 +22,8 @@ module html { interface HTMLLabelElement : HTMLElement { readonly attribute HTMLFormElement form; - attribute [ConvertNullToNullString] DOMString accessKey; - attribute [ConvertNullToNullString] DOMString htmlFor; + attribute [Reflect] DOMString accessKey; + attribute [Reflect=for] DOMString htmlFor; readonly attribute HTMLElement control; }; diff --git a/WebCore/html/HTMLLegendElement.cpp b/WebCore/html/HTMLLegendElement.cpp index 0aa4142..4249fb1 100644 --- a/WebCore/html/HTMLLegendElement.cpp +++ b/WebCore/html/HTMLLegendElement.cpp @@ -40,7 +40,7 @@ inline HTMLLegendElement::HTMLLegendElement(const QualifiedName& tagName, Docume PassRefPtr<HTMLLegendElement> HTMLLegendElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLLegendElement(tagName, document, form); + return adoptRef(new HTMLLegendElement(tagName, document, form)); } bool HTMLLegendElement::supportsFocus() const diff --git a/WebCore/html/HTMLLegendElement.idl b/WebCore/html/HTMLLegendElement.idl index ee21e4c..750f32a 100644 --- a/WebCore/html/HTMLLegendElement.idl +++ b/WebCore/html/HTMLLegendElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,8 +22,8 @@ module html { interface HTMLLegendElement : HTMLElement { readonly attribute HTMLFormElement form; - attribute [ConvertNullToNullString] DOMString accessKey; - attribute [ConvertNullToNullString] DOMString align; + attribute [Reflect] DOMString accessKey; + attribute [Reflect] DOMString align; }; } diff --git a/WebCore/html/HTMLLinkElement.cpp b/WebCore/html/HTMLLinkElement.cpp index a687852..b3a1c89 100644 --- a/WebCore/html/HTMLLinkElement.cpp +++ b/WebCore/html/HTMLLinkElement.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) * * This library is free software; you can redistribute it and/or @@ -54,14 +54,18 @@ inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* , m_disabledState(Unset) , m_loading(false) , m_createdByParser(createdByParser) +<<<<<<< HEAD , m_timer(this, &HTMLLinkElement::timerFired) +======= + , m_shouldProcessAfterAttach(false) +>>>>>>> webkit.org at r61871 { ASSERT(hasTagName(linkTag)); } PassRefPtr<HTMLLinkElement> HTMLLinkElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) { - return new HTMLLinkElement(tagName, document, createdByParser); + return adoptRef(new HTMLLinkElement(tagName, document, createdByParser)); } HTMLLinkElement::~HTMLLinkElement() @@ -270,12 +274,24 @@ void HTMLLinkElement::process() document()->updateStyleSelector(); } } + +void HTMLLinkElement::processCallback(Node* node) +{ + ASSERT_ARG(node, node && node->hasTagName(linkTag)); + static_cast<HTMLLinkElement*>(node)->process(); +} void HTMLLinkElement::insertedIntoDocument() { HTMLElement::insertedIntoDocument(); document()->addStyleSheetCandidateNode(this, m_createdByParser); - process(); + + // Since processing a stylesheet link causes a beforeload event + // to fire, it is possible for JavaScript to remove the element in the midst + // of it being inserted into the DOM, which can lead to assertion failures + // and crashes. Avoid this by postponing the beforeload/load until after + // attach. + m_shouldProcessAfterAttach = true; } void HTMLLinkElement::removedFromDocument() @@ -287,8 +303,20 @@ void HTMLLinkElement::removedFromDocument() // FIXME: It's terrible to do a synchronous update of the style selector just because a <style> or <link> element got removed. if (document()->renderer()) document()->updateStyleSelector(); + + m_shouldProcessAfterAttach = false; } +void HTMLLinkElement::attach() +{ + if (m_shouldProcessAfterAttach) { + m_shouldProcessAfterAttach = false; + queuePostAttachCallback(&HTMLLinkElement::processCallback, this); + } + + HTMLElement::attach(); +} + void HTMLLinkElement::finishParsingChildren() { m_createdByParser = false; diff --git a/WebCore/html/HTMLLinkElement.h b/WebCore/html/HTMLLinkElement.h index bf40ca5..f19741f 100644 --- a/WebCore/html/HTMLLinkElement.h +++ b/WebCore/html/HTMLLinkElement.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2008, 2010 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 @@ -97,6 +97,9 @@ public: bool isDisabled() const { return m_disabledState == Disabled; } bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; } bool isIcon() const { return m_relAttribute.m_isIcon; } + + virtual void attach(); + virtual bool canLazyAttach() { return false; } private: virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; } @@ -105,6 +108,7 @@ private: virtual void parseMappedAttribute(Attribute*); void process(); + static void processCallback(Node*); virtual void insertedIntoDocument(); virtual void removedFromDocument(); @@ -120,7 +124,7 @@ private: void setDisabledState(bool _disabled); virtual bool isURLAttribute(Attribute*) const; - + public: static void tokenizeRelAttribute(const AtomicString& value, RelAttribute&); @@ -159,7 +163,11 @@ private: RelAttribute m_relAttribute; bool m_loading; bool m_createdByParser; +<<<<<<< HEAD Timer<HTMLLinkElement> m_timer; +======= + bool m_shouldProcessAfterAttach; +>>>>>>> webkit.org at r61871 }; } //namespace diff --git a/WebCore/html/HTMLLinkElement.idl b/WebCore/html/HTMLLinkElement.idl index dc700df..a7e7d32 100644 --- a/WebCore/html/HTMLLinkElement.idl +++ b/WebCore/html/HTMLLinkElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,18 +21,18 @@ module html { interface HTMLLinkElement : HTMLElement { - attribute boolean disabled; - attribute [ConvertNullToNullString] DOMString charset; - attribute [ConvertNullToNullString] DOMString href; - attribute [ConvertNullToNullString] DOMString hreflang; - attribute [ConvertNullToNullString] DOMString media; - attribute [ConvertNullToNullString] DOMString rel; - attribute [ConvertNullToNullString] DOMString rev; - attribute [ConvertNullToNullString] DOMString target; - attribute [ConvertNullToNullString] DOMString type; + attribute [Reflect] boolean disabled; + attribute [Reflect] DOMString charset; + attribute [ReflectURL] DOMString href; + attribute [Reflect] DOMString hreflang; + attribute [Reflect] DOMString media; + attribute [Reflect] DOMString rel; + attribute [Reflect] DOMString rev; + attribute [Reflect] DOMString target; + attribute [Reflect] DOMString type; // DOM Level 2 Style - readonly attribute StyleSheet sheet; + readonly attribute StyleSheet sheet; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // Objective-C extension: diff --git a/WebCore/html/HTMLMapElement.cpp b/WebCore/html/HTMLMapElement.cpp index 07fcb5c..14c0feb 100644 --- a/WebCore/html/HTMLMapElement.cpp +++ b/WebCore/html/HTMLMapElement.cpp @@ -46,12 +46,12 @@ HTMLMapElement::HTMLMapElement(const QualifiedName& tagName, Document* document) PassRefPtr<HTMLMapElement> HTMLMapElement::create(Document* document) { - return new HTMLMapElement(mapTag, document); + return adoptRef(new HTMLMapElement(mapTag, document)); } PassRefPtr<HTMLMapElement> HTMLMapElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLMapElement(tagName, document); + return adoptRef(new HTMLMapElement(tagName, document)); } HTMLMapElement::~HTMLMapElement() diff --git a/WebCore/html/HTMLMapElement.idl b/WebCore/html/HTMLMapElement.idl index 1a760d1..7811c9a 100644 --- a/WebCore/html/HTMLMapElement.idl +++ b/WebCore/html/HTMLMapElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ module html { interface HTMLMapElement : HTMLElement { readonly attribute HTMLCollection areas; - attribute [ConvertNullToNullString] DOMString name; + attribute [Reflect] DOMString name; }; } diff --git a/WebCore/html/HTMLMarqueeElement.cpp b/WebCore/html/HTMLMarqueeElement.cpp index c16b069..ada26c1 100644 --- a/WebCore/html/HTMLMarqueeElement.cpp +++ b/WebCore/html/HTMLMarqueeElement.cpp @@ -47,7 +47,7 @@ inline HTMLMarqueeElement::HTMLMarqueeElement(const QualifiedName& tagName, Docu PassRefPtr<HTMLMarqueeElement> HTMLMarqueeElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLMarqueeElement(tagName, document); + return adoptRef(new HTMLMarqueeElement(tagName, document)); } bool HTMLMarqueeElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index 34679e7..fb024e0 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -1998,7 +1998,7 @@ void HTMLMediaElement::createMediaPlayerProxy() // Hang onto the proxy widget so it won't be destroyed if the plug-in is set to // display:none - m_proxyWidget = loader->loadMediaPlayerProxyPlugin(this, url, paramNames, paramValues); + m_proxyWidget = loader->subframeLoader()->loadMediaPlayerProxyPlugin(this, url, paramNames, paramValues); if (m_proxyWidget) m_needWidgetUpdate = false; } @@ -2080,6 +2080,11 @@ void HTMLMediaElement::mediaCanStart() loadInternal(); } +bool HTMLMediaElement::isURLAttribute(Attribute* attribute) const +{ + return attribute->name() == srcAttr; +} + } #endif diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h index 35c2235..7d83f94 100644 --- a/WebCore/html/HTMLMediaElement.h +++ b/WebCore/html/HTMLMediaElement.h @@ -174,6 +174,7 @@ protected: virtual ~HTMLMediaElement(); virtual void parseMappedAttribute(Attribute*); + virtual bool isURLAttribute(Attribute*) const; virtual void attach(); virtual void willMoveToNewOwnerDocument(); diff --git a/WebCore/html/HTMLMediaElement.idl b/WebCore/html/HTMLMediaElement.idl index 5cd3293..93430b4 100644 --- a/WebCore/html/HTMLMediaElement.idl +++ b/WebCore/html/HTMLMediaElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,7 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement { readonly attribute MediaError error; // network state - attribute DOMString src; + attribute [ReflectURL] DOMString src; readonly attribute DOMString currentSrc; const unsigned short NETWORK_EMPTY = 0; @@ -66,8 +66,8 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement { readonly attribute TimeRanges played; readonly attribute TimeRanges seekable; readonly attribute boolean ended; - attribute boolean autoplay; - attribute boolean loop; + attribute [Reflect] boolean autoplay; + attribute [Reflect] boolean loop; [NeedsUserGestureCheck] void play(); [NeedsUserGestureCheck] void pause(); diff --git a/WebCore/html/HTMLMenuElement.cpp b/WebCore/html/HTMLMenuElement.cpp index 92030b5..7acef0f 100644 --- a/WebCore/html/HTMLMenuElement.cpp +++ b/WebCore/html/HTMLMenuElement.cpp @@ -37,7 +37,7 @@ inline HTMLMenuElement::HTMLMenuElement(const QualifiedName& tagName, Document* PassRefPtr<HTMLMenuElement> HTMLMenuElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLMenuElement(tagName, document); + return adoptRef(new HTMLMenuElement(tagName, document)); } bool HTMLMenuElement::compact() const diff --git a/WebCore/html/HTMLMenuElement.idl b/WebCore/html/HTMLMenuElement.idl index 238263a..ff14754 100644 --- a/WebCore/html/HTMLMenuElement.idl +++ b/WebCore/html/HTMLMenuElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLMenuElement : HTMLElement { - attribute boolean compact; + attribute [Reflect] boolean compact; }; } diff --git a/WebCore/html/HTMLMetaElement.cpp b/WebCore/html/HTMLMetaElement.cpp index e6ddc0c..a7f2978 100644 --- a/WebCore/html/HTMLMetaElement.cpp +++ b/WebCore/html/HTMLMetaElement.cpp @@ -48,7 +48,7 @@ inline HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document* PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLMetaElement(tagName, document); + return adoptRef(new HTMLMetaElement(tagName, document)); } void HTMLMetaElement::parseMappedAttribute(Attribute* attr) diff --git a/WebCore/html/HTMLMetaElement.idl b/WebCore/html/HTMLMetaElement.idl index ef7e4ab..f4ffb2d 100644 --- a/WebCore/html/HTMLMetaElement.idl +++ b/WebCore/html/HTMLMetaElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,10 +20,10 @@ module html { interface HTMLMetaElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString content; - attribute [ConvertNullToNullString] DOMString httpEquiv; - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString scheme; + attribute [Reflect] DOMString content; + attribute [Reflect=http_equiv] DOMString httpEquiv; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString scheme; }; } diff --git a/WebCore/html/HTMLMeterElement.cpp b/WebCore/html/HTMLMeterElement.cpp index 1e8956d..7c025f7 100644 --- a/WebCore/html/HTMLMeterElement.cpp +++ b/WebCore/html/HTMLMeterElement.cpp @@ -28,7 +28,7 @@ #include "FormDataList.h" #include "HTMLFormElement.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "RenderMeter.h" #include <wtf/StdLibExtras.h> @@ -36,8 +36,10 @@ namespace WebCore { using namespace HTMLNames; +// FIXME: This constructor should take an explicit form element pointer passed from the +// parser like the constructors for all the other classes derived from HTMLFormControlElement. HTMLMeterElement::HTMLMeterElement(const QualifiedName& tagName, Document* document) - : HTMLFormControlElement(tagName, document, 0, CreateHTMLElement) + : HTMLFormControlElement(tagName, document, 0) { ASSERT(hasTagName(meterTag)); } @@ -189,7 +191,7 @@ HTMLMeterElement::GaugeRegion HTMLMeterElement::gaugeRegion() const } // The optimum range stays between high and low - if (lowValue < highValue && theValue < highValue) + if (lowValue < theValue && theValue < highValue) return GaugeRegionOptimum; if (theValue == min() || max() == theValue) return GaugeRegionEvenLessGood; diff --git a/WebCore/html/HTMLModElement.cpp b/WebCore/html/HTMLModElement.cpp index a745e44..cb6da83 100644 --- a/WebCore/html/HTMLModElement.cpp +++ b/WebCore/html/HTMLModElement.cpp @@ -36,7 +36,7 @@ inline HTMLModElement::HTMLModElement(const QualifiedName& tagName, Document* do PassRefPtr<HTMLModElement> HTMLModElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLModElement(tagName, document); + return adoptRef(new HTMLModElement(tagName, document)); } String HTMLModElement::cite() const diff --git a/WebCore/html/HTMLModElement.idl b/WebCore/html/HTMLModElement.idl index a6e3a02..e9e996d 100644 --- a/WebCore/html/HTMLModElement.idl +++ b/WebCore/html/HTMLModElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,8 +20,8 @@ module html { interface HTMLModElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString cite; - attribute [ConvertNullToNullString] DOMString dateTime; + attribute [Reflect] DOMString cite; + attribute [Reflect] DOMString dateTime; }; } diff --git a/WebCore/html/HTMLNoScriptElement.cpp b/WebCore/html/HTMLNoScriptElement.cpp index eda2110..f232340 100644 --- a/WebCore/html/HTMLNoScriptElement.cpp +++ b/WebCore/html/HTMLNoScriptElement.cpp @@ -39,7 +39,7 @@ inline HTMLNoScriptElement::HTMLNoScriptElement(const QualifiedName& tagName, Do PassRefPtr<HTMLNoScriptElement> HTMLNoScriptElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLNoScriptElement(tagName, document); + return adoptRef(new HTMLNoScriptElement(tagName, document)); } bool HTMLNoScriptElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLOListElement.cpp b/WebCore/html/HTMLOListElement.cpp index 277b809..c40f216 100644 --- a/WebCore/html/HTMLOListElement.cpp +++ b/WebCore/html/HTMLOListElement.cpp @@ -42,12 +42,12 @@ HTMLOListElement::HTMLOListElement(const QualifiedName& tagName, Document* docum PassRefPtr<HTMLOListElement> HTMLOListElement::create(Document* document) { - return new HTMLOListElement(olTag, document); + return adoptRef(new HTMLOListElement(olTag, document)); } PassRefPtr<HTMLOListElement> HTMLOListElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLOListElement(tagName, document); + return adoptRef(new HTMLOListElement(tagName, document)); } bool HTMLOListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLOListElement.idl b/WebCore/html/HTMLOListElement.idl index 32d81f2..63e06b2 100644 --- a/WebCore/html/HTMLOListElement.idl +++ b/WebCore/html/HTMLOListElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,9 +20,9 @@ module html { interface HTMLOListElement : HTMLElement { - attribute boolean compact; + attribute [Reflect] boolean compact; attribute long start; - attribute [ConvertNullToNullString] DOMString type; + attribute [Reflect] DOMString type; }; } diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp index bd9fc1c..45586d1 100644 --- a/WebCore/html/HTMLObjectElement.cpp +++ b/WebCore/html/HTMLObjectElement.cpp @@ -243,6 +243,9 @@ void HTMLObjectElement::renderFallbackContent() { if (m_useFallbackContent) return; + + if (!inDocument()) + return; // Before we give up and use fallback content, check to see if this is a MIME type issue. if (m_imageLoader && m_imageLoader->image()) { diff --git a/WebCore/html/HTMLObjectElement.idl b/WebCore/html/HTMLObjectElement.idl index be91dc4..ee0f1c6 100644 --- a/WebCore/html/HTMLObjectElement.idl +++ b/WebCore/html/HTMLObjectElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -26,37 +26,36 @@ module html { CustomCall ] HTMLObjectElement : HTMLElement { readonly attribute HTMLFormElement form; - attribute [ConvertNullToNullString, Reflect] DOMString code; - attribute [ConvertNullToNullString, Reflect] DOMString align; - attribute [ConvertNullToNullString, Reflect] DOMString archive; - attribute [ConvertNullToNullString, Reflect] DOMString border; - attribute [ConvertNullToNullString, Reflect=codebase] DOMString codeBase; - attribute [ConvertNullToNullString, Reflect=codetype] DOMString codeType; - attribute [ConvertNullToNullString, ReflectURL] DOMString data; - attribute boolean declare; - attribute [ConvertNullToNullString, Reflect] DOMString height; - attribute long hspace; - attribute [ConvertNullToNullString, Reflect] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString standby; - attribute [ConvertNullToNullString, Reflect] DOMString type; - attribute [ConvertNullToNullString, Reflect=usemap] DOMString useMap; - attribute long vspace; - attribute [ConvertNullToNullString, Reflect] DOMString width; - readonly attribute boolean willValidate; + attribute [Reflect] DOMString code; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString archive; + attribute [Reflect] DOMString border; + attribute [Reflect] DOMString codeBase; + attribute [Reflect] DOMString codeType; + attribute [ReflectURL] DOMString data; + attribute [Reflect] boolean declare; + attribute [Reflect] DOMString height; + attribute [Reflect] long hspace; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString standby; + attribute [Reflect] DOMString type; + attribute [Reflect] DOMString useMap; + attribute [Reflect] long vspace; + attribute [Reflect] DOMString width; + readonly attribute boolean willValidate; // Introduced in DOM Level 2: - readonly attribute [CheckFrameSecurity] Document contentDocument; + readonly attribute [CheckFrameSecurity] Document contentDocument; #if defined(ENABLE_SVG) && ENABLE_SVG #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C || defined(ENABLE_SVG_DOM_OBJC_BINDINGS) && ENABLE_SVG_DOM_OBJC_BINDINGS - [SVGCheckSecurityDocument] SVGDocument getSVGDocument() - raises(DOMException); + [SVGCheckSecurityDocument] SVGDocument getSVGDocument() raises(DOMException); #endif #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // Objective-C extension: - readonly attribute URL absoluteImageURL; + readonly attribute URL absoluteImageURL; #endif }; diff --git a/WebCore/html/HTMLOptGroupElement.cpp b/WebCore/html/HTMLOptGroupElement.cpp index b98b668..27bc40e 100644 --- a/WebCore/html/HTMLOptGroupElement.cpp +++ b/WebCore/html/HTMLOptGroupElement.cpp @@ -45,7 +45,7 @@ inline HTMLOptGroupElement::HTMLOptGroupElement(const QualifiedName& tagName, Do PassRefPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLOptGroupElement(tagName, document, form); + return adoptRef(new HTMLOptGroupElement(tagName, document, form)); } bool HTMLOptGroupElement::supportsFocus() const diff --git a/WebCore/html/HTMLOptGroupElement.idl b/WebCore/html/HTMLOptGroupElement.idl index 691bd13..75cead0 100644 --- a/WebCore/html/HTMLOptGroupElement.idl +++ b/WebCore/html/HTMLOptGroupElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,8 +20,8 @@ module html { interface HTMLOptGroupElement : HTMLElement { - attribute boolean disabled; - attribute [ConvertNullToNullString] DOMString label; + attribute [Reflect] boolean disabled; + attribute [Reflect] DOMString label; }; } diff --git a/WebCore/html/HTMLOptionElement.cpp b/WebCore/html/HTMLOptionElement.cpp index 1be0746..dfee748 100644 --- a/WebCore/html/HTMLOptionElement.cpp +++ b/WebCore/html/HTMLOptionElement.cpp @@ -50,18 +50,18 @@ HTMLOptionElement::HTMLOptionElement(const QualifiedName& tagName, Document* doc PassRefPtr<HTMLOptionElement> HTMLOptionElement::create(Document* document, HTMLFormElement* form) { - return new HTMLOptionElement(optionTag, document, form); + return adoptRef(new HTMLOptionElement(optionTag, document, form)); } PassRefPtr<HTMLOptionElement> HTMLOptionElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLOptionElement(tagName, document, form); + return adoptRef(new HTMLOptionElement(tagName, document, form)); } PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document* document, const String& data, const String& value, bool defaultSelected, bool selected, ExceptionCode& ec) { - RefPtr<HTMLOptionElement> element = new HTMLOptionElement(optionTag, document); + RefPtr<HTMLOptionElement> element = adoptRef(new HTMLOptionElement(optionTag, document)); RefPtr<Text> text = Text::create(document, data.isNull() ? "" : data); diff --git a/WebCore/html/HTMLOptionElement.idl b/WebCore/html/HTMLOptionElement.idl index c43132e..eb299ef 100644 --- a/WebCore/html/HTMLOptionElement.idl +++ b/WebCore/html/HTMLOptionElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple, Inc. + * Copyright (C) 2006, 2007, 2010 Apple, Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -23,19 +23,18 @@ module html { interface [ GenerateNativeConverter ] HTMLOptionElement : HTMLElement { - readonly attribute HTMLFormElement form; - attribute boolean defaultSelected; + readonly attribute HTMLFormElement form; + attribute [Reflect=selected] boolean defaultSelected; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString] DOMString text - setter raises(DOMException); + attribute [ConvertNullToNullString] DOMString text setter raises(DOMException); #else - readonly attribute DOMString text; + readonly attribute DOMString text; #endif - readonly attribute long index; - attribute boolean disabled; - attribute [ConvertNullToNullString] DOMString label; - attribute boolean selected; - attribute [ConvertNullToNullString] DOMString value; + readonly attribute long index; + attribute [Reflect] boolean disabled; + attribute [Reflect] DOMString label; + attribute boolean selected; + attribute [ConvertNullToNullString] DOMString value; }; } diff --git a/WebCore/html/HTMLParagraphElement.cpp b/WebCore/html/HTMLParagraphElement.cpp index fd04a30..4afa9f8 100644 --- a/WebCore/html/HTMLParagraphElement.cpp +++ b/WebCore/html/HTMLParagraphElement.cpp @@ -41,7 +41,7 @@ inline HTMLParagraphElement::HTMLParagraphElement(const QualifiedName& tagName, PassRefPtr<HTMLParagraphElement> HTMLParagraphElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLParagraphElement(tagName, document); + return adoptRef(new HTMLParagraphElement(tagName, document)); } bool HTMLParagraphElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLParagraphElement.idl b/WebCore/html/HTMLParagraphElement.idl index cd3b940..246e9e9 100644 --- a/WebCore/html/HTMLParagraphElement.idl +++ b/WebCore/html/HTMLParagraphElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,7 +20,7 @@ module html { interface HTMLParagraphElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; + attribute [Reflect] DOMString align; }; } diff --git a/WebCore/html/HTMLParamElement.cpp b/WebCore/html/HTMLParamElement.cpp index a637d5b..13a37d6 100644 --- a/WebCore/html/HTMLParamElement.cpp +++ b/WebCore/html/HTMLParamElement.cpp @@ -39,7 +39,7 @@ inline HTMLParamElement::HTMLParamElement(const QualifiedName& tagName, Document PassRefPtr<HTMLParamElement> HTMLParamElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLParamElement(tagName, document); + return adoptRef(new HTMLParamElement(tagName, document)); } void HTMLParamElement::parseMappedAttribute(Attribute* attr) diff --git a/WebCore/html/HTMLParamElement.idl b/WebCore/html/HTMLParamElement.idl index 2473381..1f0c0de 100644 --- a/WebCore/html/HTMLParamElement.idl +++ b/WebCore/html/HTMLParamElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,10 +20,10 @@ module html { interface HTMLParamElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString type; - attribute [ConvertNullToNullString] DOMString value; - attribute [ConvertNullToNullString] DOMString valueType; + attribute [Reflect] DOMString name; + attribute [Reflect] DOMString type; + attribute [Reflect] DOMString value; + attribute [Reflect] DOMString valueType; }; } diff --git a/WebCore/html/HTMLParserScheduler.cpp b/WebCore/html/HTMLParserScheduler.cpp new file mode 100644 index 0000000..6e67697 --- /dev/null +++ b/WebCore/html/HTMLParserScheduler.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTMLParserScheduler.h" + +#include "FrameView.h" // Only for isLayoutTimerActive +#include "HTMLDocumentParser.h" +#include "Document.h" + +// defaultParserChunkSize is used to define how many tokens the parser will +// process before checking against parserTimeLimit and possibly yielding. +// This is a performance optimization to prevent checking after every token. +static const int defaultParserChunkSize = 4096; + +// defaultParserTimeLimit is the seconds the parser will run in one write() call +// before yielding. Inline <script> execution can cause it to excede the limit. +// FIXME: We would like this value to be 0.2. +static const double defaultParserTimeLimit = 0.500; + +namespace WebCore { + +static double parserTimeLimit(Page* page) +{ + // We're using the poorly named customHTMLTokenizerTimeDelay setting. + if (page && page->hasCustomHTMLTokenizerTimeDelay()) + return page->customHTMLTokenizerTimeDelay(); + return defaultParserTimeLimit; +} + +static int parserChunkSize(Page* page) +{ + // FIXME: We may need to divide the value from customHTMLTokenizerChunkSize + // by some constant to translate from the "character" based behavior of the + // old LegacyHTMLDocumentParser to the token-based behavior of this parser. + if (page && page->hasCustomHTMLTokenizerChunkSize()) + return page->customHTMLTokenizerChunkSize(); + return defaultParserChunkSize; +} + +HTMLParserScheduler::HTMLParserScheduler(HTMLDocumentParser* parser) + : m_parser(parser) + , m_parserTimeLimit(parserTimeLimit(m_parser->document()->page())) + , m_parserChunkSize(parserChunkSize(m_parser->document()->page())) + , m_continueNextChunkTimer(this, &HTMLParserScheduler::continueNextChunkTimerFired) +{ +} + +HTMLParserScheduler::~HTMLParserScheduler() +{ + m_continueNextChunkTimer.stop(); +} + +// FIXME: This belongs on Document. +static bool isLayoutTimerActive(Document* doc) +{ + ASSERT(doc); + return doc->view() && doc->view()->layoutPending() && !doc->minimumLayoutDelay(); +} + +void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>* timer) +{ + ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); + // FIXME: The timer class should handle timer priorities instead of this code. + // If a layout is scheduled, wait again to let the layout timer run first. + if (isLayoutTimerActive(m_parser->document())) { + m_continueNextChunkTimer.startOneShot(0); + return; + } + m_parser->resumeParsingAfterYield(); +} + +} diff --git a/WebCore/html/HTMLParserScheduler.h b/WebCore/html/HTMLParserScheduler.h new file mode 100644 index 0000000..1ea2c65 --- /dev/null +++ b/WebCore/html/HTMLParserScheduler.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTMLParserScheduler_h +#define HTMLParserScheduler_h + +#include "Timer.h" +#include <wtf/CurrentTime.h> +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class HTMLDocumentParser; + +class HTMLParserScheduler : public Noncopyable { +public: + HTMLParserScheduler(HTMLDocumentParser*); + ~HTMLParserScheduler(); + + struct PumpSession { + PumpSession() + : processedTokens(0) + , startTime(currentTime()) + { + } + + int processedTokens; + double startTime; + }; + + // Inline as this is called after every token in the parser. + bool shouldContinueParsing(PumpSession& session) + { + if (session.processedTokens > m_parserChunkSize) { + session.processedTokens = 0; + double elapsedTime = currentTime() - session.startTime; + if (elapsedTime > m_parserTimeLimit) { + // Schedule the parser to continue and yield from the parser. + m_continueNextChunkTimer.startOneShot(0); + return false; + } + } + + ++session.processedTokens; + return true; + } + + bool isScheduledForResume() const { return m_continueNextChunkTimer.isActive(); } + +private: + void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*); + + HTMLDocumentParser* m_parser; + + double m_parserTimeLimit; + int m_parserChunkSize; + Timer<HTMLParserScheduler> m_continueNextChunkTimer; +}; + +} + +#endif diff --git a/WebCore/html/HTMLPreElement.cpp b/WebCore/html/HTMLPreElement.cpp index 68522e5..b13c801 100644 --- a/WebCore/html/HTMLPreElement.cpp +++ b/WebCore/html/HTMLPreElement.cpp @@ -39,7 +39,7 @@ inline HTMLPreElement::HTMLPreElement(const QualifiedName& tagName, Document* do PassRefPtr<HTMLPreElement> HTMLPreElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLPreElement(tagName, document); + return adoptRef(new HTMLPreElement(tagName, document)); } bool HTMLPreElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLPreElement.idl b/WebCore/html/HTMLPreElement.idl index 5dc0e9e..ae137f0 100644 --- a/WebCore/html/HTMLPreElement.idl +++ b/WebCore/html/HTMLPreElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All right reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -23,10 +23,10 @@ module html { interface HTMLPreElement : HTMLElement { // FIXME: DOM spec says that width should be of type DOMString // see http://bugs.webkit.org/show_bug.cgi?id=8992 - attribute long width; + attribute [Reflect] long width; // Extensions - attribute boolean wrap; + attribute [Reflect] boolean wrap; }; } diff --git a/WebCore/html/HTMLPreloadScanner.cpp b/WebCore/html/HTMLPreloadScanner.cpp new file mode 100644 index 0000000..57ac408 --- /dev/null +++ b/WebCore/html/HTMLPreloadScanner.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ + * Copyright (C) 2010 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTMLPreloadScanner.h" + +#include "CSSHelper.h" +#include "DocLoader.h" +#include "Document.h" +#include "HTMLTreeBuilder.h" +#include "HTMLLinkElement.h" +#include "HTMLNames.h" + +namespace WebCore { + +using namespace HTMLNames; + +namespace { + +class PreloadTask { +public: + PreloadTask(const HTMLToken& token) + : m_tagName(token.name().data(), token.name().size()) + , m_linkIsStyleSheet(false) + { + processAttributes(token.attributes()); + } + + void processAttributes(const HTMLToken::AttributeList& attributes) + { + if (m_tagName != scriptTag && m_tagName != imgTag && m_tagName != linkTag) + return; + + for (HTMLToken::AttributeList::const_iterator iter = attributes.begin(); + iter != attributes.end(); ++iter) { + AtomicString attributeName(iter->m_name.data(), iter->m_name.size()); + String attributeValue(iter->m_value.data(), iter->m_value.size()); + + if (attributeName == charsetAttr) + m_charset = attributeValue; + + if (m_tagName == scriptTag || m_tagName == imgTag) { + if (attributeName == srcAttr) + setUrlToLoad(attributeValue); + } else if (m_tagName == linkTag) { + if (attributeName == hrefAttr) + setUrlToLoad(attributeValue); + else if (attributeName == relAttr) + m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue); + } + } + } + + bool relAttributeIsStyleSheet(const String& attributeValue) + { + ASSERT(m_tagName == linkTag); + HTMLLinkElement::RelAttribute rel; + HTMLLinkElement::tokenizeRelAttribute(attributeValue, rel); + return rel.m_isStyleSheet && !rel.m_isAlternate && !rel.m_isIcon && !rel.m_isDNSPrefetch; + } + + void setUrlToLoad(const String& attributeValue) + { + // We only respect the first src/href, per HTML5: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#attribute-name-state + if (!m_urlToLoad.isEmpty()) + return; + m_urlToLoad = deprecatedParseURL(attributeValue); + } + + void preload(Document* document, bool scanningBody) + { + if (m_urlToLoad.isEmpty()) + return; + + DocLoader* docLoader = document->docLoader(); + if (m_tagName == scriptTag) + docLoader->preload(CachedResource::Script, m_urlToLoad, m_charset, scanningBody); + else if (m_tagName == imgTag) + docLoader->preload(CachedResource::ImageResource, m_urlToLoad, String(), scanningBody); + else if (m_tagName == linkTag && m_linkIsStyleSheet) + docLoader->preload(CachedResource::CSSStyleSheet, m_urlToLoad, m_charset, scanningBody); + } + + const AtomicString& tagName() const { return m_tagName; } + +private: + AtomicString m_tagName; + String m_urlToLoad; + String m_charset; + bool m_linkIsStyleSheet; +}; + +} // namespace + +HTMLPreloadScanner::HTMLPreloadScanner(Document* document) + : m_document(document) + , m_cssScanner(document) + , m_bodySeen(false) + , m_inStyle(false) +{ +} + +void HTMLPreloadScanner::appendToEnd(const SegmentedString& source) +{ + m_source.append(source); +} + +void HTMLPreloadScanner::scan() +{ + // FIXME: We should save and re-use these tokens in HTMLDocumentParser if + // the pending script doesn't end up calling document.write. + while (m_tokenizer.nextToken(m_source, m_token)) { + processToken(); + m_token.clear(); + } +} + +void HTMLPreloadScanner::processToken() +{ + if (m_inStyle) { + if (m_token.type() == HTMLToken::Character) + m_cssScanner.scan(m_token, scanningBody()); + else if (m_token.type() == HTMLToken::EndTag) { + m_inStyle = false; + m_cssScanner.reset(); + } + } + + if (m_token.type() != HTMLToken::StartTag) + return; + + PreloadTask task(m_token); + m_tokenizer.setState(HTMLTreeBuilder::adjustedLexerState(m_tokenizer.state(), task.tagName(), m_document->frame())); + if (task.tagName() == scriptTag) { + // The tree builder handles scriptTag separately from the other tokenizer + // state adjustments, so we need to handle it separately too. + ASSERT(m_tokenizer.state() == HTMLTokenizer::DataState); + m_tokenizer.setState(HTMLTokenizer::ScriptDataState); + } + + if (task.tagName() == bodyTag) + m_bodySeen = true; + + if (task.tagName() == styleTag) + m_inStyle = true; + + task.preload(m_document, scanningBody()); +} + +bool HTMLPreloadScanner::scanningBody() const +{ + return m_document->body() || m_bodySeen; +} + +} diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.h b/WebCore/html/HTMLPreloadScanner.h index decf05b..ee49ee0 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.h +++ b/WebCore/html/HTMLPreloadScanner.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * 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 @@ -23,25 +24,41 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSMessageChannelConstructor_h -#define JSMessageChannelConstructor_h +#ifndef HTMLPreloadScanner_h +#define HTMLPreloadScanner_h -#include "JSDOMBinding.h" +#include "CSSPreloadScanner.h" +#include "HTMLTokenizer.h" +#include "HTMLToken.h" +#include "SegmentedString.h" +#include <wtf/Noncopyable.h> namespace WebCore { - class JSMessageChannelConstructor : public DOMConstructorObject { - public: - JSMessageChannelConstructor(JSC::ExecState*, JSDOMGlobalObject*); - virtual ~JSMessageChannelConstructor(); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - static const JSC::ClassInfo s_info; +class Document; +class HTMLToken; +class SegmentedString; - virtual bool implementsHasInstance() const { return true; } - static JSC::EncodedJSValue JSC_HOST_CALL construct(JSC::ExecState*); - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - }; +class HTMLPreloadScanner : public Noncopyable { +public: + HTMLPreloadScanner(Document*); -} // namespace WebCore + void appendToEnd(const SegmentedString&); + void scan(); -#endif // JSMessageChannelConstructor_h +private: + void processToken(); + bool scanningBody() const; + + Document* m_document; + SegmentedString m_source; + HTMLTokenizer m_tokenizer; + HTMLToken m_token; + CSSPreloadScanner m_cssScanner; + bool m_bodySeen; + bool m_inStyle; +}; + +} + +#endif diff --git a/WebCore/html/HTMLProgressElement.cpp b/WebCore/html/HTMLProgressElement.cpp index 22226d9..5cf7714 100644 --- a/WebCore/html/HTMLProgressElement.cpp +++ b/WebCore/html/HTMLProgressElement.cpp @@ -28,7 +28,7 @@ #include "FormDataList.h" #include "HTMLFormElement.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "RenderProgress.h" #include <wtf/StdLibExtras.h> @@ -37,7 +37,7 @@ namespace WebCore { using namespace HTMLNames; HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) - : HTMLFormControlElement(tagName, document, form, CreateHTMLElement) + : HTMLFormControlElement(tagName, document, form) { ASSERT(hasTagName(progressTag)); } diff --git a/WebCore/html/HTMLQuoteElement.cpp b/WebCore/html/HTMLQuoteElement.cpp index b646fc0..2d0013a 100644 --- a/WebCore/html/HTMLQuoteElement.cpp +++ b/WebCore/html/HTMLQuoteElement.cpp @@ -38,7 +38,7 @@ inline HTMLQuoteElement::HTMLQuoteElement(const QualifiedName& tagName, Document PassRefPtr<HTMLQuoteElement> HTMLQuoteElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLQuoteElement(tagName, document); + return adoptRef(new HTMLQuoteElement(tagName, document)); } void HTMLQuoteElement::insertedIntoDocument() diff --git a/WebCore/html/HTMLQuoteElement.idl b/WebCore/html/HTMLQuoteElement.idl index f95dc20..a4e6005 100644 --- a/WebCore/html/HTMLQuoteElement.idl +++ b/WebCore/html/HTMLQuoteElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -20,6 +20,6 @@ module html { interface HTMLQuoteElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString cite; + attribute [Reflect] DOMString cite; }; } diff --git a/WebCore/html/HTMLScriptElement.cpp b/WebCore/html/HTMLScriptElement.cpp index f4c3ae8..48da4b9 100644 --- a/WebCore/html/HTMLScriptElement.cpp +++ b/WebCore/html/HTMLScriptElement.cpp @@ -45,12 +45,12 @@ inline HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Docume PassRefPtr<HTMLScriptElement> HTMLScriptElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) { - return new HTMLScriptElement(tagName, document, createdByParser); + return adoptRef(new HTMLScriptElement(tagName, document, createdByParser)); } bool HTMLScriptElement::isURLAttribute(Attribute* attr) const { - return attr->name() == sourceAttributeValue(); + return attr->name() == srcAttr; } bool HTMLScriptElement::shouldExecuteAsJavaScript() const @@ -149,9 +149,19 @@ void HTMLScriptElement::setCharset(const String &value) setAttribute(charsetAttr, value); } +bool HTMLScriptElement::async() const +{ + return asyncAttributeValue(); +} + +void HTMLScriptElement::setAsync(bool async) +{ + setAttribute(asyncAttr, async ? "" : 0); +} + bool HTMLScriptElement::defer() const { - return !getAttribute(deferAttr).isNull(); + return deferAttributeValue(); } void HTMLScriptElement::setDefer(bool defer) @@ -226,6 +236,16 @@ String HTMLScriptElement::eventAttributeValue() const return getAttribute(eventAttr).string(); } +bool HTMLScriptElement::asyncAttributeValue() const +{ + return !getAttribute(asyncAttr).isNull(); +} + +bool HTMLScriptElement::deferAttributeValue() const +{ + return !getAttribute(deferAttr).isNull(); +} + void HTMLScriptElement::dispatchLoadEvent() { ASSERT(!m_data.haveFiredLoadEvent()); diff --git a/WebCore/html/HTMLScriptElement.h b/WebCore/html/HTMLScriptElement.h index 14a1264..3c8e8ce 100644 --- a/WebCore/html/HTMLScriptElement.h +++ b/WebCore/html/HTMLScriptElement.h @@ -47,6 +47,9 @@ public: String charset() const; void setCharset(const String&); + bool async() const; + void setAsync(bool); + bool defer() const; void setDefer(bool); @@ -85,6 +88,8 @@ private: virtual String languageAttributeValue() const; virtual String forAttributeValue() const; virtual String eventAttributeValue() const; + virtual bool asyncAttributeValue() const; + virtual bool deferAttributeValue() const; virtual void dispatchLoadEvent(); virtual void dispatchErrorEvent(); diff --git a/WebCore/html/HTMLScriptElement.idl b/WebCore/html/HTMLScriptElement.idl index 8985512..399b5cd 100644 --- a/WebCore/html/HTMLScriptElement.idl +++ b/WebCore/html/HTMLScriptElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -21,11 +21,12 @@ module html { interface HTMLScriptElement : HTMLElement { attribute [ConvertNullToNullString] DOMString text; - attribute [ConvertNullToNullString] DOMString htmlFor; - attribute [ConvertNullToNullString] DOMString event; - attribute [ConvertNullToNullString] DOMString charset; - attribute boolean defer; - attribute [ConvertNullToNullString] DOMString src; - attribute [ConvertNullToNullString] DOMString type; + attribute [Reflect=for] DOMString htmlFor; + attribute [Reflect] DOMString event; + attribute [Reflect] DOMString charset; + attribute [Reflect] boolean async; + attribute [Reflect] boolean defer; + attribute [ReflectURL] DOMString src; + attribute [Reflect] DOMString type; }; } diff --git a/WebCore/html/HTML5ScriptRunner.cpp b/WebCore/html/HTMLScriptRunner.cpp index aef5ce4..ab35449 100644 --- a/WebCore/html/HTML5ScriptRunner.cpp +++ b/WebCore/html/HTMLScriptRunner.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "HTML5ScriptRunner.h" +#include "HTMLScriptRunner.h" #include "Attribute.h" #include "CachedScript.h" @@ -32,7 +32,8 @@ #include "Element.h" #include "Event.h" #include "Frame.h" -#include "HTML5ScriptRunnerHost.h" +#include "HTMLScriptRunnerHost.h" +#include "HTMLInputStream.h" #include "HTMLNames.h" #include "NotImplemented.h" #include "ScriptElement.h" @@ -42,7 +43,26 @@ namespace WebCore { using namespace HTMLNames; -HTML5ScriptRunner::HTML5ScriptRunner(Document* document, HTML5ScriptRunnerHost* host) +class NestScript : public Noncopyable { +public: + NestScript(unsigned& nestingLevel, HTMLInputStream& inputStream) + : m_nestingLevel(&nestingLevel) + , m_savedInsertionPoint(inputStream) + { + ++(*m_nestingLevel); + } + + ~NestScript() + { + --(*m_nestingLevel); + } + +private: + unsigned* m_nestingLevel; + InsertionPointRecord m_savedInsertionPoint; +}; + +HTMLScriptRunner::HTMLScriptRunner(Document* document, HTMLScriptRunnerHost* host) : m_document(document) , m_host(host) , m_scriptNestingLevel(0) @@ -51,10 +71,10 @@ HTML5ScriptRunner::HTML5ScriptRunner(Document* document, HTML5ScriptRunnerHost* ASSERT(m_host); } -HTML5ScriptRunner::~HTML5ScriptRunner() +HTMLScriptRunner::~HTMLScriptRunner() { // FIXME: Should we be passed a "done loading/parsing" callback sooner than destruction? - if (m_parsingBlockingScript.cachedScript && m_parsingBlockingScript.watchingForLoad) + if (m_parsingBlockingScript.cachedScript && m_parsingBlockingScript.watchingForLoad()) stopWatchingForLoad(m_parsingBlockingScript); } @@ -77,7 +97,7 @@ inline PassRefPtr<Event> createScriptErrorEvent() return Event::create(eventNames().errorEvent, true, false); } -ScriptSourceCode HTML5ScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) +ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) { if (script.cachedScript) { errorOccurred = script.cachedScript->errorOccurred(); @@ -88,7 +108,7 @@ ScriptSourceCode HTML5ScriptRunner::sourceFromPendingScript(const PendingScript& return ScriptSourceCode(script.element->textContent(), documentURLForScriptExecution(m_document), script.startingLineNumber); } -bool HTML5ScriptRunner::isPendingScriptReady(const PendingScript& script) +bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script) { m_hasScriptsWaitingForStylesheets = !m_document->haveStylesheetsLoaded(); if (m_hasScriptsWaitingForStylesheets) @@ -98,7 +118,7 @@ bool HTML5ScriptRunner::isPendingScriptReady(const PendingScript& script) return true; } -void HTML5ScriptRunner::executePendingScript() +void HTMLScriptRunner::executePendingScript() { ASSERT(!m_scriptNestingLevel); ASSERT(m_document->haveStylesheetsLoaded()); @@ -107,25 +127,25 @@ void HTML5ScriptRunner::executePendingScript() ScriptSourceCode sourceCode = sourceFromPendingScript(m_parsingBlockingScript, errorOccurred); // Stop watching loads before executeScript to prevent recursion if the script reloads itself. - if (m_parsingBlockingScript.cachedScript && m_parsingBlockingScript.watchingForLoad) + if (m_parsingBlockingScript.cachedScript && m_parsingBlockingScript.watchingForLoad()) stopWatchingForLoad(m_parsingBlockingScript); // Clear the pending script before possible rentrancy from executeScript() RefPtr<Element> scriptElement = m_parsingBlockingScript.element.release(); m_parsingBlockingScript = PendingScript(); - - m_scriptNestingLevel++; - if (errorOccurred) - scriptElement->dispatchEvent(createScriptErrorEvent()); - else { - executeScript(scriptElement.get(), sourceCode); - scriptElement->dispatchEvent(createScriptLoadEvent()); + { + NestScript nestingLevel(m_scriptNestingLevel, m_host->inputStream()); + if (errorOccurred) + scriptElement->dispatchEvent(createScriptErrorEvent()); + else { + executeScript(scriptElement.get(), sourceCode); + scriptElement->dispatchEvent(createScriptLoadEvent()); + } } - m_scriptNestingLevel--; ASSERT(!m_scriptNestingLevel); } -void HTML5ScriptRunner::executeScript(Element* element, const ScriptSourceCode& sourceCode) +void HTMLScriptRunner::executeScript(Element* element, const ScriptSourceCode& sourceCode) { // FIXME: We do not block inline <script> tags on stylesheets for now. // When we do, || !element->hasAttribute(srcAttr) should be removed from @@ -135,29 +155,41 @@ void HTML5ScriptRunner::executeScript(Element* element, const ScriptSourceCode& ASSERT(scriptElement); if (!scriptElement->shouldExecuteAsJavaScript()) return; + ASSERT(inScriptExecution()); + if (!m_document->frame()) + return; + m_document->frame()->script()->executeScript(sourceCode); +} - // Always use the delegate to execute the script so that it can save any - // necessary state to prepare for rentrancy. - m_host->executeScript(sourceCode); +bool HTMLScriptRunner::hasScriptsWaitingForLoad() const +{ + // We're only actually waiting for a load. This allows us to ignore load + // callbacks when CachedResource::addClient calls notifyFinished because + // of a cache hit (not because of a load we were set up to wait for). + return m_parsingBlockingScript.watchingForLoadState == PendingScript::WatchingForLoad; } -void HTML5ScriptRunner::watchForLoad(PendingScript& pendingScript) +void HTMLScriptRunner::watchForLoad(PendingScript& pendingScript) { - ASSERT(!pendingScript.watchingForLoad); + ASSERT(!pendingScript.watchingForLoad()); + // CachedResource::addClient will call notifyFinished if the load is already + // complete. We set watchingForLoadState to RegisteringForWatch so that we + // know to ignore any notifyFinished call during addClient. + pendingScript.watchingForLoadState = PendingScript::RegisteringForWatch; m_host->watchForLoad(pendingScript.cachedScript.get()); - pendingScript.watchingForLoad = true; + pendingScript.watchingForLoadState = PendingScript::WatchingForLoad; } -void HTML5ScriptRunner::stopWatchingForLoad(PendingScript& pendingScript) +void HTMLScriptRunner::stopWatchingForLoad(PendingScript& pendingScript) { - ASSERT(pendingScript.watchingForLoad); + ASSERT(pendingScript.watchingForLoad()); m_host->stopWatchingForLoad(pendingScript.cachedScript.get()); - pendingScript.watchingForLoad = false; + pendingScript.watchingForLoadState = PendingScript::NotWatchingForLoad; } // This function should match 10.2.5.11 "An end tag whose tag name is 'script'" // Script handling lives outside the tree builder to keep the each class simple. -bool HTML5ScriptRunner::execute(PassRefPtr<Element> scriptElement, int startLine) +bool HTMLScriptRunner::execute(PassRefPtr<Element> scriptElement, int startLine) { ASSERT(scriptElement); // FIXME: If scripting is disabled, always just return true; @@ -167,19 +199,19 @@ bool HTML5ScriptRunner::execute(PassRefPtr<Element> scriptElement, int startLine if (haveParsingBlockingScript()) { if (m_scriptNestingLevel) - return false; // Block the parser. Unwind to the outermost HTML5ScriptRunner::execute before continuing parsing. + return false; // Block the parser. Unwind to the outermost HTMLScriptRunner::execute before continuing parsing. if (!executeParsingBlockingScripts()) return false; // We still have a parsing blocking script, block the parser. } return true; // Scripts executed as expected, continue parsing. } -bool HTML5ScriptRunner::haveParsingBlockingScript() const +bool HTMLScriptRunner::haveParsingBlockingScript() const { return !!m_parsingBlockingScript.element; } -bool HTML5ScriptRunner::executeParsingBlockingScripts() +bool HTMLScriptRunner::executeParsingBlockingScripts() { while (haveParsingBlockingScript()) { // We only really need to check once. @@ -190,36 +222,40 @@ bool HTML5ScriptRunner::executeParsingBlockingScripts() return true; } -bool HTML5ScriptRunner::executeScriptsWaitingForLoad(CachedResource*) +bool HTMLScriptRunner::executeScriptsWaitingForLoad(CachedResource* cachedScript) { + // Callers should check hasScriptsWaitingForLoad() before calling + // to prevent parser or script re-entry during due to + // CachedResource::addClient calling notifyFinished on cache-hits. + ASSERT(hasScriptsWaitingForLoad()); ASSERT(!m_scriptNestingLevel); ASSERT(haveParsingBlockingScript()); + ASSERT_UNUSED(cachedScript, m_parsingBlockingScript.cachedScript == cachedScript); ASSERT(m_parsingBlockingScript.cachedScript->isLoaded()); return executeParsingBlockingScripts(); } -bool HTML5ScriptRunner::executeScriptsWaitingForStylesheets() +bool HTMLScriptRunner::executeScriptsWaitingForStylesheets() { // Callers should check hasScriptsWaitingForStylesheets() before calling // to prevent parser or script re-entry during </style> parsing. - ASSERT(m_hasScriptsWaitingForStylesheets); + ASSERT(hasScriptsWaitingForStylesheets()); ASSERT(!m_scriptNestingLevel); ASSERT(m_document->haveStylesheetsLoaded()); return executeParsingBlockingScripts(); } -void HTML5ScriptRunner::requestScript(Element* script) +void HTMLScriptRunner::requestScript(Element* script) { ASSERT(!m_parsingBlockingScript.element); AtomicString srcValue = script->getAttribute(srcAttr); // Allow the host to disllow script loads (using the XSSAuditor, etc.) if (!m_host->shouldLoadExternalScriptFromSrc(srcValue)) return; - // FIXME: We need to resolve the url relative to the element. - m_parsingBlockingScript.element = script; - if (!script->dispatchBeforeLoadEvent(srcValue)) // Part of HTML5? + if (!script->dispatchBeforeLoadEvent(srcValue)) return; + m_parsingBlockingScript.element = script; // This should correctly return 0 for empty or invalid srcValues. CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(script)->scriptCharset()); if (!cachedScript) { @@ -228,32 +264,37 @@ void HTML5ScriptRunner::requestScript(Element* script) } m_parsingBlockingScript.cachedScript = cachedScript; - // We only care about a load callback if cachedScript is not already - // in the cache. Callers will attempt to run the m_parsingBlockingScript - // if possible before returning control to the parser. - if (!m_parsingBlockingScript.cachedScript->isLoaded()) - watchForLoad(m_parsingBlockingScript); + // Always call watchForLoad, even if the script is already loaded. + // CachedResource may purge its data if it has no clients, which would cause + // later script execution to fail. watchForLoad sets m_parsingBlockingScript + // to the RegisteringForWatch state so we know to ignore any + // executeScriptsWaitingForLoad callbacks during the watchForLoad call. + watchForLoad(m_parsingBlockingScript); + // Callers will attempt to run the m_parsingBlockingScript if possible + // before returning control to the parser. } // This method is meant to match the HTML5 definition of "running a script" // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#running-a-script -void HTML5ScriptRunner::runScript(Element* script, int startingLineNumber) +void HTMLScriptRunner::runScript(Element* script, int startingLineNumber) { ASSERT(!haveParsingBlockingScript()); - m_scriptNestingLevel++; - // Check script type and language, current code uses ScriptElement::shouldExecuteAsJavaScript(), but that may not be HTML5 compliant. - notImplemented(); // event for support - - if (script->hasAttribute(srcAttr)) { - // FIXME: Handle defer and async - requestScript(script); - } else { - // FIXME: We do not block inline <script> tags on stylesheets to match the - // old parser for now. See https://bugs.webkit.org/show_bug.cgi?id=40047 - ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); - executeScript(script, sourceCode); + { + NestScript nestingLevel(m_scriptNestingLevel, m_host->inputStream()); + + // Check script type and language, current code uses ScriptElement::shouldExecuteAsJavaScript(), but that may not be HTML5 compliant. + notImplemented(); // event for support + + if (script->hasAttribute(srcAttr)) { + // FIXME: Handle defer and async + requestScript(script); + } else { + // FIXME: We do not block inline <script> tags on stylesheets to match the + // old parser for now. See https://bugs.webkit.org/show_bug.cgi?id=40047 + ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); + executeScript(script, sourceCode); + } } - m_scriptNestingLevel--; } } diff --git a/WebCore/html/HTML5ScriptRunner.h b/WebCore/html/HTMLScriptRunner.h index 19e70a6..7260007 100644 --- a/WebCore/html/HTML5ScriptRunner.h +++ b/WebCore/html/HTMLScriptRunner.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTML5ScriptRunner_h -#define HTML5ScriptRunner_h +#ifndef HTMLScriptRunner_h +#define HTMLScriptRunner_h #include "CachedResourceClient.h" #include "CachedResourceHandle.h" @@ -38,18 +38,20 @@ class CachedScript; class Document; class Element; class Frame; -class HTML5ScriptRunnerHost; +class HTMLScriptRunnerHost; class ScriptSourceCode; -class HTML5ScriptRunner : public Noncopyable { +class HTMLScriptRunner : public Noncopyable { public: - HTML5ScriptRunner(Document*, HTML5ScriptRunnerHost*); - ~HTML5ScriptRunner(); + HTMLScriptRunner(Document*, HTMLScriptRunnerHost*); + ~HTMLScriptRunner(); // Processes the passed in script and any pending scripts if possible. bool execute(PassRefPtr<Element> scriptToProcess, int scriptStartLine); - // Processes any pending scripts. + + bool hasScriptsWaitingForLoad() const; bool executeScriptsWaitingForLoad(CachedResource*); + bool hasScriptsWaitingForStylesheets() const { return m_hasScriptsWaitingForStylesheets; } bool executeScriptsWaitingForStylesheets(); @@ -57,15 +59,29 @@ public: private: struct PendingScript { + // This state controls whether we need to do anything with this script + // when we get a executeScriptsWaitingForLoad callback. + // We ignore callbacks during RegisteringForWatch. + enum WatchingForLoadState { + NotWatchingForLoad, + RegisteringForWatch, + WatchingForLoad, + }; + PendingScript() - : watchingForLoad(false) + : watchingForLoadState(NotWatchingForLoad) , startingLineNumber(0) { } + bool watchingForLoad() + { + return watchingForLoadState != NotWatchingForLoad; + } + RefPtr<Element> element; CachedResourceHandle<CachedScript> cachedScript; - bool watchingForLoad; // Did we pass the cachedScript to the HTML5ScriptRunnerHost. + WatchingForLoadState watchingForLoadState; int startingLineNumber; // Only used for inline script tags. // HTML5 has an isReady parameter, however isReady ends up equivalent to // m_document->haveStylesheetsLoaded() && cachedScript->isLoaded() @@ -80,7 +96,7 @@ private: void requestScript(Element*); void runScript(Element*, int startingLineNumber); - // Helpers for dealing with HTML5ScriptRunnerHost + // Helpers for dealing with HTMLScriptRunnerHost void watchForLoad(PendingScript&); void stopWatchingForLoad(PendingScript&); void executeScript(Element*, const ScriptSourceCode&); @@ -89,13 +105,13 @@ private: ScriptSourceCode sourceFromPendingScript(const PendingScript&, bool& errorOccurred); Document* m_document; - HTML5ScriptRunnerHost* m_host; + HTMLScriptRunnerHost* m_host; PendingScript m_parsingBlockingScript; unsigned m_scriptNestingLevel; // We only want stylesheet loads to trigger script execution if script // execution is currently stopped due to stylesheet loads, otherwise we'd - // cause nested sript execution when parsing <style> tags since </style> + // cause nested script execution when parsing <style> tags since </style> // tags can cause Document to call executeScriptsWaitingForStylesheets. bool m_hasScriptsWaitingForStylesheets; }; diff --git a/WebCore/html/HTML5ScriptRunnerHost.h b/WebCore/html/HTMLScriptRunnerHost.h index 9a77385..82ad70d 100644 --- a/WebCore/html/HTML5ScriptRunnerHost.h +++ b/WebCore/html/HTMLScriptRunnerHost.h @@ -23,28 +23,29 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTML5ScriptRunnerHost_h -#define HTML5ScriptRunnerHost_h +#ifndef HTMLScriptRunnerHost_h +#define HTMLScriptRunnerHost_h namespace WebCore { class AtomicString; class CachedResource; +class Element; +class HTMLInputStream; class ScriptSourceCode; -class HTML5ScriptRunnerHost { +class HTMLScriptRunnerHost { public: - virtual ~HTML5ScriptRunnerHost() { } + virtual ~HTMLScriptRunnerHost() { } - // Implementors should call cachedResource->addClient() here or soon after. + // Implementors must call cachedResource->addClient() immediately. virtual void watchForLoad(CachedResource*) = 0; // Implementors must call cachedResource->removeClient() immediately. virtual void stopWatchingForLoad(CachedResource*) = 0; // Implementors can block certain script loads (for XSSAuditor, etc.) virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&) = 0; - // Implementors should handle possible rentry before/after calling ScriptController::executeScript - virtual void executeScript(const ScriptSourceCode&) = 0; + virtual HTMLInputStream& inputStream() = 0; }; } diff --git a/WebCore/html/HTMLSelectElement.cpp b/WebCore/html/HTMLSelectElement.cpp index 4c124e0..2dcac59 100644 --- a/WebCore/html/HTMLSelectElement.cpp +++ b/WebCore/html/HTMLSelectElement.cpp @@ -55,7 +55,7 @@ HTMLSelectElement::HTMLSelectElement(const QualifiedName& tagName, Document* doc PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { ASSERT(tagName.matches(selectTag)); - return new HTMLSelectElement(tagName, document, form); + return adoptRef(new HTMLSelectElement(tagName, document, form)); } bool HTMLSelectElement::checkDTD(const Node* newChild) @@ -107,7 +107,7 @@ void HTMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, b void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow) { if (!multiple()) - setSelectedIndexByUser(listIndex, true, fireOnChangeNow); + setSelectedIndexByUser(listToOptionIndex(listIndex), true, fireOnChangeNow); else { updateSelectedState(m_data, this, listIndex, allowMultiplySelections, shift); if (fireOnChangeNow) diff --git a/WebCore/html/HTMLSourceElement.cpp b/WebCore/html/HTMLSourceElement.cpp index 8378bc8..f6ffd9f 100644 --- a/WebCore/html/HTMLSourceElement.cpp +++ b/WebCore/html/HTMLSourceElement.cpp @@ -49,7 +49,7 @@ inline HTMLSourceElement::HTMLSourceElement(const QualifiedName& tagName, Docume PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLSourceElement(tagName, document); + return adoptRef(new HTMLSourceElement(tagName, document)); } void HTMLSourceElement::insertedIntoDocument() diff --git a/WebCore/html/HTMLStyleElement.cpp b/WebCore/html/HTMLStyleElement.cpp index b67bfa3..a8ea42e 100644 --- a/WebCore/html/HTMLStyleElement.cpp +++ b/WebCore/html/HTMLStyleElement.cpp @@ -42,7 +42,7 @@ inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) { - return new HTMLStyleElement(tagName, document, createdByParser); + return adoptRef(new HTMLStyleElement(tagName, document, createdByParser)); } // other stuff... diff --git a/WebCore/html/HTMLStyleElement.idl b/WebCore/html/HTMLStyleElement.idl index 562d01b..c98629c 100644 --- a/WebCore/html/HTMLStyleElement.idl +++ b/WebCore/html/HTMLStyleElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,9 +21,9 @@ module html { interface HTMLStyleElement : HTMLElement { - attribute boolean disabled; - attribute [ConvertNullToNullString] DOMString media; - attribute [ConvertNullToNullString] DOMString type; + attribute boolean disabled; + attribute [Reflect] DOMString media; + attribute [Reflect] DOMString type; // DOM Level 2 Style readonly attribute StyleSheet sheet; diff --git a/WebCore/html/HTMLTableCaptionElement.cpp b/WebCore/html/HTMLTableCaptionElement.cpp index 3713ca1..40f2ab6 100644 --- a/WebCore/html/HTMLTableCaptionElement.cpp +++ b/WebCore/html/HTMLTableCaptionElement.cpp @@ -41,7 +41,7 @@ inline HTMLTableCaptionElement::HTMLTableCaptionElement(const QualifiedName& tag PassRefPtr<HTMLTableCaptionElement> HTMLTableCaptionElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTableCaptionElement(tagName, document); + return adoptRef(new HTMLTableCaptionElement(tagName, document)); } bool HTMLTableCaptionElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLTableCaptionElement.idl b/WebCore/html/HTMLTableCaptionElement.idl index 86a197f..c56c456 100644 --- a/WebCore/html/HTMLTableCaptionElement.idl +++ b/WebCore/html/HTMLTableCaptionElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -23,9 +23,7 @@ module html { interface [ GenerateNativeConverter ] HTMLTableCaptionElement : HTMLElement { - - attribute [ConvertNullToNullString] DOMString align; - + attribute [Reflect] DOMString align; }; } diff --git a/WebCore/html/HTMLTableCellElement.cpp b/WebCore/html/HTMLTableCellElement.cpp index e4871f0..3fa8946 100644 --- a/WebCore/html/HTMLTableCellElement.cpp +++ b/WebCore/html/HTMLTableCellElement.cpp @@ -58,7 +58,7 @@ inline HTMLTableCellElement::HTMLTableCellElement(const QualifiedName& tagName, PassRefPtr<HTMLTableCellElement> HTMLTableCellElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTableCellElement(tagName, document); + return adoptRef(new HTMLTableCellElement(tagName, document)); } int HTMLTableCellElement::cellIndex() const @@ -99,21 +99,22 @@ void HTMLTableCellElement::parseMappedAttribute(Attribute* attr) if (renderer() && renderer()->isTableCell()) toRenderTableCell(renderer())->updateFromElement(); } else if (attr->name() == nowrapAttr) { +<<<<<<< HEAD #ifdef ANDROID_LAYOUT if (!(document()->frame()) || document()->frame()->settings()->layoutAlgorithm() != Settings::kLayoutSSR) #endif // FIXME: What about removing the property when the attribute becomes null? +======= +>>>>>>> webkit.org at r61871 if (!attr->isNull()) addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueWebkitNowrap); } else if (attr->name() == widthAttr) { - // FIXME: What about removing the property when the attribute becomes empty, zero or negative? if (!attr->value().isEmpty()) { int widthInt = attr->value().toInt(); if (widthInt > 0) // width="0" is ignored for compatibility with WinIE. addCSSLength(attr, CSSPropertyWidth, attr->value()); } } else if (attr->name() == heightAttr) { - // FIXME: What about removing the property when the attribute becomes empty, zero or negative? if (!attr->value().isEmpty()) { int heightInt = attr->value().toInt(); if (heightInt > 0) // height="0" is ignored for compatibility with WinIE. diff --git a/WebCore/html/HTMLTableCellElement.idl b/WebCore/html/HTMLTableCellElement.idl index a89149f..037581f 100644 --- a/WebCore/html/HTMLTableCellElement.idl +++ b/WebCore/html/HTMLTableCellElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,23 +21,21 @@ module html { interface HTMLTableCellElement : HTMLElement { - - readonly attribute long cellIndex; - attribute [ConvertNullToNullString] DOMString abbr; - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString axis; - attribute [ConvertNullToNullString] DOMString bgColor; - attribute [ConvertNullToNullString] DOMString ch; - attribute [ConvertNullToNullString] DOMString chOff; - attribute long colSpan; - attribute [ConvertNullToNullString] DOMString headers; - attribute [ConvertNullToNullString] DOMString height; - attribute boolean noWrap; - attribute long rowSpan; - attribute [ConvertNullToNullString] DOMString scope; - attribute [ConvertNullToNullString] DOMString vAlign; - attribute [ConvertNullToNullString] DOMString width; - + readonly attribute long cellIndex; + attribute [Reflect] DOMString abbr; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString axis; + attribute [Reflect] DOMString bgColor; + attribute [Reflect=char] DOMString ch; + attribute [Reflect=charoff] DOMString chOff; + attribute long colSpan; + attribute [Reflect] DOMString headers; + attribute [Reflect] DOMString height; + attribute boolean noWrap; + attribute long rowSpan; + attribute [Reflect] DOMString scope; + attribute [Reflect] DOMString vAlign; + attribute [Reflect] DOMString width; }; } diff --git a/WebCore/html/HTMLTableColElement.cpp b/WebCore/html/HTMLTableColElement.cpp index d21b307..5269aaa 100644 --- a/WebCore/html/HTMLTableColElement.cpp +++ b/WebCore/html/HTMLTableColElement.cpp @@ -44,7 +44,7 @@ inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, Do PassRefPtr<HTMLTableColElement> HTMLTableColElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTableColElement(tagName, document); + return adoptRef(new HTMLTableColElement(tagName, document)); } HTMLTagStatus HTMLTableColElement::endTagRequirement() const diff --git a/WebCore/html/HTMLTableColElement.idl b/WebCore/html/HTMLTableColElement.idl index 453ff3f..a6e6654 100644 --- a/WebCore/html/HTMLTableColElement.idl +++ b/WebCore/html/HTMLTableColElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,14 +21,12 @@ module html { interface HTMLTableColElement : HTMLElement { - - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString ch; - attribute [ConvertNullToNullString] DOMString chOff; - attribute long span; - attribute [ConvertNullToNullString] DOMString vAlign; - attribute [ConvertNullToNullString] DOMString width; - + attribute [Reflect] DOMString align; + attribute [Reflect=char] DOMString ch; + attribute [Reflect=charoff] DOMString chOff; + attribute long span; + attribute [Reflect] DOMString vAlign; + attribute [Reflect] DOMString width; }; } diff --git a/WebCore/html/HTMLTableElement.cpp b/WebCore/html/HTMLTableElement.cpp index 7532b35..0cb33e1 100644 --- a/WebCore/html/HTMLTableElement.cpp +++ b/WebCore/html/HTMLTableElement.cpp @@ -55,12 +55,12 @@ HTMLTableElement::HTMLTableElement(const QualifiedName& tagName, Document* docum PassRefPtr<HTMLTableElement> HTMLTableElement::create(Document* document) { - return new HTMLTableElement(tableTag, document); + return adoptRef(new HTMLTableElement(tableTag, document)); } PassRefPtr<HTMLTableElement> HTMLTableElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTableElement(tagName, document); + return adoptRef(new HTMLTableElement(tagName, document)); } bool HTMLTableElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLTableElement.idl b/WebCore/html/HTMLTableElement.idl index 9cd72b0..fddb27a 100644 --- a/WebCore/html/HTMLTableElement.idl +++ b/WebCore/html/HTMLTableElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,43 +21,33 @@ module html { interface HTMLTableElement : HTMLElement { - - // could raise excepetions on setting. - attribute HTMLTableCaptionElement caption - setter raises(DOMException); - attribute HTMLTableSectionElement tHead - setter raises(DOMException); - attribute HTMLTableSectionElement tFoot - setter raises(DOMException); + attribute HTMLTableCaptionElement caption setter raises(DOMException); + attribute HTMLTableSectionElement tHead setter raises(DOMException); + attribute HTMLTableSectionElement tFoot setter raises(DOMException); readonly attribute HTMLCollection rows; readonly attribute HTMLCollection tBodies; - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString bgColor; - attribute [ConvertNullToNullString] DOMString border; - attribute [ConvertNullToNullString] DOMString cellPadding; - attribute [ConvertNullToNullString] DOMString cellSpacing; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString bgColor; + attribute [Reflect] DOMString border; + attribute [Reflect] DOMString cellPadding; + attribute [Reflect] DOMString cellSpacing; - // FIXME: the obj-c attribute is called frameBorders - attribute [ConvertNullToNullString] DOMString frame; + attribute [Reflect] DOMString frame; - attribute [ConvertNullToNullString] DOMString rules; - attribute [ConvertNullToNullString] DOMString summary; - attribute [ConvertNullToNullString] DOMString width; + attribute [Reflect] DOMString rules; + attribute [Reflect] DOMString summary; + attribute [Reflect] DOMString width; - HTMLElement createTHead(); - void deleteTHead(); + HTMLElement createTHead(); + void deleteTHead(); HTMLElement createTFoot(); - void deleteTFoot(); - HTMLElement createCaption(); - void deleteCaption(); - - HTMLElement insertRow(in long index) - raises(DOMException); - - void deleteRow(in long index) - raises(DOMException); + void deleteTFoot(); + HTMLElement createCaption(); + void deleteCaption(); + HTMLElement insertRow(in long index) raises(DOMException); + void deleteRow(in long index) raises(DOMException); }; } diff --git a/WebCore/html/HTMLTableRowElement.cpp b/WebCore/html/HTMLTableRowElement.cpp index 49f85ce..cba2d48 100644 --- a/WebCore/html/HTMLTableRowElement.cpp +++ b/WebCore/html/HTMLTableRowElement.cpp @@ -46,12 +46,12 @@ HTMLTableRowElement::HTMLTableRowElement(const QualifiedName& tagName, Document* PassRefPtr<HTMLTableRowElement> HTMLTableRowElement::create(Document* document) { - return new HTMLTableRowElement(trTag, document); + return adoptRef(new HTMLTableRowElement(trTag, document)); } PassRefPtr<HTMLTableRowElement> HTMLTableRowElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTableRowElement(tagName, document); + return adoptRef(new HTMLTableRowElement(tagName, document)); } bool HTMLTableRowElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLTableRowElement.idl b/WebCore/html/HTMLTableRowElement.idl index 052b516..4eb348e 100644 --- a/WebCore/html/HTMLTableRowElement.idl +++ b/WebCore/html/HTMLTableRowElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2006, 2007, 2010 Apple Inc. ALl rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,21 +21,16 @@ module html { interface HTMLTableRowElement : HTMLElement { - - readonly attribute long rowIndex; - readonly attribute long sectionRowIndex; - readonly attribute HTMLCollection cells; - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString bgColor; - attribute [ConvertNullToNullString] DOMString ch; - attribute [ConvertNullToNullString] DOMString chOff; - attribute [ConvertNullToNullString] DOMString vAlign; - - HTMLElement insertCell(in long index) - raises(DOMException); - void deleteCell(in long index) - raises(DOMException); - + readonly attribute long rowIndex; + readonly attribute long sectionRowIndex; + readonly attribute HTMLCollection cells; + attribute [Reflect] DOMString align; + attribute [Reflect] DOMString bgColor; + attribute [Reflect=char] DOMString ch; + attribute [Reflect=charoff] DOMString chOff; + attribute [Reflect] DOMString vAlign; + HTMLElement insertCell(in long index) raises(DOMException); + void deleteCell(in long index) raises(DOMException); }; } diff --git a/WebCore/html/HTMLTableSectionElement.cpp b/WebCore/html/HTMLTableSectionElement.cpp index 96a0d9e..122af8a 100644 --- a/WebCore/html/HTMLTableSectionElement.cpp +++ b/WebCore/html/HTMLTableSectionElement.cpp @@ -44,7 +44,7 @@ inline HTMLTableSectionElement::HTMLTableSectionElement(const QualifiedName& tag PassRefPtr<HTMLTableSectionElement> HTMLTableSectionElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTableSectionElement(tagName, document); + return adoptRef(new HTMLTableSectionElement(tagName, document)); } bool HTMLTableSectionElement::checkDTD(const Node* newChild) diff --git a/WebCore/html/HTMLTableSectionElement.idl b/WebCore/html/HTMLTableSectionElement.idl index 57e4293..2065d6e 100644 --- a/WebCore/html/HTMLTableSectionElement.idl +++ b/WebCore/html/HTMLTableSectionElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -23,18 +23,13 @@ module html { interface [ GenerateNativeConverter ] HTMLTableSectionElement : HTMLElement { - - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString ch; - attribute [ConvertNullToNullString] DOMString chOff; - attribute [ConvertNullToNullString] DOMString vAlign; - readonly attribute HTMLCollection rows; - - HTMLElement insertRow(in long index) - raises(DOMException); - void deleteRow(in long index) - raises(DOMException); - + attribute [Reflect] DOMString align; + attribute [Reflect=char] DOMString ch; + attribute [Reflect=charoff] DOMString chOff; + attribute [Reflect] DOMString vAlign; + readonly attribute HTMLCollection rows; + HTMLElement insertRow(in long index) raises(DOMException); + void deleteRow(in long index) raises(DOMException); }; } diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp index dd82aea..47acc54 100644 --- a/WebCore/html/HTMLTextAreaElement.cpp +++ b/WebCore/html/HTMLTextAreaElement.cpp @@ -83,7 +83,7 @@ HTMLTextAreaElement::HTMLTextAreaElement(const QualifiedName& tagName, Document* PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { - return new HTMLTextAreaElement(tagName, document, form); + return adoptRef(new HTMLTextAreaElement(tagName, document, form)); } const AtomicString& HTMLTextAreaElement::formControlType() const diff --git a/WebCore/html/HTMLTextAreaElement.idl b/WebCore/html/HTMLTextAreaElement.idl index a17f2ec..4229450 100644 --- a/WebCore/html/HTMLTextAreaElement.idl +++ b/WebCore/html/HTMLTextAreaElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -21,36 +21,35 @@ module html { interface HTMLTextAreaElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString defaultValue; - readonly attribute HTMLFormElement form; - readonly attribute ValidityState validity; - attribute [ConvertNullToNullString] DOMString accessKey; - attribute long cols; - attribute boolean disabled; - attribute boolean autofocus; - attribute long maxLength - setter raises(DOMException); - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString, Reflect] DOMString placeholder; - attribute boolean readOnly; - attribute boolean required; - attribute long rows; - readonly attribute DOMString type; - attribute [ConvertNullToNullString] DOMString value; - readonly attribute unsigned long textLength; - - void select(); + attribute [ConvertNullToNullString] DOMString defaultValue; + readonly attribute HTMLFormElement form; + readonly attribute ValidityState validity; + attribute [Reflect] DOMString accessKey; + attribute long cols; + attribute boolean disabled; + attribute boolean autofocus; + attribute long maxLength setter raises(DOMException); + attribute [ConvertNullToNullString] DOMString name; + attribute [Reflect] DOMString placeholder; + attribute boolean readOnly; + attribute boolean required; + attribute long rows; + readonly attribute DOMString type; + attribute [ConvertNullToNullString] DOMString value; + readonly attribute unsigned long textLength; - readonly attribute boolean willValidate; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void select(); - // WinIE & FireFox extension: - attribute long selectionStart; - attribute long selectionEnd; + readonly attribute boolean willValidate; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + + // WinIE & FireFox extension: + attribute long selectionStart; + attribute long selectionEnd; void setSelectionRange(in long start, in long end); - readonly attribute NodeList labels; + readonly attribute NodeList labels; }; } diff --git a/WebCore/html/HTMLTitleElement.cpp b/WebCore/html/HTMLTitleElement.cpp index 40c9f8b..776c37c 100644 --- a/WebCore/html/HTMLTitleElement.cpp +++ b/WebCore/html/HTMLTitleElement.cpp @@ -40,7 +40,7 @@ inline HTMLTitleElement::HTMLTitleElement(const QualifiedName& tagName, Document PassRefPtr<HTMLTitleElement> HTMLTitleElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLTitleElement(tagName, document); + return adoptRef(new HTMLTitleElement(tagName, document)); } void HTMLTitleElement::insertedIntoDocument() diff --git a/WebCore/html/HTML5Token.h b/WebCore/html/HTMLToken.h index 6b0fdc8..321b103 100644 --- a/WebCore/html/HTML5Token.h +++ b/WebCore/html/HTMLToken.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTML5Token_h -#define HTML5Token_h +#ifndef HTMLToken_h +#define HTMLToken_h #include "NamedNodeMap.h" #include <wtf/Noncopyable.h> @@ -32,7 +32,7 @@ namespace WebCore { -class HTML5Token : public Noncopyable { +class HTMLToken : public Noncopyable { public: enum Type { Uninitialized, @@ -53,7 +53,7 @@ public: typedef WTF::Vector<Attribute, 10> AttributeList; typedef WTF::Vector<UChar, 1024> DataVector; - HTML5Token() { clear(); } + HTMLToken() { clear(); } void clear() { @@ -160,39 +160,39 @@ public: return m_selfClosing; } - AttributeList& attributes() + const AttributeList& attributes() const { ASSERT(m_type == StartTag || m_type == EndTag); return m_attributes; } - const DataVector& name() + const DataVector& name() const { ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE); return m_data; } - const DataVector& characters() + const DataVector& characters() const { ASSERT(m_type == Character); return m_data; } - const DataVector& comment() + const DataVector& comment() const { ASSERT(m_type == Comment); return m_data; } // FIXME: Distinguish between a missing public identifer and an empty one. - const WTF::Vector<UChar>& publicIdentifier() + const WTF::Vector<UChar>& publicIdentifier() const { ASSERT(m_type == DOCTYPE); return m_doctypeData->m_publicIdentifier; } // FIXME: Distinguish between a missing system identifer and an empty one. - const WTF::Vector<UChar>& systemIdentifier() + const WTF::Vector<UChar>& systemIdentifier() const { ASSERT(m_type == DOCTYPE); return m_doctypeData->m_systemIdentifier; @@ -212,7 +212,7 @@ public: m_doctypeData->m_systemIdentifier.clear(); } - bool forceQuirks() + bool forceQuirks() const { ASSERT(m_type == DOCTYPE); return m_doctypeData->m_forceQuirks; @@ -239,6 +239,11 @@ public: } private: + // FIXME: I'm not sure what the final relationship between HTMLToken and + // AtomicHTMLToken will be. I'm marking this a friend for now, but we'll + // want to end up with a cleaner interface between the two classes. + friend class AtomicHTMLToken; + class DoctypeData { public: DoctypeData() @@ -273,6 +278,127 @@ private: Attribute* m_currentAttribute; }; +// FIXME: This class should eventually be named HTMLToken once we move the +// exiting HTMLToken to be internal to the HTMLTokenizer. +class AtomicHTMLToken : public Noncopyable { +public: + AtomicHTMLToken(HTMLToken& token) + : m_type(token.type()) + { + switch (m_type) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::DOCTYPE: + m_name = AtomicString(token.name().data(), token.name().size()); + m_doctypeData.set(token.m_doctypeData.release()); + break; + case HTMLToken::EndOfFile: + break; + case HTMLToken::StartTag: + case HTMLToken::EndTag: { + m_selfClosing = token.selfClosing(); + m_name = AtomicString(token.name().data(), token.name().size()); + const HTMLToken::AttributeList& attributes = token.attributes(); + for (HTMLToken::AttributeList::const_iterator iter = attributes.begin(); + iter != attributes.end(); ++iter) { + if (!iter->m_name.isEmpty()) { + String name(iter->m_name.data(), iter->m_name.size()); + String value(iter->m_value.data(), iter->m_value.size()); + RefPtr<Attribute> mappedAttribute = Attribute::createMapped(name, value); + if (!m_attributes) + m_attributes = NamedNodeMap::create(); + m_attributes->insertAttribute(mappedAttribute.release(), false); + } + } + break; + } + case HTMLToken::Comment: + m_data = String(token.comment().data(), token.comment().size()); + break; + case HTMLToken::Character: + m_data = String(token.characters().data(), token.characters().size()); + break; + } + } + + AtomicHTMLToken(HTMLToken::Type type, AtomicString name) + : m_type(type) + , m_name(name) + { + } + + HTMLToken::Type type() const { return m_type; } + + const AtomicString& name() const + { + ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag || m_type == HTMLToken::DOCTYPE); + return m_name; + } + + bool selfClosing() const + { + ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag); + return m_selfClosing; + } + + NamedNodeMap* attributes() const + { + ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag); + return m_attributes.get(); + } + + const String& characters() const + { + ASSERT(m_type == HTMLToken::Character); + return m_data; + } + + const String& comment() const + { + ASSERT(m_type == HTMLToken::Comment); + return m_data; + } + + // FIXME: Distinguish between a missing public identifer and an empty one. + const WTF::Vector<UChar>& publicIdentifier() const + { + ASSERT(m_type == HTMLToken::DOCTYPE); + return m_doctypeData->m_publicIdentifier; + } + + // FIXME: Distinguish between a missing system identifer and an empty one. + const WTF::Vector<UChar>& systemIdentifier() const + { + ASSERT(m_type == HTMLToken::DOCTYPE); + return m_doctypeData->m_systemIdentifier; + } + + bool forceQuirks() const + { + ASSERT(m_type == HTMLToken::DOCTYPE); + return m_doctypeData->m_forceQuirks; + } + +private: + HTMLToken::Type m_type; + + // "name" for DOCTYPE, StartTag, and EndTag + AtomicString m_name; + + // "characters" for Character + // "data" for Comment + String m_data; + + // For DOCTYPE + OwnPtr<HTMLToken::DoctypeData> m_doctypeData; + + // For StartTag and EndTag + bool m_selfClosing; + + RefPtr<NamedNodeMap> m_attributes; +}; + } #endif diff --git a/WebCore/html/HTML5Lexer.cpp b/WebCore/html/HTMLTokenizer.cpp index 0cc4ed1..84894ff 100644 --- a/WebCore/html/HTML5Lexer.cpp +++ b/WebCore/html/HTMLTokenizer.cpp @@ -26,11 +26,11 @@ */ #include "config.h" -#include "HTML5Lexer.h" +#include "HTMLTokenizer.h" #include "AtomicString.h" -#include "HTML5EntityParser.h" -#include "HTML5Token.h" +#include "HTMLEntityParser.h" +#include "HTMLToken.h" #include "HTMLNames.h" #include "NotImplemented.h" #include <wtf/CurrentTime.h> @@ -69,30 +69,35 @@ inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& st return !memcmp(stringData, vectorData, vector.size() * sizeof(UChar)); } -inline bool isEndTagBufferingState(HTML5Lexer::State state) +inline bool isEndTagBufferingState(HTMLTokenizer::State state) { - return state == HTML5Lexer::RCDATAEndTagOpenState - || state == HTML5Lexer::RCDATAEndTagNameState - || state == HTML5Lexer::RAWTEXTEndTagOpenState - || state == HTML5Lexer::RAWTEXTEndTagNameState - || state == HTML5Lexer::ScriptDataEndTagOpenState - || state == HTML5Lexer::ScriptDataEndTagNameState - || state == HTML5Lexer::ScriptDataEscapedEndTagOpenState - || state == HTML5Lexer::ScriptDataEscapedEndTagNameState; + switch (state) { + case HTMLTokenizer::RCDATAEndTagOpenState: + case HTMLTokenizer::RCDATAEndTagNameState: + case HTMLTokenizer::RAWTEXTEndTagOpenState: + case HTMLTokenizer::RAWTEXTEndTagNameState: + case HTMLTokenizer::ScriptDataEndTagOpenState: + case HTMLTokenizer::ScriptDataEndTagNameState: + case HTMLTokenizer::ScriptDataEscapedEndTagOpenState: + case HTMLTokenizer::ScriptDataEscapedEndTagNameState: + return true; + default: + return false; + } } } -HTML5Lexer::HTML5Lexer() +HTMLTokenizer::HTMLTokenizer() { reset(); } -HTML5Lexer::~HTML5Lexer() +HTMLTokenizer::~HTMLTokenizer() { } -void HTML5Lexer::reset() +void HTMLTokenizer::reset() { m_state = DataState; m_token = 0; @@ -101,10 +106,10 @@ void HTML5Lexer::reset() m_additionalAllowedCharacter = '\0'; } -inline bool HTML5Lexer::processEntity(SegmentedString& source) +inline bool HTMLTokenizer::processEntity(SegmentedString& source) { bool notEnoughCharacters = false; - unsigned value = consumeHTML5Entity(source, notEnoughCharacters); + unsigned value = consumeHTMLEntity(source, notEnoughCharacters); if (notEnoughCharacters) return false; if (!value) @@ -149,7 +154,7 @@ inline bool HTML5Lexer::processEntity(SegmentedString& source) #define SWITCH_TO(stateName) \ do { \ m_state = stateName; \ - if (!m_inputStreamPreprocessor.peek(source, m_lineNumber)) \ + if (source.isEmpty() || !m_inputStreamPreprocessor.peek(source, m_lineNumber)) \ return shouldEmitBufferedCharacterToken(source); \ cc = m_inputStreamPreprocessor.nextInputCharacter(); \ goto stateName; \ @@ -169,10 +174,10 @@ inline bool HTML5Lexer::processEntity(SegmentedString& source) #define _FLUSH_BUFFERED_END_TAG() \ do { \ - ASSERT(m_token->type() == HTML5Token::Character || \ - m_token->type() == HTML5Token::Uninitialized); \ + ASSERT(m_token->type() == HTMLToken::Character || \ + m_token->type() == HTMLToken::Uninitialized); \ source.advance(m_lineNumber); \ - if (m_token->type() == HTML5Token::Character) \ + if (m_token->type() == HTMLToken::Character) \ return true; \ m_token->beginEndTag(m_bufferedEndTagName); \ m_bufferedEndTagName.clear(); \ @@ -196,11 +201,11 @@ inline bool HTML5Lexer::processEntity(SegmentedString& source) return true; \ } while (false) -bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) +bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) { // If we have a token in progress, then we're supposed to be called back // with the same token so we can finish it. - ASSERT(!m_token || m_token == &token || token.type() == HTML5Token::Uninitialized); + ASSERT(!m_token || m_token == &token || token.type() == HTMLToken::Uninitialized); m_token = &token; if (!m_bufferedEndTagName.isEmpty() && !isEndTagBufferingState(m_state)) { @@ -241,7 +246,7 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) if (cc == '&') ADVANCE_TO(CharacterReferenceInDataState); else if (cc == '<') { - if (m_token->type() == HTML5Token::Character) { + if (m_token->type() == HTMLToken::Character) { // We have a bunch of character tokens queued up that we // are emitting lazily here. return true; @@ -913,7 +918,7 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) BEGIN_STATE(CharacterReferenceInAttributeValueState) { bool notEnoughCharacters = false; - unsigned value = consumeHTML5Entity(source, notEnoughCharacters, m_additionalAllowedCharacter); + unsigned value = consumeHTMLEntity(source, notEnoughCharacters, m_additionalAllowedCharacter); if (notEnoughCharacters) return shouldEmitBufferedCharacterToken(source); if (!value) @@ -1288,11 +1293,11 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) EMIT_AND_RESUME_IN(DataState); else if (cc == '"') { emitParseError(); - m_token->setPublicIdentifierToEmptyString(); + m_token->setSystemIdentifierToEmptyString(); ADVANCE_TO(DOCTYPESystemIdentifierDoubleQuotedState); } else if (cc == '\'') { emitParseError(); - m_token->setPublicIdentifierToEmptyString(); + m_token->setSystemIdentifierToEmptyString(); ADVANCE_TO(DOCTYPESystemIdentifierSingleQuotedState); } else { emitParseError(); @@ -1432,32 +1437,32 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token) return false; } -inline bool HTML5Lexer::temporaryBufferIs(const String& expectedString) +inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) { return vectorEqualsString(m_temporaryBuffer, expectedString); } -inline void HTML5Lexer::addToPossibleEndTag(UChar cc) +inline void HTMLTokenizer::addToPossibleEndTag(UChar cc) { ASSERT(isEndTagBufferingState(m_state)); m_bufferedEndTagName.append(cc); } -inline bool HTML5Lexer::isAppropriateEndTag() +inline bool HTMLTokenizer::isAppropriateEndTag() { return m_bufferedEndTagName == m_appropriateEndTagName; } -inline void HTML5Lexer::emitCharacter(UChar character) +inline void HTMLTokenizer::emitCharacter(UChar character) { - if (m_token->type() != HTML5Token::Character) { + if (m_token->type() != HTMLToken::Character) { m_token->beginCharacter(character); return; } m_token->appendToCharacter(character); } -inline void HTML5Lexer::emitCodePoint(unsigned value) +inline void HTMLTokenizer::emitCodePoint(unsigned value) { if (value < 0xFFFF) { emitCharacter(value); @@ -1467,21 +1472,21 @@ inline void HTML5Lexer::emitCodePoint(unsigned value) emitCharacter(U16_TRAIL(value)); } -inline void HTML5Lexer::emitParseError() +inline void HTMLTokenizer::emitParseError() { notImplemented(); } -inline void HTML5Lexer::emitCurrentToken() +inline void HTMLTokenizer::emitCurrentToken() { - ASSERT(m_token->type() != HTML5Token::Uninitialized); - if (m_token->type() == HTML5Token::StartTag) + ASSERT(m_token->type() != HTMLToken::Uninitialized); + if (m_token->type() == HTMLToken::StartTag) m_appropriateEndTagName = m_token->name(); } -inline bool HTML5Lexer::shouldEmitBufferedCharacterToken(const SegmentedString& source) +inline bool HTMLTokenizer::shouldEmitBufferedCharacterToken(const SegmentedString& source) { - return source.isClosed() && m_token->type() == HTML5Token::Character; + return source.isClosed() && m_token->type() == HTMLToken::Character; } } diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h new file mode 100644 index 0000000..c2e52ab --- /dev/null +++ b/WebCore/html/HTMLTokenizer.h @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 HTMLTokenizer_h +#define HTMLTokenizer_h + +#include "AtomicString.h" +#include "SegmentedString.h" +#include <wtf/Noncopyable.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class HTMLToken; + +class HTMLTokenizer : public Noncopyable { +public: + enum State { + DataState, + CharacterReferenceInDataState, + RCDATAState, + CharacterReferenceInRCDATAState, + RAWTEXTState, + ScriptDataState, + PLAINTEXTState, + TagOpenState, + EndTagOpenState, + TagNameState, + RCDATALessThanSignState, + RCDATAEndTagOpenState, + RCDATAEndTagNameState, + RAWTEXTLessThanSignState, + RAWTEXTEndTagOpenState, + RAWTEXTEndTagNameState, + ScriptDataLessThanSignState, + ScriptDataEndTagOpenState, + ScriptDataEndTagNameState, + ScriptDataEscapeStartState, + ScriptDataEscapeStartDashState, + ScriptDataEscapedState, + ScriptDataEscapedDashState, + ScriptDataEscapedDashDashState, + ScriptDataEscapedLessThanSignState, + ScriptDataEscapedEndTagOpenState, + ScriptDataEscapedEndTagNameState, + ScriptDataDoubleEscapeStartState, + ScriptDataDoubleEscapedState, + ScriptDataDoubleEscapedDashState, + ScriptDataDoubleEscapedDashDashState, + ScriptDataDoubleEscapedLessThanSignState, + ScriptDataDoubleEscapeEndState, + BeforeAttributeNameState, + AttributeNameState, + AfterAttributeNameState, + BeforeAttributeValueState, + AttributeValueDoubleQuotedState, + AttributeValueSingleQuotedState, + AttributeValueUnquotedState, + CharacterReferenceInAttributeValueState, + AfterAttributeValueQuotedState, + SelfClosingStartTagState, + BogusCommentState, + MarkupDeclarationOpenState, + CommentStartState, + CommentStartDashState, + CommentState, + CommentEndDashState, + CommentEndState, + CommentEndBangState, + CommentEndSpaceState, + DOCTYPEState, + BeforeDOCTYPENameState, + DOCTYPENameState, + AfterDOCTYPENameState, + AfterDOCTYPEPublicKeywordState, + BeforeDOCTYPEPublicIdentifierState, + DOCTYPEPublicIdentifierDoubleQuotedState, + DOCTYPEPublicIdentifierSingleQuotedState, + AfterDOCTYPEPublicIdentifierState, + BetweenDOCTYPEPublicAndSystemIdentifiersState, + AfterDOCTYPESystemKeywordState, + BeforeDOCTYPESystemIdentifierState, + DOCTYPESystemIdentifierDoubleQuotedState, + DOCTYPESystemIdentifierSingleQuotedState, + AfterDOCTYPESystemIdentifierState, + BogusDOCTYPEState, + CDATASectionState, + }; + + HTMLTokenizer(); + ~HTMLTokenizer(); + + void reset(); + + // This function returns true if it emits a token. Otherwise, callers + // must provide the same (in progress) token on the next call (unless + // they call reset() first). + bool nextToken(SegmentedString&, HTMLToken&); + + int lineNumber() const { return m_lineNumber; } + int columnNumber() const { return 1; } // Matches LegacyHTMLDocumentParser.h behavior. + + State state() const { return m_state; } + void setState(State state) { m_state = state; } + + // Hack to skip leading newline in <pre>/<listing> for authoring ease. + // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-inbody + void skipLeadingNewLineForListing() { m_skipLeadingNewLineForListing = true; } + +private: + // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream + class InputStreamPreprocessor : public Noncopyable { + public: + InputStreamPreprocessor() + : m_nextInputCharacter('\0') + , m_skipNextNewLine(false) + { + } + + UChar nextInputCharacter() const { return m_nextInputCharacter; } + + // Returns whether we succeeded in peeking at the next character. + // The only way we can fail to peek is if there are no more + // characters in |source| (after collapsing \r\n, etc). + bool peek(SegmentedString& source, int& lineNumber) + { + m_nextInputCharacter = *source; + if (m_nextInputCharacter == '\n' && m_skipNextNewLine) { + m_skipNextNewLine = false; + source.advancePastNewline(lineNumber); + if (source.isEmpty()) + return false; + m_nextInputCharacter = *source; + } + if (m_nextInputCharacter == '\r') { + m_nextInputCharacter = '\n'; + m_skipNextNewLine = true; + } else { + m_skipNextNewLine = false; + // FIXME: The spec indicates that the surrogate pair range as well as + // a number of specific character values are parse errors and should be replaced + // by the replacement character. We suspect this is a problem with the spec as doing + // that filtering breaks surrogate pair handling and causes us not to match Minefield. + if (m_nextInputCharacter == '\0') + m_nextInputCharacter = 0xFFFD; + } + return true; + } + + // Returns whether there are more characters in |source| after advancing. + bool advance(SegmentedString& source, int& lineNumber) + { + source.advance(lineNumber); + if (source.isEmpty()) + return false; + return peek(source, lineNumber); + } + + private: + // http://www.whatwg.org/specs/web-apps/current-work/#next-input-character + UChar m_nextInputCharacter; + bool m_skipNextNewLine; + }; + + inline void emitCharacter(UChar); + inline void emitParseError(); + inline void emitCurrentToken(); + inline void emitCodePoint(unsigned); + + inline bool processEntity(SegmentedString& source); + + inline bool temporaryBufferIs(const String&); + + // Sometimes we speculatively consume input characters and we don't + // know whether they represent end tags or RCDATA, etc. These + // functions help manage these state. + inline void addToPossibleEndTag(UChar cc); + inline bool isAppropriateEndTag(); + + inline bool shouldEmitBufferedCharacterToken(const SegmentedString&); + + State m_state; + + Vector<UChar, 32> m_appropriateEndTagName; + + // m_token is owned by the caller. If nextToken is not on the stack, + // this member might be pointing to unallocated memory. + HTMLToken* m_token; + int m_lineNumber; + + bool m_skipLeadingNewLineForListing; + + // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer + Vector<UChar, 32> m_temporaryBuffer; + + // We occationally want to emit both a character token and an end tag + // token (e.g., when lexing script). We buffer the name of the end tag + // token here so we remember it next time we re-enter the tokenizer. + Vector<UChar, 32> m_bufferedEndTagName; + + // http://www.whatwg.org/specs/web-apps/current-work/#additional-allowed-character + UChar m_additionalAllowedCharacter; + + // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream + InputStreamPreprocessor m_inputStreamPreprocessor; +}; + +} + +#endif diff --git a/WebCore/html/HTMLTreeBuilder.cpp b/WebCore/html/HTMLTreeBuilder.cpp new file mode 100644 index 0000000..6e40fd7 --- /dev/null +++ b/WebCore/html/HTMLTreeBuilder.cpp @@ -0,0 +1,593 @@ +/* + * Copyright (C) 2010 Google, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTMLTreeBuilder.h" + +#include "DocumentFragment.h" +#include "Element.h" +#include "Frame.h" +#include "HTMLTokenizer.h" +#include "HTMLToken.h" +#include "HTMLDocument.h" +#include "LegacyHTMLDocumentParser.h" +#include "HTMLNames.h" +#include "LegacyHTMLTreeBuilder.h" +#include "NotImplemented.h" +#include "ScriptController.h" +#include <wtf/UnusedParam.h> + +namespace WebCore { + +using namespace HTMLNames; + +static const int uninitializedLineNumberValue = -1; + +namespace { + +inline bool isTreeBuilderWhiteSpace(UChar cc) +{ + return cc == '\t' || cc == '\x0A' || cc == '\x0C' || cc == '\x0D' || cc == ' '; +} + +} // namespace + +HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors) + : m_framesetOk(true) + , m_document(document) + , m_reportErrors(reportErrors) + , m_isPaused(false) + , m_insertionMode(InitialMode) + , m_tokenizer(tokenizer) + , m_legacyTreeBuilder(new LegacyHTMLTreeBuilder(document, reportErrors)) + , m_lastScriptElementStartLine(uninitializedLineNumberValue) + , m_scriptToProcessStartLine(uninitializedLineNumberValue) + , m_fragmentScriptingPermission(FragmentScriptingAllowed) +{ +} + +// FIXME: Member variables should be grouped into self-initializing structs to +// minimize code duplication between these constructors. +HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) + : m_framesetOk(true) + , m_document(fragment->document()) + , m_reportErrors(false) // FIXME: Why not report errors in fragments? + , m_isPaused(false) + , m_insertionMode(InitialMode) + , m_tokenizer(tokenizer) + , m_legacyTreeBuilder(new LegacyHTMLTreeBuilder(fragment, scriptingPermission)) + , m_lastScriptElementStartLine(uninitializedLineNumberValue) + , m_scriptToProcessStartLine(uninitializedLineNumberValue) + , m_fragmentScriptingPermission(scriptingPermission) +{ +} + +HTMLTreeBuilder::~HTMLTreeBuilder() +{ +} + +static void convertToOldStyle(const AtomicHTMLToken& token, Token& oldStyleToken) +{ + switch (token.type()) { + case HTMLToken::Uninitialized: + case HTMLToken::DOCTYPE: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::EndOfFile: + ASSERT_NOT_REACHED(); + notImplemented(); + break; + case HTMLToken::StartTag: + case HTMLToken::EndTag: { + oldStyleToken.beginTag = (token.type() == HTMLToken::StartTag); + oldStyleToken.selfClosingTag = token.selfClosing(); + oldStyleToken.tagName = token.name(); + oldStyleToken.attrs = token.attributes(); + break; + } + case HTMLToken::Comment: + oldStyleToken.tagName = commentAtom; + oldStyleToken.text = token.comment().impl(); + break; + case HTMLToken::Character: + oldStyleToken.tagName = textAtom; + oldStyleToken.text = token.characters().impl(); + break; + } +} + +void HTMLTreeBuilder::handleScriptStartTag() +{ + notImplemented(); // The HTML frgment case? + m_tokenizer->setState(HTMLTokenizer::ScriptDataState); + notImplemented(); // Save insertion mode. +} + +void HTMLTreeBuilder::handleScriptEndTag(Element* scriptElement, int scriptStartLine) +{ + ASSERT(!m_scriptToProcess); // Caller never called takeScriptToProcess! + ASSERT(m_scriptToProcessStartLine == uninitializedLineNumberValue); // Caller never called takeScriptToProcess! + notImplemented(); // Save insertion mode and insertion point? + + // Pause ourselves so that parsing stops until the script can be processed by the caller. + m_isPaused = true; + m_scriptToProcess = scriptElement; + // Lexer line numbers are 0-based, ScriptSourceCode expects 1-based lines, + // so we convert here before passing the line number off to HTMLScriptRunner. + m_scriptToProcessStartLine = scriptStartLine + 1; +} + +PassRefPtr<Element> HTMLTreeBuilder::takeScriptToProcess(int& scriptStartLine) +{ + // Unpause ourselves, callers may pause us again when processing the script. + // The HTML5 spec is written as though scripts are executed inside the tree + // builder. We pause the parser to exit the tree builder, and then resume + // before running scripts. + m_isPaused = false; + scriptStartLine = m_scriptToProcessStartLine; + m_scriptToProcessStartLine = uninitializedLineNumberValue; + return m_scriptToProcess.release(); +} + +HTMLTokenizer::State HTMLTreeBuilder::adjustedLexerState(HTMLTokenizer::State state, const AtomicString& tagName, Frame* frame) +{ + if (tagName == textareaTag || tagName == titleTag) + return HTMLTokenizer::RCDATAState; + + if (tagName == styleTag || tagName == iframeTag || tagName == xmpTag || tagName == noembedTag + || tagName == noframesTag || (tagName == noscriptTag && isScriptingFlagEnabled(frame))) + return HTMLTokenizer::RAWTEXTState; + + if (tagName == plaintextTag) + return HTMLTokenizer::PLAINTEXTState; + + return state; +} + +PassRefPtr<Node> HTMLTreeBuilder::passTokenToLegacyParser(HTMLToken& token) +{ + if (token.type() == HTMLToken::DOCTYPE) { + DoctypeToken doctypeToken; + doctypeToken.m_name.append(token.name().data(), token.name().size()); + doctypeToken.m_publicID = token.publicIdentifier(); + doctypeToken.m_systemID = token.systemIdentifier(); + doctypeToken.m_forceQuirks = token.forceQuirks(); + + m_legacyTreeBuilder->parseDoctypeToken(&doctypeToken); + return 0; + } + + // For now, we translate into an old-style token for testing. + Token oldStyleToken; + AtomicHTMLToken atomicToken(token); + convertToOldStyle(atomicToken, oldStyleToken); + + RefPtr<Node> result = m_legacyTreeBuilder->parseToken(&oldStyleToken); + if (token.type() == HTMLToken::StartTag) { + // This work is supposed to be done by the parser, but + // when using the old parser for we have to do this manually. + if (oldStyleToken.tagName == scriptTag) { + handleScriptStartTag(); + m_lastScriptElement = static_pointer_cast<Element>(result); + m_lastScriptElementStartLine = m_tokenizer->lineNumber(); + } else if (oldStyleToken.tagName == preTag || oldStyleToken.tagName == listingTag) + m_tokenizer->skipLeadingNewLineForListing(); + else + m_tokenizer->setState(adjustedLexerState(m_tokenizer->state(), oldStyleToken.tagName, m_document->frame())); + } else if (token.type() == HTMLToken::EndTag) { + if (oldStyleToken.tagName == scriptTag) { + if (m_lastScriptElement) { + ASSERT(m_lastScriptElementStartLine != uninitializedLineNumberValue); + if (m_fragmentScriptingPermission == FragmentScriptingNotAllowed) { + // FIXME: This is a horrible hack for platform/Pasteboard. + // Clear the <script> tag when using the Parser to create + // a DocumentFragment for pasting so that javascript content + // does not show up in pasted HTML. + m_lastScriptElement->removeChildren(); + } else if (insertionMode() != AfterFramesetMode) + handleScriptEndTag(m_lastScriptElement.get(), m_lastScriptElementStartLine); + m_lastScriptElement = 0; + m_lastScriptElementStartLine = uninitializedLineNumberValue; + } + } else if (oldStyleToken.tagName == framesetTag) + setInsertionMode(AfterFramesetMode); + } + return result.release(); +} + +PassRefPtr<Node> HTMLTreeBuilder::constructTreeFromToken(HTMLToken& rawToken) +{ + // Make MSVC ignore our unreachable code for now. + if (true) + return passTokenToLegacyParser(rawToken); + + AtomicHTMLToken token(rawToken); + + // HTML5 expects the tokenizer to call the parser every time a character is + // emitted. We instead collect characters and call the parser with a batch. + // In order to make our first-pass parser code simple, processToken matches + // the spec in only handling one character at a time. + if (token.type() == HTMLToken::Character) { + StringImpl* characters = token.characters().impl(); + // FIXME: Calling processToken for each character is probably slow. + for (unsigned i = 0; i < characters->length(); ++i) + processToken(token, (*characters)[i]); + return 0; // FIXME: Should we be returning the Text node? + } + return processToken(token); +} + +PassRefPtr<Node> HTMLTreeBuilder::processToken(AtomicHTMLToken& token, UChar cc) +{ +reprocessToken: + switch (insertionMode()) { + case InitialMode: { + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::DOCTYPE: + return insertDoctype(token); + case HTMLToken::Comment: + return insertComment(token); + case HTMLToken::Character: + if (isTreeBuilderWhiteSpace(cc)) + return 0; + break; + case HTMLToken::StartTag: + case HTMLToken::EndTag: + case HTMLToken::EndOfFile: + break; + } + notImplemented(); + parseError(token); + setInsertionMode(BeforeHTMLMode); + goto reprocessToken; + } + case BeforeHTMLMode: { + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::DOCTYPE: + parseError(token); + return 0; + case HTMLToken::Comment: + return insertComment(token); + case HTMLToken::Character: + if (isTreeBuilderWhiteSpace(cc)) + return 0; + break; + case HTMLToken::StartTag: + if (token.name() == htmlTag) { + notImplemented(); + setInsertionMode(BeforeHeadMode); + return 0; + } + break; + case HTMLToken::EndTag: + if (token.name() == headTag || token.name() == bodyTag || token.name() == htmlTag || token.name() == brTag) + break; + parseError(token); + return 0; + case HTMLToken::EndOfFile: + break; + } + notImplemented(); + setInsertionMode(BeforeHeadMode); + goto reprocessToken; + } + case BeforeHeadMode: { + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::Character: + if (isTreeBuilderWhiteSpace(cc)) + return 0; + break; + case HTMLToken::Comment: + return insertComment(token); + case HTMLToken::DOCTYPE: + parseError(token); + return 0; + case HTMLToken::StartTag: + if (token.name() == htmlTag) { + notImplemented(); + return 0; + } + if (token.name() == headTag) { + m_headElement = insertElement(token); + setInsertionMode(InHeadMode); + return m_headElement; + } + break; + case HTMLToken::EndTag: + if (token.name() == headTag || token.name() == bodyTag || token.name() == brTag) { + AtomicHTMLToken fakeHead(HTMLToken::StartTag, headTag.localName()); + processToken(fakeHead); + goto reprocessToken; + } + parseError(token); + return 0; + case HTMLToken::EndOfFile: + break; + } + AtomicHTMLToken fakeHead(HTMLToken::StartTag, headTag.localName()); + processToken(fakeHead); + goto reprocessToken; + } + case InHeadMode: { + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::Character: + insertCharacter(cc); + break; + case HTMLToken::Comment: + return insertComment(token); + case HTMLToken::DOCTYPE: + parseError(token); + return 0; + case HTMLToken::StartTag: + if (token.name() == htmlTag) { + notImplemented(); + return 0; + } + // FIXME: Atomize "command". + if (token.name() == baseTag || token.name() == "command" || token.name() == linkTag) { + PassRefPtr<Node> node = insertElement(token); + m_openElements.pop(); + notImplemented(); + return node; + } + if (token.name() == metaTag) { + PassRefPtr<Node> node = insertElement(token); + m_openElements.pop(); + notImplemented(); + return node; + } + if (token.name() == titleTag) + return insertGenericRCDATAElement(token); + if (token.name() == noscriptTag) { + if (isScriptingFlagEnabled(m_document->frame())) + return insertGenericRawTextElement(token); + PassRefPtr<Node> node = insertElement(token); + setInsertionMode(InHeadNoscriptMode); + return node; + } + if (token.name() == noframesTag || token.name() == styleTag) + return insertGenericRawTextElement(token); + if (token.name() == scriptTag) + return insertScriptElement(token); + if (token.name() == headTag) { + notImplemented(); + return 0; + } + break; + case HTMLToken::EndTag: + if (token.name() == headTag) { + ASSERT(m_openElements.top()->tagQName() == headTag); + m_openElements.pop(); + setInsertionMode(AfterHeadMode); + return 0; + } + if (token.name() == bodyTag || token.name() == htmlTag || token.name() == brTag) + break; + parseError(token); + return 0; + break; + case HTMLToken::EndOfFile: + break; + } + AtomicHTMLToken fakeHead(HTMLToken::EndTag, headTag.localName()); + processToken(fakeHead); + goto reprocessToken; + } + case InHeadNoscriptMode: { + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::DOCTYPE: + parseError(token); + return 0; + case HTMLToken::StartTag: + if (token.name() == htmlTag) { + notImplemented(); + return 0; + } + if (token.name() == linkTag || token.name() == metaTag || token.name() == noframesTag || token.name() == styleTag) { + notImplemented(); + return 0; + } + if (token.name() == htmlTag || token.name() == noscriptTag) { + parseError(token); + return 0; + } + break; + case HTMLToken::EndTag: + if (token.name() == noscriptTag) { + ASSERT(m_openElements.top()->tagQName() == noscriptTag); + m_openElements.pop(); + ASSERT(m_openElements.top()->tagQName() == headTag); + setInsertionMode(InHeadMode); + return 0; + } + if (token.name() == brTag) + break; + parseError(token); + return 0; + case HTMLToken::Character: + notImplemented(); + break; + case HTMLToken::Comment: + notImplemented(); + return 0; + case HTMLToken::EndOfFile: + break; + } + AtomicHTMLToken fakeNoscript(HTMLToken::EndTag, noscriptTag.localName()); + processToken(fakeNoscript); + goto reprocessToken; + } + case AfterHeadMode: { + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::Character: + if (isTreeBuilderWhiteSpace(cc)) { + insertCharacter(cc); + return 0; + } + break; + case HTMLToken::Comment: + return insertComment(token); + case HTMLToken::DOCTYPE: + parseError(token); + return 0; + case HTMLToken::StartTag: + if (token.name() == htmlTag) { + notImplemented(); + return 0; + } + if (token.name() == bodyTag) { + m_framesetOk = false; + return insertElement(token); + } + if (token.name() == framesetTag) { + PassRefPtr<Node> node = insertElement(token); + setInsertionMode(InFramesetMode); + return node; + } + if (token.name() == baseTag || token.name() == linkTag || token.name() == metaTag || token.name() == noframesTag || token.name() == scriptTag || token.name() == styleTag || token.name() == titleTag) { + parseError(token); + ASSERT(m_headElement); + m_openElements.push(m_headElement.get()); + notImplemented(); + m_openElements.remove(m_headElement.get()); + } + if (token.name() == headTag) { + parseError(token); + return 0; + } + break; + case HTMLToken::EndTag: + if (token.name() == bodyTag || token.name() == htmlTag || token.name() == brTag) + break; + parseError(token); + return 0; + case HTMLToken::EndOfFile: + break; + } + AtomicHTMLToken fakeBody(HTMLToken::StartTag, bodyTag.localName()); + processToken(fakeBody); + m_framesetOk = true; + goto reprocessToken; + } + case InBodyMode: + case TextMode: + case InTableMode: + case InTableTextMode: + case InCaptionMode: + case InColumnGroupMode: + case InTableBodyMode: + case InRowMode: + case InCellMode: + case InSelectMode: + case InSelectInTableMode: + case InForeignContentMode: + case AfterBodyMode: + case InFramesetMode: + case AfterFramesetMode: + case AfterAfterBodyMode: + case AfterAfterFramesetMode: + ASSERT_NOT_REACHED(); + } + + // Implementation coming in the next patch. + return 0; +} + +PassRefPtr<Node> HTMLTreeBuilder::insertDoctype(AtomicHTMLToken& token) +{ + ASSERT_UNUSED(token, token.type() == HTMLToken::DOCTYPE); + return 0; +} + +PassRefPtr<Node> HTMLTreeBuilder::insertComment(AtomicHTMLToken& token) +{ + ASSERT_UNUSED(token, token.type() == HTMLToken::Comment); + return 0; +} + +PassRefPtr<Element> HTMLTreeBuilder::insertElement(AtomicHTMLToken& token) +{ + ASSERT_UNUSED(token, token.type() == HTMLToken::StartTag); + return 0; +} + +void HTMLTreeBuilder::insertCharacter(UChar cc) +{ + ASSERT_UNUSED(cc, cc); +} + +PassRefPtr<Node> HTMLTreeBuilder::insertGenericRCDATAElement(AtomicHTMLToken& token) +{ + ASSERT_UNUSED(token, token.type() == HTMLToken::StartTag); + return 0; +} + +PassRefPtr<Node> HTMLTreeBuilder::insertGenericRawTextElement(AtomicHTMLToken& token) +{ + ASSERT_UNUSED(token, token.type() == HTMLToken::StartTag); + return 0; +} + +PassRefPtr<Node> HTMLTreeBuilder::insertScriptElement(AtomicHTMLToken& token) +{ + ASSERT_UNUSED(token, token.type() == HTMLToken::StartTag); + return 0; +} + +void HTMLTreeBuilder::finished() +{ + // We should call m_document->finishedParsing() here, except + // m_legacyTreeBuilder->finished() does it for us. + m_legacyTreeBuilder->finished(); +} + +bool HTMLTreeBuilder::isScriptingFlagEnabled(Frame* frame) +{ + if (!frame) + return false; + if (ScriptController* scriptController = frame->script()) + return scriptController->canExecuteScripts(NotAboutToExecuteScript); + return false; +} + +} diff --git a/WebCore/html/HTML5TreeBuilder.h b/WebCore/html/HTMLTreeBuilder.h index a61bb7f..76360ae 100644 --- a/WebCore/html/HTML5TreeBuilder.h +++ b/WebCore/html/HTMLTreeBuilder.h @@ -23,9 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTML5TreeBuilder_h -#define HTML5TreeBuilder_h +#ifndef HTMLTreeBuilder_h +#define HTMLTreeBuilder_h +#include "FragmentScriptingPermission.h" +#include "HTMLTokenizer.h" #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> @@ -33,65 +35,116 @@ #include <wtf/unicode/Unicode.h> namespace WebCore { + +class AtomicHTMLToken; class Document; +class DocumentFragment; class Element; class Frame; -class HTML5Lexer; -class HTML5Token; +class HTMLToken; class HTMLDocument; -class LegacyHTMLTreeConstructor; +class LegacyHTMLTreeBuilder; class Node; -class HTML5TreeBuilder : public Noncopyable { +class HTMLTreeBuilder : public Noncopyable { public: - HTML5TreeBuilder(HTML5Lexer*, HTMLDocument*, bool reportErrors); - ~HTML5TreeBuilder(); + // FIXME: Replace constructors with create() functions returning PassOwnPtrs + HTMLTreeBuilder(HTMLTokenizer*, HTMLDocument*, bool reportErrors); + HTMLTreeBuilder(HTMLTokenizer*, DocumentFragment*, FragmentScriptingPermission); + ~HTMLTreeBuilder(); void setPaused(bool paused) { m_isPaused = paused; } - bool isPaused() { return m_isPaused; } + bool isPaused() const { return m_isPaused; } // The token really should be passed as a const& since it's never modified. - PassRefPtr<Node> constructTreeFromToken(HTML5Token&); + PassRefPtr<Node> constructTreeFromToken(HTMLToken&); // Must be called when parser is paused before calling the parser again. PassRefPtr<Element> takeScriptToProcess(int& scriptStartLine); // Done, close any open tags, etc. void finished(); + static HTMLTokenizer::State adjustedLexerState(HTMLTokenizer::State, const AtomicString& tagName, Frame*); + // FIXME: This is a dirty, rotten hack to keep HTMLFormControlElement happy // until we stop using the legacy parser. DO NOT CALL THIS METHOD. - LegacyHTMLTreeConstructor* legacyTreeConstructor() const { return m_legacyTreeConstructor.get(); } + LegacyHTMLTreeBuilder* legacyTreeBuilder() const { return m_legacyTreeBuilder.get(); } private: // Represents HTML5 "insertion mode" - // http://www.w3.org/TR/html5/syntax.html#insertion-mode - // FIXME: Implement remainder of states. + // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#insertion-mode enum InsertionMode { - Initial, - AfterFrameset, + InitialMode, + BeforeHTMLMode, + BeforeHeadMode, + InHeadMode, + InHeadNoscriptMode, + AfterHeadMode, + InBodyMode, + TextMode, + InTableMode, + InTableTextMode, + InCaptionMode, + InColumnGroupMode, + InTableBodyMode, + InRowMode, + InCellMode, + InSelectMode, + InSelectInTableMode, + InForeignContentMode, + AfterBodyMode, + InFramesetMode, + AfterFramesetMode, + AfterAfterBodyMode, + AfterAfterFramesetMode, }; - PassRefPtr<Node> passTokenToLegacyParser(HTML5Token&); - PassRefPtr<Node> processToken(HTML5Token&, UChar currentCharacter = 0); - + class ElementStack : public Noncopyable { + public: + void pop() { } + void push(Element*) { } + void remove(Element*) { } + Element* top() const { return 0; } + }; + + PassRefPtr<Node> passTokenToLegacyParser(HTMLToken&); + PassRefPtr<Node> processToken(AtomicHTMLToken&, UChar cc = 0); + + PassRefPtr<Node> insertDoctype(AtomicHTMLToken&); + PassRefPtr<Node> insertComment(AtomicHTMLToken&); + PassRefPtr<Element> insertElement(AtomicHTMLToken&); + void insertCharacter(UChar cc); + PassRefPtr<Node> insertGenericRCDATAElement(AtomicHTMLToken&); + PassRefPtr<Node> insertGenericRawTextElement(AtomicHTMLToken&); + PassRefPtr<Node> insertScriptElement(AtomicHTMLToken&); + + RefPtr<Element> m_headElement; + ElementStack m_openElements; + bool m_framesetOk; + + // FIXME: Implement error reporting. + void parseError(AtomicHTMLToken&) { } + void handleScriptStartTag(); void handleScriptEndTag(Element*, int scriptStartLine); void setInsertionMode(InsertionMode value) { m_insertionMode = value; } InsertionMode insertionMode() const { return m_insertionMode; } + static bool isScriptingFlagEnabled(Frame* frame); + Document* m_document; // This is only used by the m_legacyParser for now. bool m_reportErrors; bool m_isPaused; InsertionMode m_insertionMode; - // HTML5 spec requires that we be able to change the state of the lexer + // HTML5 spec requires that we be able to change the state of the tokenizer // from within parser actions. - HTML5Lexer* m_lexer; + HTMLTokenizer* m_tokenizer; - // We're re-using logic from the old LegacyHTMLTreeConstructor while this class is being written. - OwnPtr<LegacyHTMLTreeConstructor> m_legacyTreeConstructor; + // We're re-using logic from the old LegacyHTMLTreeBuilder while this class is being written. + OwnPtr<LegacyHTMLTreeBuilder> m_legacyTreeBuilder; // These members are intentionally duplicated as the first set is a hack // on top of the legacy parser which will eventually be removed. @@ -100,6 +153,11 @@ private: RefPtr<Element> m_scriptToProcess; // <script> tag which needs processing before resuming the parser. int m_scriptToProcessStartLine; // Starting line number of the script tag needing processing. + + // FIXME: FragmentScriptingPermission is a HACK for platform/Pasteboard. + // FragmentScriptingNotAllowed causes the Parser to remove children + // from <script> tags (so javascript doesn't show up in pastes). + FragmentScriptingPermission m_fragmentScriptingPermission; }; } diff --git a/WebCore/html/HTMLUListElement.cpp b/WebCore/html/HTMLUListElement.cpp index fcc20bc..e022ba9 100644 --- a/WebCore/html/HTMLUListElement.cpp +++ b/WebCore/html/HTMLUListElement.cpp @@ -39,12 +39,12 @@ HTMLUListElement::HTMLUListElement(const QualifiedName& tagName, Document* docum PassRefPtr<HTMLUListElement> HTMLUListElement::create(Document* document) { - return new HTMLUListElement(ulTag, document); + return adoptRef(new HTMLUListElement(ulTag, document)); } PassRefPtr<HTMLUListElement> HTMLUListElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLUListElement(tagName, document); + return adoptRef(new HTMLUListElement(tagName, document)); } bool HTMLUListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLUListElement.idl b/WebCore/html/HTMLUListElement.idl index 38434f1..f6d3b78 100644 --- a/WebCore/html/HTMLUListElement.idl +++ b/WebCore/html/HTMLUListElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2010 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 @@ -21,7 +21,7 @@ module html { interface HTMLUListElement : HTMLElement { attribute boolean compact; - attribute [ConvertNullToNullString] DOMString type; + attribute [Reflect] DOMString type; }; } diff --git a/WebCore/html/HTMLVideoElement.cpp b/WebCore/html/HTMLVideoElement.cpp index 0389b54..9fd1a09 100644 --- a/WebCore/html/HTMLVideoElement.cpp +++ b/WebCore/html/HTMLVideoElement.cpp @@ -54,7 +54,7 @@ inline HTMLVideoElement::HTMLVideoElement(const QualifiedName& tagName, Document PassRefPtr<HTMLVideoElement> HTMLVideoElement::create(const QualifiedName& tagName, Document* document) { - return new HTMLVideoElement(tagName, document); + return adoptRef(new HTMLVideoElement(tagName, document)); } bool HTMLVideoElement::rendererIsNeeded(RenderStyle* style) @@ -177,9 +177,10 @@ void HTMLVideoElement::setPoster(const String& value) setAttribute(posterAttr, value); } -bool HTMLVideoElement::isURLAttribute(Attribute* attr) const +bool HTMLVideoElement::isURLAttribute(Attribute* attribute) const { - return attr->name() == posterAttr; + return HTMLMediaElement::isURLAttribute(attribute) + || attribute->name() == posterAttr; } const QualifiedName& HTMLVideoElement::imageSourceAttributeName() const @@ -258,4 +259,5 @@ void HTMLVideoElement::willMoveToNewOwnerDocument() } } + #endif diff --git a/WebCore/html/HTMLVideoElement.idl b/WebCore/html/HTMLVideoElement.idl index 953e447..1f56db9 100644 --- a/WebCore/html/HTMLVideoElement.idl +++ b/WebCore/html/HTMLVideoElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,22 +28,19 @@ module html { Conditional=VIDEO, GenerateNativeConverter ] HTMLVideoElement : HTMLMediaElement { - attribute unsigned long width; - attribute unsigned long height; + attribute [Reflect] unsigned long width; + attribute [Reflect] unsigned long height; readonly attribute unsigned long videoWidth; readonly attribute unsigned long videoHeight; - attribute [ConvertNullToNullString] DOMString poster; + attribute [ReflectURL] DOMString poster; readonly attribute boolean webkitSupportsFullscreen; readonly attribute boolean webkitDisplayingFullscreen; - [NeedsUserGestureCheck] void webkitEnterFullscreen() - raises (DOMException); + [NeedsUserGestureCheck] void webkitEnterFullscreen() raises (DOMException); void webkitExitFullscreen(); - [NeedsUserGestureCheck] void webkitEnterFullScreen() - raises (DOMException); + [NeedsUserGestureCheck] void webkitEnterFullScreen() raises (DOMException); void webkitExitFullScreen(); - }; } diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp index 5391ddc..f66703a 100644 --- a/WebCore/html/HTMLViewSourceDocument.cpp +++ b/WebCore/html/HTMLViewSourceDocument.cpp @@ -36,7 +36,7 @@ #include "HTMLTableElement.h" #include "HTMLTableRowElement.h" #include "HTMLTableSectionElement.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" #include "Text.h" #include "TextDocument.h" @@ -44,8 +44,8 @@ namespace WebCore { using namespace HTMLNames; -HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const String& mimeType) - : HTMLDocument(frame) +HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, const String& mimeType) + : HTMLDocument(frame, url) , m_type(mimeType) { setUsesBeforeAfterRules(true); @@ -53,14 +53,14 @@ HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const String& mimeT DocumentParser* HTMLViewSourceDocument::createParser() { - // Use HTMLDocumentParser if applicable, otherwise use TextDocumentParser. + // Use LegacyHTMLDocumentParser if applicable, otherwise use TextDocumentParser. if (m_type == "text/html" || m_type == "application/xhtml+xml" || m_type == "image/svg+xml" || DOMImplementation::isXMLMIMEType(m_type) #if ENABLE(XHTMLMP) || m_type == "application/vnd.wap.xhtml+xml" #endif ) { // FIXME: Should respect Settings::html5ParserEnabled() - return new HTMLDocumentParser(this); + return new LegacyHTMLDocumentParser(this); } return createTextDocumentParser(this); @@ -157,7 +157,7 @@ void HTMLViewSourceDocument::addViewSourceToken(Token* token) } else { const String& value = attr->value().string(); - // Compare ignoring case since HTMLDocumentParser doesn't + // Compare ignoring case since LegacyHTMLDocumentParser doesn't // lower names when passing in tokens to // HTMLViewSourceDocument. if (equalIgnoringCase(token->tagName, "base") && equalIgnoringCase(attr->name().localName(), "href")) { diff --git a/WebCore/html/HTMLViewSourceDocument.h b/WebCore/html/HTMLViewSourceDocument.h index 7de7f31..cf6cfc1 100644 --- a/WebCore/html/HTMLViewSourceDocument.h +++ b/WebCore/html/HTMLViewSourceDocument.h @@ -37,19 +37,19 @@ struct Token; class HTMLViewSourceDocument : public HTMLDocument { public: - static PassRefPtr<HTMLViewSourceDocument> create(Frame* frame, const String& mimeType) + static PassRefPtr<HTMLViewSourceDocument> create(Frame* frame, const KURL& url, const String& mimeType) { - return adoptRef(new HTMLViewSourceDocument(frame, mimeType)); + return adoptRef(new HTMLViewSourceDocument(frame, url, mimeType)); } - void addViewSourceToken(Token*); // Used by the HTMLDocumentParser. + void addViewSourceToken(Token*); // Used by the LegacyHTMLDocumentParser. void addViewSourceText(const String&); // Used by the TextDocumentParser. void addViewSourceDoctypeToken(DoctypeToken*); private: - HTMLViewSourceDocument(Frame*, const String& mimeType); + HTMLViewSourceDocument(Frame*, const KURL&, const String& mimeType); - // Returns HTMLDocumentParser or TextDocumentParser based on m_type. + // Returns LegacyHTMLDocumentParser or TextDocumentParser based on m_type. virtual DocumentParser* createParser(); void createContainingTable(); diff --git a/WebCore/html/LegacyHTMLDocumentParser.cpp b/WebCore/html/LegacyHTMLDocumentParser.cpp new file mode 100644 index 0000000..38c8a75 --- /dev/null +++ b/WebCore/html/LegacyHTMLDocumentParser.cpp @@ -0,0 +1,2106 @@ +/* + Copyright (C) 1997 Martin Jones (mjones@kde.org) + (C) 1997 Torben Weis (weis@kde.org) + (C) 1998 Waldo Bastian (bastian@kde.org) + (C) 1999 Lars Knoll (knoll@kde.org) + (C) 1999 Antti Koivisto (koivisto@kde.org) + (C) 2001 Dirk Mueller (mueller@kde.org) + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com) + Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + + 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 "LegacyHTMLDocumentParser.h" + +#include "Attribute.h" +#include "CSSHelper.h" +#include "Cache.h" +#include "CachedScript.h" +#include "DocLoader.h" +#include "DocumentFragment.h" +#include "Event.h" +#include "EventNames.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HTMLElement.h" +#include "HTMLNames.h" +#include "LegacyHTMLTreeBuilder.h" +#include "HTMLScriptElement.h" +#include "HTMLViewSourceDocument.h" +#include "ImageLoader.h" +#include "InspectorTimelineAgent.h" +#include "Page.h" +#include "LegacyPreloadScanner.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" +#include "XSSAuditor.h" +#include <wtf/ASCIICType.h> +#include <wtf/CurrentTime.h> + +#include "HTMLEntityNames.cpp" + +#define PRELOAD_SCANNER_ENABLED 1 + +using namespace WTF; +using namespace std; + +namespace WebCore { + +using namespace HTMLNames; + +// This value is used to define how many loops (approximately tokens) +// the parser will make before checking if it should yield. +// To increase responsiveness reduce both ChunkSize and TimeDelay contants. +static const int defaultTokenizerChunkSize = 4096; + +// FIXME: We would like this constant to be 200ms. +// Yielding more aggressively results in increased responsiveness and better incremental rendering. +// It slows down overall page-load on slower machines, though, so for now we set a value of 500. +// TimeDelay controls the maximum time the parser will run before yielding. +// Inline script execution can cause the parser to excede this limit. +static const double defaultTokenizerTimeDelay = 0.500; + +static const char commentStart [] = "<!--"; +static const char doctypeStart [] = "<!doctype"; +static const char publicStart [] = "public"; +static const char systemStart [] = "system"; +static const char scriptEnd [] = "</script"; +static const char xmpEnd [] = "</xmp"; +static const char styleEnd [] = "</style"; +static const char textareaEnd [] = "</textarea"; +static const char titleEnd [] = "</title"; +static const char iframeEnd [] = "</iframe"; + +// Full support for MS Windows extensions to Latin-1. +// Technically these extensions should only be activated for pages +// marked "windows-1252" or "cp1252", but +// in the standard Microsoft way, these extensions infect hundreds of thousands +// of web pages. Note that people with non-latin-1 Microsoft extensions +// are SOL. +// +// See: http://www.microsoft.com/globaldev/reference/WinCP.asp +// http://www.bbsinc.com/iso8859.html +// http://www.obviously.com/ +// +// There may be better equivalents + +// We only need this for entities. For non-entity text, we handle this in the text encoding. + +static const UChar windowsLatin1ExtensionArray[32] = { + 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87 + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F + 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, // 90-97 + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178 // 98-9F +}; + +static inline UChar fixUpChar(UChar c) +{ + if ((c & ~0x1F) != 0x0080) + return c; + return windowsLatin1ExtensionArray[c - 0x80]; +} + +static inline bool tagMatch(const char* s1, const UChar* s2, unsigned length) +{ + for (unsigned i = 0; i != length; ++i) { + unsigned char c1 = s1[i]; + unsigned char uc1 = toASCIIUpper(static_cast<char>(c1)); + UChar c2 = s2[i]; + if (c1 != c2 && uc1 != c2) + return false; + } + return true; +} + +inline void Token::addAttribute(AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode) +{ + if (!attrName.isEmpty()) { + ASSERT(!attrName.contains('/')); + RefPtr<Attribute> a = Attribute::createMapped(attrName, attributeValue); + if (!attrs) { + attrs = NamedNodeMap::create(); + attrs->reserveInitialCapacity(10); + } + attrs->insertAttribute(a.release(), viewSourceMode); + } + + attrName = emptyAtom; +} + +// ---------------------------------------------------------------------------- + +LegacyHTMLDocumentParser::LegacyHTMLDocumentParser(HTMLDocument* document, bool reportErrors) + : DocumentParser(document) + , m_buffer(0) + , m_scriptCode(0) + , m_scriptCodeSize(0) + , m_scriptCodeCapacity(0) + , m_scriptCodeResync(0) + , m_executingScript(0) + , m_requestingScript(false) + , m_hasScriptsWaitingForStylesheets(false) + , m_timer(this, &LegacyHTMLDocumentParser::timerFired) + , m_externalScriptsTimer(this, &LegacyHTMLDocumentParser::executeExternalScriptsTimerFired) + , m_treeBuilder(new LegacyHTMLTreeBuilder(document, reportErrors)) + , m_inWrite(false) + , m_fragment(false) + , m_scriptingPermission(FragmentScriptingAllowed) +{ + begin(); +} + +LegacyHTMLDocumentParser::LegacyHTMLDocumentParser(HTMLViewSourceDocument* document) + : DocumentParser(document, true) + , m_buffer(0) + , m_scriptCode(0) + , m_scriptCodeSize(0) + , m_scriptCodeCapacity(0) + , m_scriptCodeResync(0) + , m_executingScript(0) + , m_requestingScript(false) + , m_hasScriptsWaitingForStylesheets(false) + , m_timer(this, &LegacyHTMLDocumentParser::timerFired) + , m_externalScriptsTimer(this, &LegacyHTMLDocumentParser::executeExternalScriptsTimerFired) + , m_inWrite(false) + , m_fragment(false) + , m_scriptingPermission(FragmentScriptingAllowed) +{ + begin(); +} + +LegacyHTMLDocumentParser::LegacyHTMLDocumentParser(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) + : DocumentParser(frag->document()) + , m_buffer(0) + , m_scriptCode(0) + , m_scriptCodeSize(0) + , m_scriptCodeCapacity(0) + , m_scriptCodeResync(0) + , m_executingScript(0) + , m_requestingScript(false) + , m_hasScriptsWaitingForStylesheets(false) + , m_timer(this, &LegacyHTMLDocumentParser::timerFired) + , m_externalScriptsTimer(this, &LegacyHTMLDocumentParser::executeExternalScriptsTimerFired) + , m_treeBuilder(new LegacyHTMLTreeBuilder(frag, scriptingPermission)) + , m_inWrite(false) + , m_fragment(true) + , m_scriptingPermission(scriptingPermission) +{ + begin(); +} + +void LegacyHTMLDocumentParser::reset() +{ + ASSERT(m_executingScript == 0); + + while (!m_pendingScripts.isEmpty()) { + CachedResourceHandle<CachedScript> cs = m_pendingScripts.takeFirst(); + ASSERT(cache()->disabled() || cs->accessCount() > 0); + cs->removeClient(this); + } + + fastFree(m_buffer); + m_buffer = m_dest = 0; + m_bufferSize = 0; + + fastFree(m_scriptCode); + m_scriptCode = 0; + m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; + + m_timer.stop(); + m_externalScriptsTimer.stop(); + + m_state.setAllowYield(false); + m_state.setForceSynchronous(false); + + m_currentToken.reset(); + m_doctypeToken.reset(); + m_doctypeSearchCount = 0; + m_doctypeSecondarySearchCount = 0; + m_hasScriptsWaitingForStylesheets = false; +} + +void LegacyHTMLDocumentParser::begin() +{ + m_executingScript = 0; + m_requestingScript = false; + m_hasScriptsWaitingForStylesheets = false; + m_state.setLoadingExtScript(false); + reset(); + m_bufferSize = 254; + m_buffer = static_cast<UChar*>(fastMalloc(sizeof(UChar) * 254)); + m_dest = m_buffer; + tquote = NoQuote; + searchCount = 0; + m_state.setEntityState(NoEntity); + m_scriptTagSrcAttrValue = String(); + m_pendingSrc.clear(); + m_currentPrependingSrc = 0; + m_noMoreData = false; + m_brokenComments = false; + m_brokenServer = false; + m_lineNumber = 0; + m_currentScriptTagStartLineNumber = 0; + m_currentTagStartLineNumber = 0; + m_state.setForceSynchronous(false); + + Page* page = document()->page(); + if (page && page->hasCustomHTMLTokenizerTimeDelay()) + m_tokenizerTimeDelay = page->customHTMLTokenizerTimeDelay(); + else + m_tokenizerTimeDelay = defaultTokenizerTimeDelay; + + if (page && page->hasCustomHTMLTokenizerChunkSize()) + m_tokenizerChunkSize = page->customHTMLTokenizerChunkSize(); + else + m_tokenizerChunkSize = defaultTokenizerChunkSize; +} + +void LegacyHTMLDocumentParser::setForceSynchronous(bool force) +{ + m_state.setForceSynchronous(force); +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::processListing(SegmentedString list, State state) +{ + // This function adds the listing 'list' as + // preformatted text-tokens to the token-collection + while (!list.isEmpty()) { + if (state.skipLF()) { + state.setSkipLF(false); + if (*list == '\n') { + list.advance(); + continue; + } + } + + checkBuffer(); + + if (*list == '\n' || *list == '\r') { + if (state.discardLF()) + // Ignore this LF + state.setDiscardLF(false); // We have discarded 1 LF + else + *m_dest++ = '\n'; + + /* Check for MS-DOS CRLF sequence */ + if (*list == '\r') + state.setSkipLF(true); + + list.advance(); + } else { + state.setDiscardLF(false); + *m_dest++ = *list; + list.advance(); + } + } + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseNonHTMLText(SegmentedString& src, State state) +{ + ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); + ASSERT(!state.hasTagState()); + ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1); + if (state.inScript() && !m_currentScriptTagStartLineNumber) + m_currentScriptTagStartLineNumber = m_lineNumber; + + if (state.inComment()) + state = parseComment(src, state); + + int lastDecodedEntityPosition = -1; + while (!src.isEmpty()) { + checkScriptBuffer(); + UChar ch = *src; + + if (!m_scriptCodeResync && !m_brokenComments && + !state.inXmp() && ch == '-' && m_scriptCodeSize >= 3 && !src.escaped() && + m_scriptCode[m_scriptCodeSize - 3] == '<' && m_scriptCode[m_scriptCodeSize - 2] == '!' && m_scriptCode[m_scriptCodeSize - 1] == '-' && + (lastDecodedEntityPosition < m_scriptCodeSize - 3)) { + state.setInComment(true); + state = parseComment(src, state); + continue; + } + if (m_scriptCodeResync && !tquote && ch == '>') { + src.advancePastNonNewline(); + m_scriptCodeSize = m_scriptCodeResync - 1; + m_scriptCodeResync = 0; + m_scriptCode[m_scriptCodeSize] = m_scriptCode[m_scriptCodeSize + 1] = 0; + if (state.inScript()) + state = scriptHandler(state); + else { + state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); + processToken(); + if (state.inStyle()) { + m_currentToken.tagName = styleTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inTextArea()) { + m_currentToken.tagName = textareaTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inTitle()) { + m_currentToken.tagName = titleTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inXmp()) { + m_currentToken.tagName = xmpTag.localName(); + m_currentToken.beginTag = false; + } else if (state.inIFrame()) { + m_currentToken.tagName = iframeTag.localName(); + m_currentToken.beginTag = false; + } + processToken(); + state.setInStyle(false); + state.setInScript(false); + state.setInTextArea(false); + state.setInTitle(false); + state.setInXmp(false); + state.setInIFrame(false); + tquote = NoQuote; + m_scriptCodeSize = m_scriptCodeResync = 0; + } + return state; + } + // possible end of tagname, lets check. + if (!m_scriptCodeResync && !state.escaped() && !src.escaped() && (ch == '>' || ch == '/' || isASCIISpace(ch)) && + m_scriptCodeSize >= m_searchStopperLength && + tagMatch(m_searchStopper, m_scriptCode + m_scriptCodeSize - m_searchStopperLength, m_searchStopperLength) && + (lastDecodedEntityPosition < m_scriptCodeSize - m_searchStopperLength)) { + m_scriptCodeResync = m_scriptCodeSize-m_searchStopperLength+1; + tquote = NoQuote; + continue; + } + if (m_scriptCodeResync && !state.escaped()) { + if (ch == '\"') + tquote = (tquote == NoQuote) ? DoubleQuote : ((tquote == SingleQuote) ? SingleQuote : NoQuote); + else if (ch == '\'') + tquote = (tquote == NoQuote) ? SingleQuote : (tquote == DoubleQuote) ? DoubleQuote : NoQuote; + else if (tquote != NoQuote && (ch == '\r' || ch == '\n')) + tquote = NoQuote; + } + state.setEscaped(!state.escaped() && ch == '\\'); + if (!m_scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') { + UChar* scriptCodeDest = m_scriptCode + m_scriptCodeSize; + src.advancePastNonNewline(); + state = parseEntity(src, scriptCodeDest, state, m_cBufferPos, true, false); + if (scriptCodeDest == m_scriptCode + m_scriptCodeSize) + lastDecodedEntityPosition = m_scriptCodeSize; + else + m_scriptCodeSize = scriptCodeDest - m_scriptCode; + } else { + m_scriptCode[m_scriptCodeSize++] = ch; + src.advance(m_lineNumber); + } + } + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::scriptHandler(State state) +{ + // We are inside a <script> + bool doScriptExec = false; + int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based + + // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element + m_currentScriptTagStartLineNumber = 0; + + // (Bugzilla 3837) Scripts following a frameset element should not execute or, + // in the case of extern scripts, even load. + bool followingFrameset = (document()->body() && document()->body()->hasTagName(framesetTag)); + + CachedScript* cs = 0; + // don't load external scripts for standalone documents (for now) + if (!inViewSourceMode()) { + if (!m_scriptTagSrcAttrValue.isEmpty() && document()->frame()) { + // forget what we just got; load from src url instead + if (!m_treeBuilder->skipMode() && !followingFrameset) { + // The parser might have been stopped by for example a window.close call in an earlier script. + // If so, we don't want to load scripts. + if (!m_parserStopped && m_scriptNode->dispatchBeforeLoadEvent(m_scriptTagSrcAttrValue) && + (cs = document()->docLoader()->requestScript(m_scriptTagSrcAttrValue, m_scriptTagCharsetAttrValue))) + m_pendingScripts.append(cs); + else + m_scriptNode = 0; + } else + m_scriptNode = 0; + m_scriptTagSrcAttrValue = String(); + } else { + // Parse m_scriptCode containing <script> info + doScriptExec = m_scriptNode->shouldExecuteAsJavaScript(); +#if ENABLE(XHTMLMP) + if (!doScriptExec) + document()->setShouldProcessNoscriptElement(true); +#endif + m_scriptNode = 0; + } + } + + state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); + RefPtr<Node> node = processToken(); + + if (node && m_scriptingPermission == FragmentScriptingNotAllowed) { + ExceptionCode ec; + node->remove(ec); + node = 0; + } + + String scriptString = node ? node->textContent() : ""; + m_currentToken.tagName = scriptTag.localName(); + m_currentToken.beginTag = false; + processToken(); + + state.setInScript(false); + m_scriptCodeSize = m_scriptCodeResync = 0; + + // FIXME: The script should be syntax highlighted. + if (inViewSourceMode()) + return state; + + SegmentedString* savedPrependingSrc = m_currentPrependingSrc; + SegmentedString prependingSrc; + m_currentPrependingSrc = &prependingSrc; + + if (!m_treeBuilder->skipMode() && !followingFrameset) { + if (cs) { + if (savedPrependingSrc) + savedPrependingSrc->append(m_src); + else + m_pendingSrc.prepend(m_src); + setSrc(SegmentedString()); + + // the ref() call below may call notifyFinished if the script is already in cache, + // and that mucks with the state directly, so we must write it back to the object. + m_state = state; + bool savedRequestingScript = m_requestingScript; + m_requestingScript = true; + cs->addClient(this); + m_requestingScript = savedRequestingScript; + state = m_state; + // will be 0 if script was already loaded and ref() executed it + if (!m_pendingScripts.isEmpty()) + state.setLoadingExtScript(true); + } else if (!m_fragment && doScriptExec) { + if (!m_executingScript) + m_pendingSrc.prepend(m_src); + else + prependingSrc = m_src; + setSrc(SegmentedString()); + state = scriptExecution(ScriptSourceCode(scriptString, document()->frame() ? document()->frame()->document()->url() : KURL(), startLine), state); + } + } + + if (!m_executingScript && !state.loadingExtScript()) { + m_src.append(m_pendingSrc); + m_pendingSrc.clear(); + } else if (!prependingSrc.isEmpty()) { + // restore first so that the write appends in the right place + // (does not hurt to do it again below) + m_currentPrependingSrc = savedPrependingSrc; + + // we need to do this slightly modified bit of one of the write() cases + // because we want to prepend to m_pendingSrc rather than appending + // if there's no previous prependingSrc + if (!m_pendingScripts.isEmpty()) { + if (m_currentPrependingSrc) + m_currentPrependingSrc->append(prependingSrc); + else + m_pendingSrc.prepend(prependingSrc); + } else { + m_state = state; + write(prependingSrc, false); + state = m_state; + } + } + +#if PRELOAD_SCANNER_ENABLED + if (!m_pendingScripts.isEmpty() && !m_executingScript) { + if (!m_preloadScanner) + m_preloadScanner.set(new LegacyPreloadScanner(document())); + if (!m_preloadScanner->inProgress()) { + m_preloadScanner->begin(); + m_preloadScanner->write(m_pendingSrc); + } + } +#endif + m_currentPrependingSrc = savedPrependingSrc; + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::scriptExecution(const ScriptSourceCode& sourceCode, State state) +{ + if (m_fragment || !document()->frame()) + return state; + m_executingScript++; + + SegmentedString* savedPrependingSrc = m_currentPrependingSrc; + SegmentedString prependingSrc; + m_currentPrependingSrc = &prependingSrc; + + m_state = state; + document()->frame()->script()->executeScript(sourceCode); + state = m_state; + + state.setAllowYield(true); + + m_executingScript--; + + if (!m_executingScript && !state.loadingExtScript()) { + m_pendingSrc.prepend(prependingSrc); + m_src.append(m_pendingSrc); + m_pendingSrc.clear(); + } else if (!prependingSrc.isEmpty()) { + // restore first so that the write appends in the right place + // (does not hurt to do it again below) + m_currentPrependingSrc = savedPrependingSrc; + + // we need to do this slightly modified bit of one of the write() cases + // because we want to prepend to m_pendingSrc rather than appending + // if there's no previous prependingSrc + if (!m_pendingScripts.isEmpty()) { + if (m_currentPrependingSrc) + m_currentPrependingSrc->append(prependingSrc); + else + m_pendingSrc.prepend(prependingSrc); + +#if PRELOAD_SCANNER_ENABLED + // We are stuck waiting for another script. Lets check the source that + // was just document.write()n for anything to load. + LegacyPreloadScanner documentWritePreloadScanner(document()); + documentWritePreloadScanner.begin(); + documentWritePreloadScanner.write(prependingSrc); + documentWritePreloadScanner.end(); +#endif + } else { + m_state = state; + write(prependingSrc, false); + state = m_state; + } + } + + m_currentPrependingSrc = savedPrependingSrc; + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseComment(SegmentedString& src, State state) +{ + // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus. + checkScriptBuffer(src.length()); + while (!src.isEmpty()) { + UChar ch = *src; + m_scriptCode[m_scriptCodeSize++] = ch; + if (ch == '>') { + bool handleBrokenComments = m_brokenComments && !(state.inScript() || state.inStyle()); + int endCharsCount = 1; // start off with one for the '>' character + if (m_scriptCodeSize > 2 && m_scriptCode[m_scriptCodeSize-3] == '-' && m_scriptCode[m_scriptCodeSize-2] == '-') { + endCharsCount = 3; + } else if (m_scriptCodeSize > 3 && m_scriptCode[m_scriptCodeSize-4] == '-' && m_scriptCode[m_scriptCodeSize-3] == '-' && + m_scriptCode[m_scriptCodeSize-2] == '!') { + // Other browsers will accept --!> as a close comment, even though it's + // not technically valid. + endCharsCount = 4; + } + if (handleBrokenComments || endCharsCount > 1) { + src.advancePastNonNewline(); + if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) { + checkScriptBuffer(); + m_scriptCode[m_scriptCodeSize] = 0; + m_scriptCode[m_scriptCodeSize + 1] = 0; + m_currentToken.tagName = commentAtom; + m_currentToken.beginTag = true; + state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize - endCharsCount), state); + processToken(); + m_currentToken.tagName = commentAtom; + m_currentToken.beginTag = false; + processToken(); + m_scriptCodeSize = 0; + } + state.setInComment(false); + return state; // Finished parsing comment + } + } + src.advance(m_lineNumber); + } + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseServer(SegmentedString& src, State state) +{ + checkScriptBuffer(src.length()); + while (!src.isEmpty()) { + UChar ch = *src; + m_scriptCode[m_scriptCodeSize++] = ch; + if (ch == '>' && m_scriptCodeSize > 1 && m_scriptCode[m_scriptCodeSize - 2] == '%') { + src.advancePastNonNewline(); + state.setInServer(false); + m_scriptCodeSize = 0; + return state; // Finished parsing server include + } + src.advance(m_lineNumber); + } + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseProcessingInstruction(SegmentedString& src, State state) +{ + UChar oldchar = 0; + while (!src.isEmpty()) { + UChar chbegin = *src; + if (chbegin == '\'') + tquote = tquote == SingleQuote ? NoQuote : SingleQuote; + else if (chbegin == '\"') + tquote = tquote == DoubleQuote ? NoQuote : DoubleQuote; + // Look for '?>' + // Some crappy sites omit the "?" before it, so + // we look for an unquoted '>' instead. (IE compatible) + else if (chbegin == '>' && (!tquote || oldchar == '?')) { + // We got a '?>' sequence + state.setInProcessingInstruction(false); + src.advancePastNonNewline(); + state.setDiscardLF(true); + return state; // Finished parsing comment! + } + src.advance(m_lineNumber); + oldchar = chbegin; + } + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseText(SegmentedString& src, State state) +{ + while (!src.isEmpty()) { + UChar cc = *src; + + if (state.skipLF()) { + state.setSkipLF(false); + if (cc == '\n') { + src.advancePastNewline(m_lineNumber); + continue; + } + } + + // do we need to enlarge the buffer? + checkBuffer(); + + if (cc == '\r') { + state.setSkipLF(true); + *m_dest++ = '\n'; + } else + *m_dest++ = cc; + src.advance(m_lineNumber); + } + + return state; +} + + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseEntity(SegmentedString& src, UChar*& dest, State state, unsigned& cBufferPos, bool start, bool parsingTag) +{ + if (start) { + cBufferPos = 0; + state.setEntityState(SearchEntity); + EntityUnicodeValue = 0; + } + + while (!src.isEmpty()) { + UChar cc = *src; + switch (state.entityState()) { + case NoEntity: + ASSERT(state.entityState() != NoEntity); + return state; + + case SearchEntity: + if (cc == '#') { + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + state.setEntityState(NumericSearch); + } else + state.setEntityState(EntityName); + break; + + case NumericSearch: + if (cc == 'x' || cc == 'X') { + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + state.setEntityState(Hexadecimal); + } else if (cc >= '0' && cc <= '9') + state.setEntityState(Decimal); + else + state.setEntityState(SearchSemicolon); + break; + + case Hexadecimal: { + int ll = min(src.length(), 10 - cBufferPos); + while (ll--) { + cc = *src; + if (!((cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'f') || (cc >= 'A' && cc <= 'F'))) { + state.setEntityState(SearchSemicolon); + break; + } + int digit; + if (cc < 'A') + digit = cc - '0'; + else + digit = (cc - 'A' + 10) & 0xF; // handle both upper and lower case without a branch + EntityUnicodeValue = EntityUnicodeValue * 16 + digit; + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + } + if (cBufferPos == 10) + state.setEntityState(SearchSemicolon); + break; + } + case Decimal: + { + int ll = min(src.length(), 9-cBufferPos); + while (ll--) { + cc = *src; + + if (!(cc >= '0' && cc <= '9')) { + state.setEntityState(SearchSemicolon); + break; + } + + EntityUnicodeValue = EntityUnicodeValue * 10 + (cc - '0'); + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + } + if (cBufferPos == 9) + state.setEntityState(SearchSemicolon); + break; + } + case EntityName: + { + int ll = min(src.length(), 9-cBufferPos); + while (ll--) { + cc = *src; + + if (!((cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9') || (cc >= 'A' && cc <= 'Z'))) { + state.setEntityState(SearchSemicolon); + break; + } + + m_cBuffer[cBufferPos++] = cc; + src.advancePastNonNewline(); + } + if (cBufferPos == 9) + state.setEntityState(SearchSemicolon); + if (state.entityState() == SearchSemicolon) { + if (cBufferPos > 1) { + // Since the maximum length of entity name is 9, + // so a single char array which is allocated on + // the stack, its length is 10, should be OK. + // Also if we have an illegal character, we treat it + // as illegal entity name. + unsigned testedEntityNameLen = 0; + char tmpEntityNameBuffer[10]; + + ASSERT(cBufferPos < 10); + for (; testedEntityNameLen < cBufferPos; ++testedEntityNameLen) { + if (m_cBuffer[testedEntityNameLen] > 0x7e) + break; + tmpEntityNameBuffer[testedEntityNameLen] = m_cBuffer[testedEntityNameLen]; + } + + const Entity *e; + + if (testedEntityNameLen == cBufferPos) + e = findEntity(tmpEntityNameBuffer, cBufferPos); + else + e = 0; + + if (e) + EntityUnicodeValue = e->code; + + // be IE compatible + if (parsingTag && EntityUnicodeValue > 255 && *src != ';') + EntityUnicodeValue = 0; + } + } + else + break; + } + case SearchSemicolon: + // Don't allow values that are more than 21 bits. + if (EntityUnicodeValue > 0 && EntityUnicodeValue <= 0x10FFFF) { + if (!inViewSourceMode()) { + if (*src == ';') + src.advancePastNonNewline(); + if (EntityUnicodeValue <= 0xFFFF) { + checkBuffer(); + src.push(fixUpChar(EntityUnicodeValue)); + } else { + // Convert to UTF-16, using surrogate code points. + checkBuffer(2); + src.push(U16_LEAD(EntityUnicodeValue)); + src.push(U16_TRAIL(EntityUnicodeValue)); + } + } else { + // FIXME: We should eventually colorize entities by sending them as a special token. + // 12 bytes required: up to 10 bytes in m_cBuffer plus the + // leading '&' and trailing ';' + checkBuffer(12); + *dest++ = '&'; + for (unsigned i = 0; i < cBufferPos; i++) + dest[i] = m_cBuffer[i]; + dest += cBufferPos; + if (*src == ';') { + *dest++ = ';'; + src.advancePastNonNewline(); + } + } + } else { + // 11 bytes required: up to 10 bytes in m_cBuffer plus the + // leading '&' + checkBuffer(11); + // ignore the sequence, add it to the buffer as plaintext + *dest++ = '&'; + for (unsigned i = 0; i < cBufferPos; i++) + dest[i] = m_cBuffer[i]; + dest += cBufferPos; + } + + state.setEntityState(NoEntity); + return state; + } + } + + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseDoctype(SegmentedString& src, State state) +{ + ASSERT(state.inDoctype()); + while (!src.isEmpty() && state.inDoctype()) { + UChar c = *src; + bool isWhitespace = c == '\r' || c == '\n' || c == '\t' || c == ' '; + switch (m_doctypeToken.state()) { + case DoctypeBegin: { + m_doctypeToken.setState(DoctypeBeforeName); + if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeBeforeName: { + if (c == '>') { + // Malformed. Just exit. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeName); + break; + } + case DoctypeName: { + if (c == '>') { + // Valid doctype. Emit it. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (isWhitespace) { + m_doctypeSearchCount = 0; // Used now to scan for PUBLIC + m_doctypeSecondarySearchCount = 0; // Used now to scan for SYSTEM + m_doctypeToken.setState(DoctypeAfterName); + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else { + src.advancePastNonNewline(); + m_doctypeToken.m_name.append(c); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeAfterName: { + if (c == '>') { + // Valid doctype. Emit it. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (!isWhitespace) { + src.advancePastNonNewline(); + if (toASCIILower(c) == publicStart[m_doctypeSearchCount]) { + m_doctypeSearchCount++; + if (m_doctypeSearchCount == 6) + // Found 'PUBLIC' sequence + m_doctypeToken.setState(DoctypeBeforePublicID); + } else if (m_doctypeSearchCount > 0) { + m_doctypeSearchCount = 0; + m_doctypeToken.setState(DoctypeBogus); + } else if (toASCIILower(c) == systemStart[m_doctypeSecondarySearchCount]) { + m_doctypeSecondarySearchCount++; + if (m_doctypeSecondarySearchCount == 6) + // Found 'SYSTEM' sequence + m_doctypeToken.setState(DoctypeBeforeSystemID); + } else { + m_doctypeSecondarySearchCount = 0; + m_doctypeToken.setState(DoctypeBogus); + } + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else { + src.advance(m_lineNumber); // Whitespace keeps us in the after name state. + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeBeforePublicID: { + if (c == '\"' || c == '\'') { + tquote = c == '\"' ? DoubleQuote : SingleQuote; + m_doctypeToken.setState(DoctypePublicID); + src.advancePastNonNewline(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + } + case DoctypePublicID: { + if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { + src.advancePastNonNewline(); + m_doctypeToken.setState(DoctypeAfterPublicID); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else { + m_doctypeToken.m_publicID.append(c); + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + } + case DoctypeAfterPublicID: + if (c == '\"' || c == '\'') { + tquote = c == '\"' ? DoubleQuote : SingleQuote; + m_doctypeToken.setState(DoctypeSystemID); + src.advancePastNonNewline(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Valid doctype. Emit it now. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + case DoctypeBeforeSystemID: + if (c == '\"' || c == '\'') { + tquote = c == '\"' ? DoubleQuote : SingleQuote; + m_doctypeToken.setState(DoctypeSystemID); + src.advancePastNonNewline(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + case DoctypeSystemID: + if ((c == '\"' && tquote == DoubleQuote) || (c == '\'' && tquote == SingleQuote)) { + src.advancePastNonNewline(); + m_doctypeToken.setState(DoctypeAfterSystemID); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else if (c == '>') { + // Considered bogus. Don't process the doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else { + m_doctypeToken.m_systemID.append(c); + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + case DoctypeAfterSystemID: + if (c == '>') { + // Valid doctype. Emit it now. + src.advancePastNonNewline(); + state.setInDoctype(false); + processDoctypeToken(); + } else if (isWhitespace) { + src.advance(m_lineNumber); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } else + m_doctypeToken.setState(DoctypeBogus); + break; + case DoctypeBogus: + if (c == '>') { + // Done with the bogus doctype. + src.advancePastNonNewline(); + state.setInDoctype(false); + if (inViewSourceMode()) + processDoctypeToken(); + } else { + src.advance(m_lineNumber); // Just keep scanning for '>' + if (inViewSourceMode()) + m_doctypeToken.m_source.append(c); + } + break; + default: + break; + } + } + return state; +} + +LegacyHTMLDocumentParser::State LegacyHTMLDocumentParser::parseTag(SegmentedString& src, State state) +{ + ASSERT(!state.hasEntityState()); + + unsigned cBufferPos = m_cBufferPos; + + bool lastIsSlash = false; + + while (!src.isEmpty()) { + checkBuffer(); + switch (state.tagState()) { + case NoTag: + { + m_cBufferPos = cBufferPos; + return state; + } + case TagName: + { + if (searchCount > 0) { + if (*src == commentStart[searchCount]) { + searchCount++; + if (searchCount == 2) + m_doctypeSearchCount++; // A '!' is also part of a doctype, so we are moving through that still as well. + else + m_doctypeSearchCount = 0; + if (searchCount == 4) { + // Found '<!--' sequence + src.advancePastNonNewline(); + m_dest = m_buffer; // ignore the previous part of this tag + state.setInComment(true); + state.setTagState(NoTag); + + // Fix bug 34302 at kde.bugs.org. Go ahead and treat + // <!--> as a valid comment, since both mozilla and IE on windows + // can handle this case. Only do this in quirks mode. -dwh + if (!src.isEmpty() && *src == '>' && document()->inCompatMode()) { + state.setInComment(false); + src.advancePastNonNewline(); + if (!src.isEmpty()) + m_cBuffer[cBufferPos++] = *src; + } else + state = parseComment(src, state); + + m_cBufferPos = cBufferPos; + return state; // Finished parsing tag! + } + m_cBuffer[cBufferPos++] = *src; + src.advancePastNonNewline(); + break; + } else + searchCount = 0; // Stop looking for '<!--' sequence + } + + if (m_doctypeSearchCount > 0) { + if (toASCIILower(*src) == doctypeStart[m_doctypeSearchCount]) { + m_doctypeSearchCount++; + m_cBuffer[cBufferPos++] = *src; + src.advancePastNonNewline(); + if (m_doctypeSearchCount == 9) { + // Found '<!DOCTYPE' sequence + state.setInDoctype(true); + state.setTagState(NoTag); + m_doctypeToken.reset(); + if (inViewSourceMode()) + m_doctypeToken.m_source.append(m_cBuffer, cBufferPos); + state = parseDoctype(src, state); + m_cBufferPos = cBufferPos; + return state; + } + break; + } else + m_doctypeSearchCount = 0; // Stop looking for '<!DOCTYPE' sequence + } + + bool finish = false; + unsigned int ll = min(src.length(), CBUFLEN - cBufferPos); + while (ll--) { + UChar curchar = *src; + if (isASCIISpace(curchar) || curchar == '>' || curchar == '<') { + finish = true; + break; + } + + // tolower() shows up on profiles. This is faster! + if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) + m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); + else + m_cBuffer[cBufferPos++] = curchar; + src.advancePastNonNewline(); + } + + // Disadvantage: we add the possible rest of the tag + // as attribute names. ### judge if this causes problems + if (finish || CBUFLEN == cBufferPos) { + bool beginTag; + UChar* ptr = m_cBuffer; + unsigned int len = cBufferPos; + m_cBuffer[cBufferPos] = '\0'; + if ((cBufferPos > 0) && (*ptr == '/')) { + // End Tag + beginTag = false; + ptr++; + len--; + } + else + // Start Tag + beginTag = true; + + // Ignore the / in fake xml tags like <br/>. We trim off the "/" so that we'll get "br" as the tag name and not "br/". + if (len > 1 && ptr[len-1] == '/' && !inViewSourceMode()) + ptr[--len] = '\0'; + + // Now that we've shaved off any invalid / that might have followed the name), make the tag. + // FIXME: FireFox and WinIE turn !foo nodes into comments, we ignore comments. (fast/parser/tag-with-exclamation-point.html) + if (ptr[0] != '!' || inViewSourceMode()) { + m_currentToken.tagName = AtomicString(ptr); + m_currentToken.beginTag = beginTag; + } + m_dest = m_buffer; + state.setTagState(SearchAttribute); + cBufferPos = 0; + } + break; + } + case SearchAttribute: + while (!src.isEmpty()) { + UChar curchar = *src; + // In this mode just ignore any quotes we encounter and treat them like spaces. + if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"') { + if (curchar == '<' || curchar == '>') + state.setTagState(SearchEnd); + else + state.setTagState(AttributeName); + + cBufferPos = 0; + break; + } + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + src.advance(m_lineNumber); + } + break; + case AttributeName: + { + m_rawAttributeBeforeValue.clear(); + int ll = min(src.length(), CBUFLEN - cBufferPos); + while (ll--) { + UChar curchar = *src; + // If we encounter a "/" when scanning an attribute name, treat it as a delimiter. This allows the + // cases like <input type=checkbox checked/> to work (and accommodates XML-style syntax as per HTML5). + if (curchar <= '>' && (curchar >= '<' || isASCIISpace(curchar) || curchar == '/')) { + m_cBuffer[cBufferPos] = '\0'; + m_attrName = AtomicString(m_cBuffer); + m_dest = m_buffer; + *m_dest++ = 0; + state.setTagState(SearchEqual); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('a'); + break; + } + + // tolower() shows up on profiles. This is faster! + if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) + m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); + else + m_cBuffer[cBufferPos++] = curchar; + + m_rawAttributeBeforeValue.append(curchar); + src.advance(m_lineNumber); + } + if (cBufferPos == CBUFLEN) { + m_cBuffer[cBufferPos] = '\0'; + m_attrName = AtomicString(m_cBuffer); + m_dest = m_buffer; + *m_dest++ = 0; + state.setTagState(SearchEqual); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('a'); + } + break; + } + case SearchEqual: + while (!src.isEmpty()) { + UChar curchar = *src; + + if (lastIsSlash && curchar == '>') { + // This is a quirk (with a long sad history). We have to do this + // since widgets do <script src="foo.js"/> and expect the tag to close. + if (m_currentToken.tagName == scriptTag) + m_currentToken.selfClosingTag = true; + m_currentToken.brokenXMLStyle = true; + } + + // In this mode just ignore any quotes or slashes we encounter and treat them like spaces. + if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"' && curchar != '/') { + if (curchar == '=') { + state.setTagState(SearchValue); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advancePastNonNewline(); + } else { + m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode()); + m_dest = m_buffer; + state.setTagState(SearchAttribute); + lastIsSlash = false; + } + break; + } + + lastIsSlash = curchar == '/'; + + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advance(m_lineNumber); + } + break; + case SearchValue: + while (!src.isEmpty()) { + UChar curchar = *src; + if (!isASCIISpace(curchar)) { + if (curchar == '\'' || curchar == '\"') { + tquote = curchar == '\"' ? DoubleQuote : SingleQuote; + state.setTagState(QuotedValue); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advancePastNonNewline(); + } else + state.setTagState(Value); + + break; + } + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); + src.advance(m_lineNumber); + } + break; + case QuotedValue: + while (!src.isEmpty()) { + checkBuffer(); + + UChar curchar = *src; + if (curchar <= '>' && !src.escaped()) { + if (curchar == '>' && m_attrName.isEmpty()) { + // Handle a case like <img '>. Just go ahead and be willing + // to close the whole tag. Don't consume the character and + // just go back into SearchEnd while ignoring the whole + // value. + // FIXME: Note that this is actually not a very good solution. + // It doesn't handle the general case of + // unmatched quotes among attributes that have names. -dwh + while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) + m_dest--; // remove trailing newlines + AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + if (!attributeValue.contains('/')) + m_attrName = attributeValue; // Just make the name/value match. (FIXME: Is this some WinIE quirk?) + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('x'); + state.setTagState(SearchAttribute); + m_dest = m_buffer; + tquote = NoQuote; + break; + } + + if (curchar == '&') { + src.advancePastNonNewline(); + state = parseEntity(src, m_dest, state, cBufferPos, true, true); + break; + } + + if ((tquote == SingleQuote && curchar == '\'') || (tquote == DoubleQuote && curchar == '\"')) { + // some <input type=hidden> rely on trailing spaces. argh + while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) + m_dest--; // remove trailing newlines + AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + if (m_attrName.isEmpty() && !attributeValue.contains('/')) { + m_attrName = attributeValue; // Make the name match the value. (FIXME: Is this a WinIE quirk?) + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('x'); + } else if (inViewSourceMode()) + m_currentToken.addViewSourceChar('v'); + + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeBuilder->skipMode() && m_attrName == srcAttr) { + String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); + if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(attributeValue)) + attributeValue = blankURL().string(); + } + + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); + m_dest = m_buffer; + state.setTagState(SearchAttribute); + tquote = NoQuote; + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + src.advancePastNonNewline(); + break; + } + } + + *m_dest++ = curchar; + src.advance(m_lineNumber); + } + break; + case Value: + while (!src.isEmpty()) { + checkBuffer(); + UChar curchar = *src; + if (curchar <= '>' && !src.escaped()) { + // parse Entities + if (curchar == '&') { + src.advancePastNonNewline(); + state = parseEntity(src, m_dest, state, cBufferPos, true, true); + break; + } + // no quotes. Every space means end of value + // '/' does not delimit in IE! + if (isASCIISpace(curchar) || curchar == '>') { + AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeBuilder->skipMode() && m_attrName == srcAttr) { + String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); + if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(attributeValue)) + attributeValue = blankURL().string(); + } + + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); + if (inViewSourceMode()) + m_currentToken.addViewSourceChar('v'); + m_dest = m_buffer; + state.setTagState(SearchAttribute); + break; + } + } + + *m_dest++ = curchar; + src.advance(m_lineNumber); + } + break; + case SearchEnd: + { + while (!src.isEmpty()) { + UChar ch = *src; + if (ch == '>' || ch == '<') + break; + if (ch == '/') + m_currentToken.selfClosingTag = true; + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(ch); + src.advance(m_lineNumber); + } + if (src.isEmpty()) + break; + + searchCount = 0; // Stop looking for '<!--' sequence + state.setTagState(NoTag); + tquote = NoQuote; + + if (*src != '<') + src.advance(m_lineNumber); + + if (m_currentToken.tagName == nullAtom) { //stop if tag is unknown + m_cBufferPos = cBufferPos; + return state; + } + + AtomicString tagName = m_currentToken.tagName; + + // Handle <script src="foo"/> like Mozilla/Opera. We have to do this now for Dashboard + // compatibility. + bool isSelfClosingScript = m_currentToken.selfClosingTag && m_currentToken.beginTag && m_currentToken.tagName == scriptTag; + bool beginTag = !m_currentToken.selfClosingTag && m_currentToken.beginTag; + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_treeBuilder->skipMode()) { + Attribute* a = 0; + m_scriptTagSrcAttrValue = String(); + m_scriptTagCharsetAttrValue = String(); + if (m_currentToken.attrs && !m_fragment) { + if (document()->frame() && document()->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) { + if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) + m_scriptTagSrcAttrValue = document()->completeURL(deprecatedParseURL(a->value())).string(); + } + } + } + + RefPtr<Node> n = processToken(); + m_cBufferPos = cBufferPos; + if (n || inViewSourceMode()) { + State savedState = state; + SegmentedString savedSrc = src; + long savedLineno = m_lineNumber; + if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) { + if (beginTag) + state.setDiscardLF(true); // Discard the first LF after we open a pre. + } else if (tagName == scriptTag) { + ASSERT(!m_scriptNode); + m_scriptNode = static_pointer_cast<HTMLScriptElement>(n); + if (m_scriptNode) + m_scriptTagCharsetAttrValue = m_scriptNode->scriptCharset(); + if (beginTag) { + m_searchStopper = scriptEnd; + m_searchStopperLength = 8; + state.setInScript(true); + state = parseNonHTMLText(src, state); + } else if (isSelfClosingScript) { // Handle <script src="foo"/> + state.setInScript(true); + state = scriptHandler(state); + } + } else if (tagName == styleTag) { + if (beginTag) { + m_searchStopper = styleEnd; + m_searchStopperLength = 7; + state.setInStyle(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == textareaTag) { + if (beginTag) { + m_searchStopper = textareaEnd; + m_searchStopperLength = 10; + state.setInTextArea(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == titleTag) { + if (beginTag) { + m_searchStopper = titleEnd; + m_searchStopperLength = 7; + state.setInTitle(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == xmpTag) { + if (beginTag) { + m_searchStopper = xmpEnd; + m_searchStopperLength = 5; + state.setInXmp(true); + state = parseNonHTMLText(src, state); + } + } else if (tagName == iframeTag) { + if (beginTag) { + m_searchStopper = iframeEnd; + m_searchStopperLength = 8; + state.setInIFrame(true); + state = parseNonHTMLText(src, state); + } + } + if (src.isEmpty() && (state.inTitle() || inViewSourceMode()) && !state.inComment() && !(state.inScript() && m_currentScriptTagStartLineNumber)) { + // We just ate the rest of the document as the #text node under the special tag! + // Reset the state then retokenize without special handling. + // Let the parser clean up the missing close tag. + // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're + // at the end of the document unless m_noMoreData is also true. We need + // to detect this case elsewhere, and save the state somewhere other + // than a local variable. + state = savedState; + src = savedSrc; + m_lineNumber = savedLineno; + m_scriptCodeSize = 0; + } + } + if (tagName == plaintextTag) + state.setInPlainText(beginTag); + return state; // Finished parsing tag! + } + } // end switch + } + m_cBufferPos = cBufferPos; + return state; +} + +inline bool LegacyHTMLDocumentParser::continueProcessing(int& processedCount, double startTime, State &state) +{ + // We don't want to be checking elapsed time with every character, so we only check after we've + // processed a certain number of characters. + bool allowedYield = state.allowYield(); + state.setAllowYield(false); + if (!state.loadingExtScript() && !state.forceSynchronous() && !m_executingScript && (processedCount > m_tokenizerChunkSize || allowedYield)) { + processedCount = 0; + if (currentTime() - startTime > m_tokenizerTimeDelay) { + /* FIXME: We'd like to yield aggressively to give stylesheets the opportunity to + load, but this hurts overall performance on slower machines. For now turn this + off. + || (!document()->haveStylesheetsLoaded() && + (document()->documentElement()->id() != ID_HTML || document()->body()))) {*/ + // Schedule the timer to keep processing as soon as possible. + m_timer.startOneShot(0); + return false; + } + } + + processedCount++; + return true; +} + +// Turns the statemachine one crank using the passed in State object. +// This does not modify m_state directly in order to be reentrant. +ALWAYS_INLINE void LegacyHTMLDocumentParser::advance(State& state) +{ + // do we need to enlarge the buffer? + checkBuffer(); + + UChar cc = *m_src; + + bool wasSkipLF = state.skipLF(); + if (wasSkipLF) + state.setSkipLF(false); + + if (wasSkipLF && (cc == '\n')) + m_src.advance(); + else if (state.needsSpecialWriteHandling()) { + // it's important to keep needsSpecialWriteHandling with the flags this block tests + if (state.hasEntityState()) + state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); + else if (state.inPlainText()) + state = parseText(m_src, state); + else if (state.inAnyNonHTMLText()) + state = parseNonHTMLText(m_src, state); + else if (state.inComment()) + state = parseComment(m_src, state); + else if (state.inDoctype()) + state = parseDoctype(m_src, state); + else if (state.inServer()) + state = parseServer(m_src, state); + else if (state.inProcessingInstruction()) + state = parseProcessingInstruction(m_src, state); + else if (state.hasTagState()) + state = parseTag(m_src, state); + else if (state.startTag()) { + state.setStartTag(false); + + switch (cc) { + case '/': + break; + case '!': { + // <!-- comment --> or <!DOCTYPE ...> + searchCount = 1; // Look for '<!--' sequence to start comment or '<!DOCTYPE' sequence to start doctype + m_doctypeSearchCount = 1; + break; + } + case '?': { + // xml processing instruction + state.setInProcessingInstruction(true); + tquote = NoQuote; + state = parseProcessingInstruction(m_src, state); + return; + } + case '%': + if (!m_brokenServer) { + // <% server stuff, handle as comment %> + state.setInServer(true); + tquote = NoQuote; + state = parseServer(m_src, state); + return; + } + // else fall through + default: { + if (((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) { + // Start of a Start-Tag + } else { + // Invalid tag + // Add as is + *m_dest = '<'; + m_dest++; + return; + } + } + }; // end case + + processToken(); + + m_cBufferPos = 0; + state.setTagState(TagName); + state = parseTag(m_src, state); + } + } else if (cc == '&' && !m_src.escaped()) { + m_src.advancePastNonNewline(); + state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState()); + } else if (cc == '<' && !m_src.escaped()) { + m_currentTagStartLineNumber = m_lineNumber; + m_src.advancePastNonNewline(); + state.setStartTag(true); + state.setDiscardLF(false); + } else if (cc == '\n' || cc == '\r') { + if (state.discardLF()) + // Ignore this LF + state.setDiscardLF(false); // We have discarded 1 LF + else { + // Process this LF + *m_dest++ = '\n'; + if (cc == '\r' && !m_src.excludeLineNumbers()) + m_lineNumber++; + } + + /* Check for MS-DOS CRLF sequence */ + if (cc == '\r') + state.setSkipLF(true); + m_src.advance(m_lineNumber); + } else { + state.setDiscardLF(false); + *m_dest++ = cc; + m_src.advancePastNonNewline(); + } +} + +void LegacyHTMLDocumentParser::willWriteHTML(const SegmentedString& source) +{ + #if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent()) + timelineAgent->willWriteHTML(source.length(), m_lineNumber); + #endif +} + +void LegacyHTMLDocumentParser::didWriteHTML() +{ + #if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent()) + timelineAgent->didWriteHTML(m_lineNumber); + #endif +} + +void LegacyHTMLDocumentParser::write(const SegmentedString& str, bool appendData) +{ + if (!m_buffer) + return; + + if (m_parserStopped) + return; + + SegmentedString source(str); + if (m_executingScript) + source.setExcludeLineNumbers(); + + if ((m_executingScript && appendData) || !m_pendingScripts.isEmpty()) { + // don't parse; we will do this later + if (m_currentPrependingSrc) + m_currentPrependingSrc->append(source); + else { + m_pendingSrc.append(source); +#if PRELOAD_SCANNER_ENABLED + if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) + m_preloadScanner->write(source); +#endif + } + return; + } + +#if PRELOAD_SCANNER_ENABLED + if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) + m_preloadScanner->end(); +#endif + + if (!m_src.isEmpty()) + m_src.append(source); + else + setSrc(source); + + // Once a timer is set, it has control of when the parser continues. + if (m_timer.isActive()) + return; + + bool wasInWrite = m_inWrite; + m_inWrite = true; + + willWriteHTML(source); + + Frame* frame = document()->frame(); + State state = m_state; + int processedCount = 0; + double startTime = currentTime(); + + while (!m_src.isEmpty() && (!frame || !frame->redirectScheduler()->locationChangePending())) { + if (!continueProcessing(processedCount, startTime, state)) + break; + advance(state); + } + + didWriteHTML(); + + m_inWrite = wasInWrite; + m_state = state; + + if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) + end(); // this actually causes us to be deleted + + // After parsing, go ahead and dispatch image beforeload events. + ImageLoader::dispatchPendingBeforeLoadEvents(); +} + +void LegacyHTMLDocumentParser::stopParsing() +{ + DocumentParser::stopParsing(); + m_timer.stop(); + + // FIXME: Why is LegacyHTMLDocumentParser the only DocumentParser which calls checkCompleted? + // The FrameLoader needs to know that the parser has finished with its data, + // regardless of whether it happened naturally or due to manual intervention. + if (!m_fragment && document()->frame()) + document()->frame()->loader()->checkCompleted(); +} + +bool LegacyHTMLDocumentParser::processingData() const +{ + return m_timer.isActive() || m_inWrite; +} + +void LegacyHTMLDocumentParser::timerFired(Timer<LegacyHTMLDocumentParser>*) +{ + if (document()->view() && document()->view()->layoutPending() && !document()->minimumLayoutDelay()) { + // Restart the timer and let layout win. This is basically a way of ensuring that the layout + // timer has higher priority than our timer. + m_timer.startOneShot(0); + return; + } + + // Invoke write() as though more data came in. This might cause us to get deleted. + write(SegmentedString(), true); +} + +void LegacyHTMLDocumentParser::end() +{ + ASSERT(!m_timer.isActive()); + m_timer.stop(); // Only helps if assertion above fires, but do it anyway. + + if (m_buffer) { + // parseTag is using the buffer for different matters + if (!m_state.hasTagState()) + processToken(); + + fastFree(m_scriptCode); + m_scriptCode = 0; + m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; + + fastFree(m_buffer); + m_buffer = 0; + } + + if (!inViewSourceMode()) + m_treeBuilder->finished(); + else + document()->finishedParsing(); +} + +void LegacyHTMLDocumentParser::finish() +{ + // do this as long as we don't find matching comment ends + while ((m_state.inComment() || m_state.inServer()) && m_scriptCode && m_scriptCodeSize) { + // we've found an unmatched comment start + if (m_state.inComment()) + m_brokenComments = true; + else + m_brokenServer = true; + checkScriptBuffer(); + m_scriptCode[m_scriptCodeSize] = 0; + m_scriptCode[m_scriptCodeSize + 1] = 0; + int pos; + String food; + if (m_state.inScript() || m_state.inStyle() || m_state.inTextArea()) + food = String(m_scriptCode, m_scriptCodeSize); + else if (m_state.inServer()) { + food = "<"; + food.append(m_scriptCode, m_scriptCodeSize); + } else { + pos = find(m_scriptCode, m_scriptCodeSize, '>'); + food = String(m_scriptCode + pos + 1, m_scriptCodeSize - pos - 1); + } + fastFree(m_scriptCode); + m_scriptCode = 0; + m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; + m_state.setInComment(false); + m_state.setInServer(false); + if (!food.isEmpty()) + write(food, true); + } + // this indicates we will not receive any more data... but if we are waiting on + // an external script to load, we can't finish parsing until that is done + m_noMoreData = true; + if (!m_inWrite && !m_state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) + end(); // this actually causes us to be deleted +} + +bool LegacyHTMLDocumentParser::finishWasCalled() +{ + return m_noMoreData; +} + +PassRefPtr<Node> LegacyHTMLDocumentParser::processToken() +{ + if (m_dest > m_buffer) { + m_currentToken.text = StringImpl::createStrippingNullCharacters(m_buffer, m_dest - m_buffer); + if (m_currentToken.tagName != commentAtom) + m_currentToken.tagName = textAtom; + } else if (m_currentToken.tagName == nullAtom) { + m_currentToken.reset(); + return 0; + } + + m_dest = m_buffer; + + RefPtr<Node> n; + + if (!m_parserStopped) { + if (NamedNodeMap* map = m_currentToken.attrs.get()) + map->shrinkToLength(); + if (inViewSourceMode()) + static_cast<HTMLViewSourceDocument*>(document())->addViewSourceToken(&m_currentToken); + else + // pass the token over to the parser, the parser DOES NOT delete the token + n = m_treeBuilder->parseToken(&m_currentToken); + } + m_currentToken.reset(); + + return n.release(); +} + +void LegacyHTMLDocumentParser::processDoctypeToken() +{ + if (inViewSourceMode()) + static_cast<HTMLViewSourceDocument*>(document())->addViewSourceDoctypeToken(&m_doctypeToken); + else + m_treeBuilder->parseDoctypeToken(&m_doctypeToken); +} + +LegacyHTMLDocumentParser::~LegacyHTMLDocumentParser() +{ + ASSERT(!m_inWrite); + reset(); +} + + +void LegacyHTMLDocumentParser::enlargeBuffer(int len) +{ + // Resize policy: Always at least double the size of the buffer each time. + int delta = max(len, m_bufferSize); + + // Check for overflow. + // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. + static const int maxSize = INT_MAX / sizeof(UChar); + if (delta > maxSize - m_bufferSize) + CRASH(); + + int newSize = m_bufferSize + delta; + int oldOffset = m_dest - m_buffer; + m_buffer = static_cast<UChar*>(fastRealloc(m_buffer, newSize * sizeof(UChar))); + m_dest = m_buffer + oldOffset; + m_bufferSize = newSize; +} + +void LegacyHTMLDocumentParser::enlargeScriptBuffer(int len) +{ + // Resize policy: Always at least double the size of the buffer each time. + int delta = max(len, m_scriptCodeCapacity); + + // Check for overflow. + // For now, handle overflow the same way we handle fastRealloc failure, with CRASH. + static const int maxSize = INT_MAX / sizeof(UChar); + if (delta > maxSize - m_scriptCodeCapacity) + CRASH(); + + int newSize = m_scriptCodeCapacity + delta; + // If we allow fastRealloc(ptr, 0), it will call CRASH(). We run into this + // case if the HTML being parsed begins with "<!--" and there's more data + // coming. + if (!newSize) { + ASSERT(!m_scriptCode); + return; + } + + m_scriptCode = static_cast<UChar*>(fastRealloc(m_scriptCode, newSize * sizeof(UChar))); + m_scriptCodeCapacity = newSize; +} + +void LegacyHTMLDocumentParser::executeScriptsWaitingForStylesheets() +{ + ASSERT(document()->haveStylesheetsLoaded()); + + if (m_hasScriptsWaitingForStylesheets) + notifyFinished(0); +} + +void LegacyHTMLDocumentParser::notifyFinished(CachedResource*) +{ + executeExternalScriptsIfReady(); +} + +void LegacyHTMLDocumentParser::executeExternalScriptsIfReady() +{ + ASSERT(!m_pendingScripts.isEmpty()); + + // Make external scripts wait for external stylesheets. + // FIXME: This needs to be done for inline scripts too. + m_hasScriptsWaitingForStylesheets = !document()->haveStylesheetsLoaded(); + if (m_hasScriptsWaitingForStylesheets) + return; + + bool finished = false; + + double startTime = currentTime(); + while (!finished && m_pendingScripts.first()->isLoaded()) { + if (!continueExecutingExternalScripts(startTime)) + break; + + CachedResourceHandle<CachedScript> cs = m_pendingScripts.takeFirst(); + ASSERT(cache()->disabled() || cs->accessCount() > 0); + + setSrc(SegmentedString()); + + // make sure we forget about the script before we execute the new one + // infinite recursion might happen otherwise + ScriptSourceCode sourceCode(cs.get()); + bool errorOccurred = cs->errorOccurred(); + cs->removeClient(this); + + RefPtr<Node> n = m_scriptNode.release(); + + if (errorOccurred) + n->dispatchEvent(Event::create(eventNames().errorEvent, true, false)); + else { + if (static_cast<HTMLScriptElement*>(n.get())->shouldExecuteAsJavaScript()) + m_state = scriptExecution(sourceCode, m_state); +#if ENABLE(XHTMLMP) + else + document()->setShouldProcessNoscriptElement(true); +#endif + n->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); + } + + // The state of m_pendingScripts.isEmpty() can change inside the scriptExecution() + // call above, so test afterwards. + finished = m_pendingScripts.isEmpty(); + if (finished) { + ASSERT(!m_hasScriptsWaitingForStylesheets); + m_state.setLoadingExtScript(false); + } else if (m_hasScriptsWaitingForStylesheets) { + // m_hasScriptsWaitingForStylesheets flag might have changed during the script execution. + // If it did we are now blocked waiting for stylesheets and should not execute more scripts until they arrive. + finished = true; + } + + // 'm_requestingScript' is true when we are called synchronously from + // scriptHandler(). In that case scriptHandler() will take care + // of m_pendingSrc. + if (!m_requestingScript) { + SegmentedString rest = m_pendingSrc; + m_pendingSrc.clear(); + write(rest, false); + // we might be deleted at this point, do not access any members. + } + } +} + +void LegacyHTMLDocumentParser::executeExternalScriptsTimerFired(Timer<LegacyHTMLDocumentParser>*) +{ + if (document()->view() && document()->view()->layoutPending() && !document()->minimumLayoutDelay()) { + // Restart the timer and do layout first. + m_externalScriptsTimer.startOneShot(0); + return; + } + + // Continue executing external scripts. + executeExternalScriptsIfReady(); +} + +bool LegacyHTMLDocumentParser::continueExecutingExternalScripts(double startTime) +{ + if (m_externalScriptsTimer.isActive()) + return false; + + if (currentTime() - startTime > m_tokenizerTimeDelay) { + // Schedule the timer to keep processing as soon as possible. + m_externalScriptsTimer.startOneShot(0); + return false; + } + return true; +} + +bool LegacyHTMLDocumentParser::isWaitingForScripts() const +{ + return m_state.loadingExtScript(); +} + +void LegacyHTMLDocumentParser::setSrc(const SegmentedString& source) +{ + m_src = source; +} + +void LegacyHTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFragment* fragment, FragmentScriptingPermission scriptingPermission) +{ + LegacyHTMLDocumentParser parser(fragment, scriptingPermission); + parser.setForceSynchronous(true); + parser.write(source, true); + parser.finish(); + ASSERT(!parser.processingData()); // make sure we're done (see 3963151) +} + +UChar decodeNamedEntity(const char* name) +{ + const Entity* e = findEntity(name, strlen(name)); + return e ? e->code : 0; +} + +} diff --git a/WebCore/html/LegacyHTMLDocumentParser.h b/WebCore/html/LegacyHTMLDocumentParser.h new file mode 100644 index 0000000..5b96bc3 --- /dev/null +++ b/WebCore/html/LegacyHTMLDocumentParser.h @@ -0,0 +1,452 @@ +/* + Copyright (C) 1997 Martin Jones (mjones@kde.org) + (C) 1997 Torben Weis (weis@kde.org) + (C) 1998 Waldo Bastian (bastian@kde.org) + (C) 2001 Dirk Mueller (mueller@kde.org) + Copyright (C) 2003, 2004, 2005, 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. +*/ + +#ifndef LegacyHTMLDocumentParser_h +#define LegacyHTMLDocumentParser_h + +#include "CachedResourceClient.h" +#include "CachedResourceHandle.h" +#include "FragmentScriptingPermission.h" +#include "NamedNodeMap.h" +#include "SegmentedString.h" +#include "Timer.h" +#include "DocumentParser.h" +#include <wtf/Deque.h> +#include <wtf/OwnPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class CachedScript; +class DocumentFragment; +class Document; +class HTMLDocument; +class HTMLScriptElement; +class HTMLViewSourceDocument; +class FrameView; +class LegacyHTMLTreeBuilder; +class Node; +class LegacyPreloadScanner; +class ScriptSourceCode; + +/** + * @internal + * represents one HTML tag. Consists of a numerical id, and the list + * of attributes. Can also represent text. In this case the id = 0 and + * text contains the text. + */ +struct Token { + Token() + : beginTag(true) + , selfClosingTag(false) + , brokenXMLStyle(false) + , m_sourceInfo(0) + { } + ~Token() { } + + void addAttribute(AtomicString& attrName, const AtomicString& v, bool viewSourceMode); + + bool isOpenTag(const QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; } + bool isCloseTag(const QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; } + + void reset() + { + attrs = 0; + text = 0; + tagName = nullAtom; + beginTag = true; + selfClosingTag = false; + brokenXMLStyle = false; + if (m_sourceInfo) + m_sourceInfo->clear(); + } + + void addViewSourceChar(UChar c) { if (!m_sourceInfo.get()) m_sourceInfo.set(new Vector<UChar>); m_sourceInfo->append(c); } + + RefPtr<NamedNodeMap> attrs; + RefPtr<StringImpl> text; + AtomicString tagName; + bool beginTag; + bool selfClosingTag; + bool brokenXMLStyle; + OwnPtr<Vector<UChar> > m_sourceInfo; +}; + +enum DoctypeState { + DoctypeBegin, + DoctypeBeforeName, + DoctypeName, + DoctypeAfterName, + DoctypeBeforePublicID, + DoctypePublicID, + DoctypeAfterPublicID, + DoctypeBeforeSystemID, + DoctypeSystemID, + DoctypeAfterSystemID, + DoctypeBogus +}; + +class DoctypeToken { +public: + DoctypeToken() {} + + void reset() + { + m_name.clear(); + m_publicID.clear(); + m_systemID.clear(); + m_state = DoctypeBegin; + m_source.clear(); + m_forceQuirks = false; + } + + DoctypeState state() { return m_state; } + void setState(DoctypeState s) { m_state = s; } + + Vector<UChar> m_name; + Vector<UChar> m_publicID; + Vector<UChar> m_systemID; + DoctypeState m_state; + + Vector<UChar> m_source; + + bool m_forceQuirks; // Used by the HTML5 parser. +}; + +//----------------------------------------------------------------------------- + +// FIXME: This class does too much. Right now it is both an HTML tokenizer as well +// as handling all of the non-tokenizer-specific junk related to tokenizing HTML +// (like dealing with <script> tags). The HTML tokenizer bits should be pushed +// down into a separate HTML tokenizer class. + +class LegacyHTMLDocumentParser : public DocumentParser, public CachedResourceClient { +public: + LegacyHTMLDocumentParser(HTMLDocument*, bool reportErrors); + LegacyHTMLDocumentParser(HTMLViewSourceDocument*); + LegacyHTMLDocumentParser(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + virtual ~LegacyHTMLDocumentParser(); + + bool forceSynchronous() const { return m_state.forceSynchronous(); } + void setForceSynchronous(bool force); + + // Exposed for LegacyHTMLTreeBuilder::reportErrorToConsole + bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); } + + static void parseDocumentFragment(const String&, DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + +protected: + // Exposed for FTPDirectoryDocumentParser + virtual void write(const SegmentedString&, bool appendData); + virtual void finish(); + +private: + // DocumentParser + virtual bool finishWasCalled(); + virtual bool isWaitingForScripts() const; + virtual void stopParsing(); + virtual bool processingData() const; + virtual bool isExecutingScript() const { return !!m_executingScript; } + + virtual int lineNumber() const { return m_lineNumber; } + virtual int columnNumber() const { return 1; } + + virtual void executeScriptsWaitingForStylesheets(); + + virtual LegacyHTMLTreeBuilder* htmlTreeBuilder() const { return m_treeBuilder.get(); } + virtual LegacyHTMLDocumentParser* asHTMLDocumentParser() { return this; } + + class State; + + void begin(); + void end(); + void reset(); + + void willWriteHTML(const SegmentedString&); + ALWAYS_INLINE void advance(State&); + void didWriteHTML(); + + PassRefPtr<Node> processToken(); + void processDoctypeToken(); + + State processListing(SegmentedString, State); + State parseComment(SegmentedString&, State); + State parseDoctype(SegmentedString&, State); + State parseServer(SegmentedString&, State); + State parseText(SegmentedString&, State); + State parseNonHTMLText(SegmentedString&, State); + State parseTag(SegmentedString&, State); + State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag); + State parseProcessingInstruction(SegmentedString&, State); + State scriptHandler(State); + State scriptExecution(const ScriptSourceCode&, State); + void setSrc(const SegmentedString&); + + // check if we have enough space in the buffer. + // if not enlarge it + inline void checkBuffer(int len = 10) + { + if ((m_dest - m_buffer) > m_bufferSize - len) + enlargeBuffer(len); + } + + inline void checkScriptBuffer(int len = 10) + { + if (m_scriptCodeSize + len >= m_scriptCodeCapacity) + enlargeScriptBuffer(len); + } + + void enlargeBuffer(int len); + void enlargeScriptBuffer(int len); + + bool continueProcessing(int& processedCount, double startTime, State&); + void timerFired(Timer<LegacyHTMLDocumentParser>*); + void allDataProcessed(); + + // from CachedResourceClient + void notifyFinished(CachedResource*); + + void executeExternalScriptsIfReady(); + void executeExternalScriptsTimerFired(Timer<LegacyHTMLDocumentParser>*); + bool continueExecutingExternalScripts(double startTime); + + // Internal buffers + /////////////////// + UChar* m_buffer; + int m_bufferSize; + UChar* m_dest; + + Token m_currentToken; + + // This buffer holds the raw characters we've seen between the beginning of + // the attribute name and the first character of the attribute value. + Vector<UChar, 32> m_rawAttributeBeforeValue; + + // DocumentParser flags + ////////////////// + // are we in quotes within a html tag + enum { NoQuote, SingleQuote, DoubleQuote } tquote; + + // Are we in a &... character entity description? + enum EntityState { + NoEntity = 0, + SearchEntity = 1, + NumericSearch = 2, + Hexadecimal = 3, + Decimal = 4, + EntityName = 5, + SearchSemicolon = 6 + }; + unsigned EntityUnicodeValue; + + enum TagState { + NoTag = 0, + TagName = 1, + SearchAttribute = 2, + AttributeName = 3, + SearchEqual = 4, + SearchValue = 5, + QuotedValue = 6, + Value = 7, + SearchEnd = 8 + }; + + class State { + public: + State() : m_bits(0) { } + + TagState tagState() const { return static_cast<TagState>(m_bits & TagMask); } + void setTagState(TagState t) { m_bits = (m_bits & ~TagMask) | t; } + EntityState entityState() const { return static_cast<EntityState>((m_bits & EntityMask) >> EntityShift); } + void setEntityState(EntityState e) { m_bits = (m_bits & ~EntityMask) | (e << EntityShift); } + + bool inScript() const { return testBit(InScript); } + void setInScript(bool v) { setBit(InScript, v); } + bool inStyle() const { return testBit(InStyle); } + void setInStyle(bool v) { setBit(InStyle, v); } + bool inXmp() const { return testBit(InXmp); } + void setInXmp(bool v) { setBit(InXmp, v); } + bool inTitle() const { return testBit(InTitle); } + void setInTitle(bool v) { setBit(InTitle, v); } + bool inIFrame() const { return testBit(InIFrame); } + void setInIFrame(bool v) { setBit(InIFrame, v); } + bool inPlainText() const { return testBit(InPlainText); } + void setInPlainText(bool v) { setBit(InPlainText, v); } + bool inProcessingInstruction() const { return testBit(InProcessingInstruction); } + void setInProcessingInstruction(bool v) { return setBit(InProcessingInstruction, v); } + bool inComment() const { return testBit(InComment); } + void setInComment(bool v) { setBit(InComment, v); } + bool inDoctype() const { return testBit(InDoctype); } + void setInDoctype(bool v) { setBit(InDoctype, v); } + bool inTextArea() const { return testBit(InTextArea); } + void setInTextArea(bool v) { setBit(InTextArea, v); } + bool escaped() const { return testBit(Escaped); } + void setEscaped(bool v) { setBit(Escaped, v); } + bool inServer() const { return testBit(InServer); } + void setInServer(bool v) { setBit(InServer, v); } + bool skipLF() const { return testBit(SkipLF); } + void setSkipLF(bool v) { setBit(SkipLF, v); } + bool startTag() const { return testBit(StartTag); } + void setStartTag(bool v) { setBit(StartTag, v); } + bool discardLF() const { return testBit(DiscardLF); } + void setDiscardLF(bool v) { setBit(DiscardLF, v); } + bool allowYield() const { return testBit(AllowYield); } + void setAllowYield(bool v) { setBit(AllowYield, v); } + bool loadingExtScript() const { return testBit(LoadingExtScript); } + void setLoadingExtScript(bool v) { setBit(LoadingExtScript, v); } + bool forceSynchronous() const { return testBit(ForceSynchronous); } + void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); } + + bool inAnyNonHTMLText() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); } + bool hasTagState() const { return m_bits & TagMask; } + bool hasEntityState() const { return m_bits & EntityMask; } + + bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame | TagMask | EntityMask | InPlainText | InComment | InDoctype | InServer | InProcessingInstruction | StartTag); } + + private: + static const int EntityShift = 4; + enum StateBits { + TagMask = (1 << 4) - 1, + EntityMask = (1 << 7) - (1 << 4), + InScript = 1 << 7, + InStyle = 1 << 8, + // Bit 9 unused + InXmp = 1 << 10, + InTitle = 1 << 11, + InPlainText = 1 << 12, + InProcessingInstruction = 1 << 13, + InComment = 1 << 14, + InTextArea = 1 << 15, + Escaped = 1 << 16, + InServer = 1 << 17, + SkipLF = 1 << 18, + StartTag = 1 << 19, + DiscardLF = 1 << 20, // FIXME: should clarify difference between skip and discard + AllowYield = 1 << 21, + LoadingExtScript = 1 << 22, + ForceSynchronous = 1 << 23, + InIFrame = 1 << 24, + InDoctype = 1 << 25 + }; + + void setBit(StateBits bit, bool value) + { + if (value) + m_bits |= bit; + else + m_bits &= ~bit; + } + bool testBit(StateBits bit) const { return m_bits & bit; } + + unsigned m_bits; + }; + + State m_state; + + DoctypeToken m_doctypeToken; + int m_doctypeSearchCount; + int m_doctypeSecondarySearchCount; + + bool m_brokenServer; + + // Name of an attribute that we just scanned. + AtomicString m_attrName; + + // Used to store the code of a scripting sequence + UChar* m_scriptCode; + // Size of the script sequenze stored in @ref #scriptCode + int m_scriptCodeSize; + // Maximal size that can be stored in @ref #scriptCode + int m_scriptCodeCapacity; + // resync point of script code size + int m_scriptCodeResync; + + // Stores characters if we are scanning for a string like "</script>" + UChar searchBuffer[10]; + + // Counts where we are in the string we are scanning for + int searchCount; + // the stopper string + const char* m_searchStopper; + int m_searchStopperLength; + + // if no more data is coming, just parse what we have (including ext scripts that + // may be still downloading) and finish + bool m_noMoreData; + // URL to get source code of script from + String m_scriptTagSrcAttrValue; + String m_scriptTagCharsetAttrValue; + // the HTML code we will parse after the external script we are waiting for has loaded + SegmentedString m_pendingSrc; + + // the HTML code we will parse after this particular script has + // loaded, but before all pending HTML + SegmentedString* m_currentPrependingSrc; + + // true if we are executing a script while parsing a document. This causes the parsing of + // the output of the script to be postponed until after the script has finished executing + int m_executingScript; + Deque<CachedResourceHandle<CachedScript> > m_pendingScripts; + RefPtr<HTMLScriptElement> m_scriptNode; + + bool m_requestingScript; + bool m_hasScriptsWaitingForStylesheets; + + // if we found one broken comment, there are most likely others as well + // store a flag to get rid of the O(n^2) behaviour in such a case. + bool m_brokenComments; + // current line number + int m_lineNumber; + int m_currentScriptTagStartLineNumber; + int m_currentTagStartLineNumber; + + double m_tokenizerTimeDelay; + int m_tokenizerChunkSize; + + // The timer for continued processing. + Timer<LegacyHTMLDocumentParser> m_timer; + + // The timer for continued executing external scripts. + Timer<LegacyHTMLDocumentParser> m_externalScriptsTimer; + +// This buffer can hold arbitrarily long user-defined attribute names, such as in EMBED tags. +// So any fixed number might be too small, but rather than rewriting all usage of this buffer +// we'll just make it large enough to handle all imaginable cases. +#define CBUFLEN 1024 + UChar m_cBuffer[CBUFLEN + 2]; + unsigned int m_cBufferPos; + + SegmentedString m_src; + OwnPtr<LegacyHTMLTreeBuilder> m_treeBuilder; + bool m_inWrite; + bool m_fragment; + FragmentScriptingPermission m_scriptingPermission; + + OwnPtr<LegacyPreloadScanner> m_preloadScanner; +}; + +UChar decodeNamedEntity(const char*); + +} // namespace WebCore + +#endif // LegacyHTMLDocumentParser_h diff --git a/WebCore/html/LegacyHTMLTreeConstructor.cpp b/WebCore/html/LegacyHTMLTreeBuilder.cpp index 1db0bb6..7b44943 100644 --- a/WebCore/html/LegacyHTMLTreeConstructor.cpp +++ b/WebCore/html/LegacyHTMLTreeBuilder.cpp @@ -23,7 +23,7 @@ */ #include "config.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "CharacterNames.h" #include "CSSPropertyNames.h" @@ -52,7 +52,7 @@ #include "HTMLTableCellElement.h" #include "HTMLTableRowElement.h" #include "HTMLTableSectionElement.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" #include "LocalizedStrings.h" #include "Page.h" #include "Settings.h" @@ -140,7 +140,7 @@ struct HTMLStackElem : Noncopyable { * */ -LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor(HTMLDocument* doc, bool reportErrors) +LegacyHTMLTreeBuilder::LegacyHTMLTreeBuilder(HTMLDocument* doc, bool reportErrors) : m_document(doc) , m_current(doc) , m_didRefCurrent(false) @@ -160,7 +160,7 @@ LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor(HTMLDocument* doc, bool rep { } -LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) +LegacyHTMLTreeBuilder::LegacyHTMLTreeBuilder(DocumentFragment* frag, FragmentScriptingPermission scriptingPermission) : m_document(frag->document()) , m_current(frag) , m_didRefCurrent(true) @@ -182,14 +182,14 @@ LegacyHTMLTreeConstructor::LegacyHTMLTreeConstructor(DocumentFragment* frag, Fra frag->ref(); } -LegacyHTMLTreeConstructor::~LegacyHTMLTreeConstructor() +LegacyHTMLTreeBuilder::~LegacyHTMLTreeBuilder() { freeBlock(); if (m_didRefCurrent) m_current->deref(); } -void LegacyHTMLTreeConstructor::reset() +void LegacyHTMLTreeBuilder::reset() { ASSERT(!m_isParsingFragment); @@ -214,7 +214,7 @@ void LegacyHTMLTreeConstructor::reset() m_parserQuirks->reset(); } -void LegacyHTMLTreeConstructor::setCurrent(Node* newCurrent) +void LegacyHTMLTreeBuilder::setCurrent(Node* newCurrent) { bool didRefNewCurrent = newCurrent && newCurrent != m_document; if (didRefNewCurrent) @@ -230,7 +230,7 @@ inline static int tagPriorityOfNode(Node* n) return n->isHTMLElement() ? static_cast<HTMLElement*>(n)->tagPriority() : 0; } -inline void LegacyHTMLTreeConstructor::limitDepth(int tagPriority) +inline void LegacyHTMLTreeBuilder::limitDepth(int tagPriority) { while (m_treeDepth >= maxDOMTreeDepth) popBlock(m_blockStack->tagName); @@ -240,13 +240,13 @@ inline void LegacyHTMLTreeConstructor::limitDepth(int tagPriority) } } -inline bool LegacyHTMLTreeConstructor::insertNodeAfterLimitDepth(Node* n, bool flat) +inline bool LegacyHTMLTreeBuilder::insertNodeAfterLimitDepth(Node* n, bool flat) { limitDepth(tagPriorityOfNode(n)); return insertNode(n, flat); } -PassRefPtr<Node> LegacyHTMLTreeConstructor::parseToken(Token* t) +PassRefPtr<Node> LegacyHTMLTreeBuilder::parseToken(Token* t) { if (!m_skipModeTag.isNull()) { if (!t->beginTag && t->tagName == m_skipModeTag) @@ -337,7 +337,7 @@ PassRefPtr<Node> LegacyHTMLTreeConstructor::parseToken(Token* t) return n; } -void LegacyHTMLTreeConstructor::parseDoctypeToken(DoctypeToken* t) +void LegacyHTMLTreeBuilder::parseDoctypeToken(DoctypeToken* t) { // Ignore any doctype after the first. Ignore doctypes in fragments. if (m_document->doctype() || m_isParsingFragment || m_current != m_document) @@ -372,7 +372,7 @@ static bool isScopingTag(const AtomicString& tagName) || tagName == objectTag || tagName == tableTag || tagName == htmlTag; } -bool LegacyHTMLTreeConstructor::insertNode(Node* n, bool flat) +bool LegacyHTMLTreeBuilder::insertNode(Node* n, bool flat) { RefPtr<Node> protectNode(n); @@ -429,7 +429,7 @@ bool LegacyHTMLTreeConstructor::insertNode(Node* n, bool flat) return true; } -bool LegacyHTMLTreeConstructor::handleError(Node* n, bool flat, const AtomicString& localName, int tagPriority) +bool LegacyHTMLTreeBuilder::handleError(Node* n, bool flat, const AtomicString& localName, int tagPriority) { // Error handling code. This is just ad hoc handling of specific parent/child combinations. bool handled = false; @@ -724,22 +724,22 @@ bool LegacyHTMLTreeConstructor::handleError(Node* n, bool flat, const AtomicStri return insertNode(n); } -typedef bool (LegacyHTMLTreeConstructor::*CreateErrorCheckFunc)(Token* t, RefPtr<Node>&); +typedef bool (LegacyHTMLTreeBuilder::*CreateErrorCheckFunc)(Token* t, RefPtr<Node>&); typedef HashMap<AtomicStringImpl*, CreateErrorCheckFunc> FunctionMap; -bool LegacyHTMLTreeConstructor::textCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::textCreateErrorCheck(Token* t, RefPtr<Node>& result) { result = Text::create(m_document, t->text.get()); return false; } -bool LegacyHTMLTreeConstructor::commentCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::commentCreateErrorCheck(Token* t, RefPtr<Node>& result) { result = Comment::create(m_document, t->text.get()); return false; } -bool LegacyHTMLTreeConstructor::headCreateErrorCheck(Token*, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::headCreateErrorCheck(Token*, RefPtr<Node>& result) { if (!m_head || m_current->localName() == htmlTag) { m_head = HTMLHeadElement::create(m_document); @@ -749,7 +749,7 @@ bool LegacyHTMLTreeConstructor::headCreateErrorCheck(Token*, RefPtr<Node>& resul return false; } -bool LegacyHTMLTreeConstructor::bodyCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::bodyCreateErrorCheck(Token*, RefPtr<Node>&) { // body no longer allowed if we have a frameset if (m_haveFrameSet) @@ -765,7 +765,7 @@ bool LegacyHTMLTreeConstructor::bodyCreateErrorCheck(Token*, RefPtr<Node>&) return true; } -bool LegacyHTMLTreeConstructor::framesetCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::framesetCreateErrorCheck(Token*, RefPtr<Node>&) { popBlock(headTag); if (m_inBody && !m_haveFrameSet && !m_haveContent) { @@ -785,7 +785,7 @@ bool LegacyHTMLTreeConstructor::framesetCreateErrorCheck(Token*, RefPtr<Node>&) return true; } -bool LegacyHTMLTreeConstructor::formCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::formCreateErrorCheck(Token* t, RefPtr<Node>& result) { // Only create a new form if we're not already inside one. // This is consistent with other browsers' behavior. @@ -797,7 +797,7 @@ bool LegacyHTMLTreeConstructor::formCreateErrorCheck(Token* t, RefPtr<Node>& res return false; } -bool LegacyHTMLTreeConstructor::isindexCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::isindexCreateErrorCheck(Token* t, RefPtr<Node>& result) { RefPtr<Node> n = handleIsindex(t); if (!m_inBody) @@ -809,12 +809,12 @@ bool LegacyHTMLTreeConstructor::isindexCreateErrorCheck(Token* t, RefPtr<Node>& return false; } -bool LegacyHTMLTreeConstructor::selectCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::selectCreateErrorCheck(Token*, RefPtr<Node>&) { return true; } -bool LegacyHTMLTreeConstructor::ddCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::ddCreateErrorCheck(Token* t, RefPtr<Node>& result) { pCloserCreateErrorCheck(t, result); popBlock(dtTag); @@ -822,7 +822,7 @@ bool LegacyHTMLTreeConstructor::ddCreateErrorCheck(Token* t, RefPtr<Node>& resul return true; } -bool LegacyHTMLTreeConstructor::dtCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::dtCreateErrorCheck(Token* t, RefPtr<Node>& result) { pCloserCreateErrorCheck(t, result); popBlock(ddTag); @@ -830,46 +830,46 @@ bool LegacyHTMLTreeConstructor::dtCreateErrorCheck(Token* t, RefPtr<Node>& resul return true; } -bool LegacyHTMLTreeConstructor::rpCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::rpCreateErrorCheck(Token*, RefPtr<Node>&) { popBlock(rpTag); popBlock(rtTag); return true; } -bool LegacyHTMLTreeConstructor::rtCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::rtCreateErrorCheck(Token*, RefPtr<Node>&) { popBlock(rpTag); popBlock(rtTag); return true; } -bool LegacyHTMLTreeConstructor::nestedCreateErrorCheck(Token* t, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::nestedCreateErrorCheck(Token* t, RefPtr<Node>&) { popBlock(t->tagName); return true; } -bool LegacyHTMLTreeConstructor::nestedPCloserCreateErrorCheck(Token* t, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::nestedPCloserCreateErrorCheck(Token* t, RefPtr<Node>& result) { pCloserCreateErrorCheck(t, result); popBlock(t->tagName); return true; } -bool LegacyHTMLTreeConstructor::nestedStyleCreateErrorCheck(Token* t, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::nestedStyleCreateErrorCheck(Token* t, RefPtr<Node>&) { return allowNestedRedundantTag(t->tagName); } -bool LegacyHTMLTreeConstructor::tableCellCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::tableCellCreateErrorCheck(Token*, RefPtr<Node>&) { popBlock(tdTag); popBlock(thTag); return true; } -bool LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::tableSectionCreateErrorCheck(Token*, RefPtr<Node>&) { popBlock(theadTag); popBlock(tbodyTag); @@ -877,19 +877,19 @@ bool LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck(Token*, RefPtr<Node return true; } -bool LegacyHTMLTreeConstructor::noembedCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::noembedCreateErrorCheck(Token*, RefPtr<Node>&) { setSkipMode(noembedTag); return true; } -bool LegacyHTMLTreeConstructor::noframesCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::noframesCreateErrorCheck(Token*, RefPtr<Node>&) { setSkipMode(noframesTag); return true; } -bool LegacyHTMLTreeConstructor::noscriptCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::noscriptCreateErrorCheck(Token*, RefPtr<Node>&) { if (!m_isParsingFragment) { Frame* frame = m_document->frame(); @@ -899,14 +899,14 @@ bool LegacyHTMLTreeConstructor::noscriptCreateErrorCheck(Token*, RefPtr<Node>&) return true; } -bool LegacyHTMLTreeConstructor::pCloserCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::pCloserCreateErrorCheck(Token*, RefPtr<Node>&) { if (hasPElementInScope()) popBlock(pTag); return true; } -bool LegacyHTMLTreeConstructor::pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&) +bool LegacyHTMLTreeBuilder::pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&) { if (m_document->inCompatMode()) return true; @@ -915,7 +915,7 @@ bool LegacyHTMLTreeConstructor::pCloserStrictCreateErrorCheck(Token*, RefPtr<Nod return true; } -bool LegacyHTMLTreeConstructor::mapCreateErrorCheck(Token*, RefPtr<Node>& result) +bool LegacyHTMLTreeBuilder::mapCreateErrorCheck(Token*, RefPtr<Node>& result) { m_currentMapElement = HTMLMapElement::create(m_document); result = m_currentMapElement; @@ -936,48 +936,48 @@ static void mapTagsToFunc(FunctionMap& map, QualifiedName (&names)[ArraySize], C } } -PassRefPtr<Node> LegacyHTMLTreeConstructor::getNode(Token* t) +PassRefPtr<Node> LegacyHTMLTreeBuilder::getNode(Token* t) { // Init our error handling table. DEFINE_STATIC_LOCAL(FunctionMap, gFunctionMap, ()); if (gFunctionMap.isEmpty()) { QualifiedName nestedCreateErrorTags[] = { aTag, buttonTag, nobrTag, trTag }; - mapTagsToFunc(gFunctionMap, nestedCreateErrorTags, &LegacyHTMLTreeConstructor::nestedCreateErrorCheck); + mapTagsToFunc(gFunctionMap, nestedCreateErrorTags, &LegacyHTMLTreeBuilder::nestedCreateErrorCheck); QualifiedName nestedStyleCreateErrorTags[] = { bTag, bigTag, iTag, sTag, smallTag, strikeTag, ttTag, uTag }; - mapTagsToFunc(gFunctionMap, nestedStyleCreateErrorTags, &LegacyHTMLTreeConstructor::nestedStyleCreateErrorCheck); + mapTagsToFunc(gFunctionMap, nestedStyleCreateErrorTags, &LegacyHTMLTreeBuilder::nestedStyleCreateErrorCheck); QualifiedName pCloserCreateErrorTags[] = { addressTag, articleTag, asideTag, blockquoteTag, centerTag, dirTag, divTag, dlTag, fieldsetTag, footerTag, h1Tag, h2Tag, h3Tag, h4Tag, h5Tag, h6Tag, headerTag, hgroupTag, hrTag, listingTag, menuTag, navTag, olTag, pTag, plaintextTag, preTag, sectionTag, ulTag }; - mapTagsToFunc(gFunctionMap, pCloserCreateErrorTags, &LegacyHTMLTreeConstructor::pCloserCreateErrorCheck); - - mapTagToFunc(gFunctionMap, bodyTag, &LegacyHTMLTreeConstructor::bodyCreateErrorCheck); - mapTagToFunc(gFunctionMap, ddTag, &LegacyHTMLTreeConstructor::ddCreateErrorCheck); - mapTagToFunc(gFunctionMap, dtTag, &LegacyHTMLTreeConstructor::dtCreateErrorCheck); - mapTagToFunc(gFunctionMap, formTag, &LegacyHTMLTreeConstructor::formCreateErrorCheck); - mapTagToFunc(gFunctionMap, framesetTag, &LegacyHTMLTreeConstructor::framesetCreateErrorCheck); - mapTagToFunc(gFunctionMap, headTag, &LegacyHTMLTreeConstructor::headCreateErrorCheck); - mapTagToFunc(gFunctionMap, isindexTag, &LegacyHTMLTreeConstructor::isindexCreateErrorCheck); - mapTagToFunc(gFunctionMap, mapTag, &LegacyHTMLTreeConstructor::mapCreateErrorCheck); - mapTagToFunc(gFunctionMap, liTag, &LegacyHTMLTreeConstructor::nestedPCloserCreateErrorCheck); - mapTagToFunc(gFunctionMap, noembedTag, &LegacyHTMLTreeConstructor::noembedCreateErrorCheck); - mapTagToFunc(gFunctionMap, noframesTag, &LegacyHTMLTreeConstructor::noframesCreateErrorCheck); - mapTagToFunc(gFunctionMap, noscriptTag, &LegacyHTMLTreeConstructor::noscriptCreateErrorCheck); - mapTagToFunc(gFunctionMap, tableTag, &LegacyHTMLTreeConstructor::pCloserStrictCreateErrorCheck); - mapTagToFunc(gFunctionMap, rpTag, &LegacyHTMLTreeConstructor::rpCreateErrorCheck); - mapTagToFunc(gFunctionMap, rtTag, &LegacyHTMLTreeConstructor::rtCreateErrorCheck); - mapTagToFunc(gFunctionMap, selectTag, &LegacyHTMLTreeConstructor::selectCreateErrorCheck); - mapTagToFunc(gFunctionMap, tdTag, &LegacyHTMLTreeConstructor::tableCellCreateErrorCheck); - mapTagToFunc(gFunctionMap, thTag, &LegacyHTMLTreeConstructor::tableCellCreateErrorCheck); - mapTagToFunc(gFunctionMap, tbodyTag, &LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck); - mapTagToFunc(gFunctionMap, tfootTag, &LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck); - mapTagToFunc(gFunctionMap, theadTag, &LegacyHTMLTreeConstructor::tableSectionCreateErrorCheck); - - gFunctionMap.set(commentAtom.impl(), &LegacyHTMLTreeConstructor::commentCreateErrorCheck); - gFunctionMap.set(textAtom.impl(), &LegacyHTMLTreeConstructor::textCreateErrorCheck); + mapTagsToFunc(gFunctionMap, pCloserCreateErrorTags, &LegacyHTMLTreeBuilder::pCloserCreateErrorCheck); + + mapTagToFunc(gFunctionMap, bodyTag, &LegacyHTMLTreeBuilder::bodyCreateErrorCheck); + mapTagToFunc(gFunctionMap, ddTag, &LegacyHTMLTreeBuilder::ddCreateErrorCheck); + mapTagToFunc(gFunctionMap, dtTag, &LegacyHTMLTreeBuilder::dtCreateErrorCheck); + mapTagToFunc(gFunctionMap, formTag, &LegacyHTMLTreeBuilder::formCreateErrorCheck); + mapTagToFunc(gFunctionMap, framesetTag, &LegacyHTMLTreeBuilder::framesetCreateErrorCheck); + mapTagToFunc(gFunctionMap, headTag, &LegacyHTMLTreeBuilder::headCreateErrorCheck); + mapTagToFunc(gFunctionMap, isindexTag, &LegacyHTMLTreeBuilder::isindexCreateErrorCheck); + mapTagToFunc(gFunctionMap, mapTag, &LegacyHTMLTreeBuilder::mapCreateErrorCheck); + mapTagToFunc(gFunctionMap, liTag, &LegacyHTMLTreeBuilder::nestedPCloserCreateErrorCheck); + mapTagToFunc(gFunctionMap, noembedTag, &LegacyHTMLTreeBuilder::noembedCreateErrorCheck); + mapTagToFunc(gFunctionMap, noframesTag, &LegacyHTMLTreeBuilder::noframesCreateErrorCheck); + mapTagToFunc(gFunctionMap, noscriptTag, &LegacyHTMLTreeBuilder::noscriptCreateErrorCheck); + mapTagToFunc(gFunctionMap, tableTag, &LegacyHTMLTreeBuilder::pCloserStrictCreateErrorCheck); + mapTagToFunc(gFunctionMap, rpTag, &LegacyHTMLTreeBuilder::rpCreateErrorCheck); + mapTagToFunc(gFunctionMap, rtTag, &LegacyHTMLTreeBuilder::rtCreateErrorCheck); + mapTagToFunc(gFunctionMap, selectTag, &LegacyHTMLTreeBuilder::selectCreateErrorCheck); + mapTagToFunc(gFunctionMap, tdTag, &LegacyHTMLTreeBuilder::tableCellCreateErrorCheck); + mapTagToFunc(gFunctionMap, thTag, &LegacyHTMLTreeBuilder::tableCellCreateErrorCheck); + mapTagToFunc(gFunctionMap, tbodyTag, &LegacyHTMLTreeBuilder::tableSectionCreateErrorCheck); + mapTagToFunc(gFunctionMap, tfootTag, &LegacyHTMLTreeBuilder::tableSectionCreateErrorCheck); + mapTagToFunc(gFunctionMap, theadTag, &LegacyHTMLTreeBuilder::tableSectionCreateErrorCheck); + + gFunctionMap.set(commentAtom.impl(), &LegacyHTMLTreeBuilder::commentCreateErrorCheck); + gFunctionMap.set(textAtom.impl(), &LegacyHTMLTreeBuilder::textCreateErrorCheck); } bool proceed = true; @@ -989,7 +989,7 @@ PassRefPtr<Node> LegacyHTMLTreeConstructor::getNode(Token* t) return result.release(); } -bool LegacyHTMLTreeConstructor::allowNestedRedundantTag(const AtomicString& tagName) +bool LegacyHTMLTreeBuilder::allowNestedRedundantTag(const AtomicString& tagName) { // www.liceo.edu.mx is an example of a site that achieves a level of nesting of // about 1500 tags, all from a bunch of <b>s. We will only allow at most 20 @@ -1001,7 +1001,7 @@ bool LegacyHTMLTreeConstructor::allowNestedRedundantTag(const AtomicString& tagN return i != cMaxRedundantTagDepth; } -void LegacyHTMLTreeConstructor::processCloseTag(Token* t) +void LegacyHTMLTreeBuilder::processCloseTag(Token* t) { // Support for really broken html. // we never close the body tag, since some stupid web pages close it before the actual end of the doc. @@ -1031,7 +1031,7 @@ void LegacyHTMLTreeConstructor::processCloseTag(Token* t) } } -bool LegacyHTMLTreeConstructor::isHeadingTag(const AtomicString& tagName) +bool LegacyHTMLTreeBuilder::isHeadingTag(const AtomicString& tagName) { DEFINE_STATIC_LOCAL(TagNameSet, headingTags, ()); if (headingTags.isEmpty()) { @@ -1041,7 +1041,7 @@ bool LegacyHTMLTreeConstructor::isHeadingTag(const AtomicString& tagName) return headingTags.contains(tagName.impl()); } -bool LegacyHTMLTreeConstructor::isInline(Node* node) const +bool LegacyHTMLTreeBuilder::isInline(Node* node) const { if (node->isTextNode()) return true; @@ -1071,7 +1071,7 @@ bool LegacyHTMLTreeConstructor::isInline(Node* node) const return false; } -bool LegacyHTMLTreeConstructor::isResidualStyleTag(const AtomicString& tagName) +bool LegacyHTMLTreeBuilder::isResidualStyleTag(const AtomicString& tagName) { DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, residualStyleTags, ()); if (residualStyleTags.isEmpty()) { @@ -1083,7 +1083,7 @@ bool LegacyHTMLTreeConstructor::isResidualStyleTag(const AtomicString& tagName) return residualStyleTags.contains(tagName.impl()); } -bool LegacyHTMLTreeConstructor::isAffectedByResidualStyle(const AtomicString& tagName) +bool LegacyHTMLTreeBuilder::isAffectedByResidualStyle(const AtomicString& tagName) { DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, unaffectedTags, ()); if (unaffectedTags.isEmpty()) { @@ -1095,7 +1095,7 @@ bool LegacyHTMLTreeConstructor::isAffectedByResidualStyle(const AtomicString& ta return !unaffectedTags.contains(tagName.impl()); } -void LegacyHTMLTreeConstructor::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) +void LegacyHTMLTreeBuilder::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) { HTMLStackElem* maxElem = 0; bool finished = false; @@ -1326,7 +1326,7 @@ void LegacyHTMLTreeConstructor::handleResidualStyleCloseTagAcrossBlocks(HTMLStac m_handlingResidualStyleAcrossBlocks = false; } -void LegacyHTMLTreeConstructor::reopenResidualStyleTags(HTMLStackElem* elem, Node* malformedTableParent) +void LegacyHTMLTreeBuilder::reopenResidualStyleTags(HTMLStackElem* elem, Node* malformedTableParent) { // Loop for each tag that needs to be reopened. while (elem) { @@ -1367,7 +1367,7 @@ void LegacyHTMLTreeConstructor::reopenResidualStyleTags(HTMLStackElem* elem, Nod } } -void LegacyHTMLTreeConstructor::pushBlock(const AtomicString& tagName, int level) +void LegacyHTMLTreeBuilder::pushBlock(const AtomicString& tagName, int level) { m_blockStack = new HTMLStackElem(tagName, level, m_current, m_didRefCurrent, m_blockStack); if (level >= minBlockLevelTagPriority) @@ -1380,7 +1380,7 @@ void LegacyHTMLTreeConstructor::pushBlock(const AtomicString& tagName, int level m_hasPElementInScope = NotInScope; } -void LegacyHTMLTreeConstructor::popBlock(const AtomicString& tagName, bool reportErrors) +void LegacyHTMLTreeBuilder::popBlock(const AtomicString& tagName, bool reportErrors) { HTMLStackElem* elem = m_blockStack; @@ -1469,7 +1469,7 @@ void LegacyHTMLTreeConstructor::popBlock(const AtomicString& tagName, bool repor reopenResidualStyleTags(residualStyleStack, malformedTableParent); } -inline HTMLStackElem* LegacyHTMLTreeConstructor::popOneBlockCommon() +inline HTMLStackElem* LegacyHTMLTreeBuilder::popOneBlockCommon() { HTMLStackElem* elem = m_blockStack; @@ -1498,7 +1498,7 @@ inline HTMLStackElem* LegacyHTMLTreeConstructor::popOneBlockCommon() return elem; } -void LegacyHTMLTreeConstructor::popOneBlock() +void LegacyHTMLTreeBuilder::popOneBlock() { // Store the current node before popOneBlockCommon overwrites it. Node* lastCurrent = m_current; @@ -1510,7 +1510,7 @@ void LegacyHTMLTreeConstructor::popOneBlock() lastCurrent->deref(); } -void LegacyHTMLTreeConstructor::moveOneBlockToStack(HTMLStackElem*& head) +void LegacyHTMLTreeBuilder::moveOneBlockToStack(HTMLStackElem*& head) { // We'll be using the stack element we're popping, but for the current node. // See the two callers for details. @@ -1532,7 +1532,7 @@ void LegacyHTMLTreeConstructor::moveOneBlockToStack(HTMLStackElem*& head) head = elem; } -void LegacyHTMLTreeConstructor::checkIfHasPElementInScope() +void LegacyHTMLTreeBuilder::checkIfHasPElementInScope() { m_hasPElementInScope = NotInScope; HTMLStackElem* elem = m_blockStack; @@ -1547,13 +1547,13 @@ void LegacyHTMLTreeConstructor::checkIfHasPElementInScope() } } -void LegacyHTMLTreeConstructor::popInlineBlocks() +void LegacyHTMLTreeBuilder::popInlineBlocks() { while (m_blockStack && isInline(m_current)) popOneBlock(); } -void LegacyHTMLTreeConstructor::freeBlock() +void LegacyHTMLTreeBuilder::freeBlock() { while (m_blockStack) popOneBlock(); @@ -1561,7 +1561,7 @@ void LegacyHTMLTreeConstructor::freeBlock() ASSERT(!m_treeDepth); } -void LegacyHTMLTreeConstructor::createHead() +void LegacyHTMLTreeBuilder::createHead() { if (m_head) return; @@ -1589,7 +1589,7 @@ void LegacyHTMLTreeConstructor::createHead() } } -PassRefPtr<Node> LegacyHTMLTreeConstructor::handleIsindex(Token* t) +PassRefPtr<Node> LegacyHTMLTreeBuilder::handleIsindex(Token* t) { RefPtr<Node> n = HTMLDivElement::create(m_document); @@ -1614,7 +1614,7 @@ PassRefPtr<Node> LegacyHTMLTreeConstructor::handleIsindex(Token* t) return n.release(); } -void LegacyHTMLTreeConstructor::startBody() +void LegacyHTMLTreeBuilder::startBody() { if (m_inBody) return; @@ -1627,7 +1627,7 @@ void LegacyHTMLTreeConstructor::startBody() } } -void LegacyHTMLTreeConstructor::finished() +void LegacyHTMLTreeBuilder::finished() { // In the case of a completely empty document, here's the place to create the HTML element. if (m_current && m_current->isDocumentNode() && !m_document->documentElement()) @@ -1642,14 +1642,13 @@ void LegacyHTMLTreeConstructor::finished() m_document->finishedParsing(); } -void LegacyHTMLTreeConstructor::reportErrorToConsole(HTMLParserErrorCode errorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags) +void LegacyHTMLTreeBuilder::reportErrorToConsole(HTMLParserErrorCode errorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags) { Frame* frame = m_document->frame(); if (!frame) return; - HTMLDocumentParser* htmlTokenizer = static_cast<HTMLDocumentParser*>(m_document->parser()); - int lineNumber = htmlTokenizer->lineNumber() + 1; + int lineNumber = m_document->parser()->lineNumber() + 1; AtomicString tag1; AtomicString tag2; @@ -1673,9 +1672,11 @@ void LegacyHTMLTreeConstructor::reportErrorToConsole(HTMLParserErrorCode errorCo const char* errorMsg = htmlParserErrorMessageTemplate(errorCode); if (!errorMsg) return; - + String message; - if (htmlTokenizer->processingContentWrittenByScript()) + // FIXME: This doesn't work for the new HTMLDocumentParser and should. + LegacyHTMLDocumentParser* htmlParser = m_document->parser()->asHTMLDocumentParser(); + if (htmlParser && htmlParser->processingContentWrittenByScript()) message += htmlParserDocumentWriteMessage(); message += errorMsg; message.replace("%tag1", tag1); diff --git a/WebCore/html/LegacyHTMLTreeConstructor.h b/WebCore/html/LegacyHTMLTreeBuilder.h index ab1f5aa..cfd9519 100644 --- a/WebCore/html/LegacyHTMLTreeConstructor.h +++ b/WebCore/html/LegacyHTMLTreeBuilder.h @@ -21,11 +21,11 @@ Boston, MA 02110-1301, USA. */ -#ifndef HTMLParser_h -#define HTMLParser_h +#ifndef LegacyHTMLTreeBuilder_h +#define LegacyHTMLTreeBuilder_h +#include "FragmentScriptingPermission.h" #include "HTMLParserErrorCodes.h" -#include "MappedAttributeEntry.h" #include "QualifiedName.h" #include <wtf/Forward.h> #include <wtf/OwnPtr.h> @@ -47,14 +47,14 @@ struct HTMLStackElem; struct Token; /** - * The parser for HTML. It receives a stream of tokens from the HTMLDocumentParser, and + * The parser for HTML. It receives a stream of tokens from the LegacyHTMLDocumentParser, and * builds up the Document structure from it. */ -class LegacyHTMLTreeConstructor : public Noncopyable { +class LegacyHTMLTreeBuilder : public Noncopyable { public: - LegacyHTMLTreeConstructor(HTMLDocument*, bool reportErrors); - LegacyHTMLTreeConstructor(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); - virtual ~LegacyHTMLTreeConstructor(); + LegacyHTMLTreeBuilder(HTMLDocument*, bool reportErrors); + LegacyHTMLTreeBuilder(DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); + virtual ~LegacyHTMLTreeBuilder(); /** * parses one token delivered by the tokenizer @@ -211,4 +211,4 @@ String serializeForNumberType(double); } -#endif // HTMLParser_h +#endif // LegacyHTMLTreeBuilder_h diff --git a/WebCore/html/PreloadScanner.cpp b/WebCore/html/LegacyPreloadScanner.cpp index d39092a..c9fda4f 100644 --- a/WebCore/html/PreloadScanner.cpp +++ b/WebCore/html/LegacyPreloadScanner.cpp @@ -25,7 +25,7 @@ */ #include "config.h" -#include "PreloadScanner.h" +#include "LegacyPreloadScanner.h" #include "AtomicString.h" #include "CachedCSSStyleSheet.h" @@ -65,7 +65,7 @@ namespace WebCore { using namespace HTMLNames; -PreloadScanner::PreloadScanner(Document* doc) +LegacyPreloadScanner::LegacyPreloadScanner(Document* doc) : m_inProgress(false) , m_timeUsed(0) , m_bodySeen(false) @@ -76,7 +76,7 @@ PreloadScanner::PreloadScanner(Document* doc) #endif } -PreloadScanner::~PreloadScanner() +LegacyPreloadScanner::~LegacyPreloadScanner() { #if PRELOAD_DEBUG printf("DELETING PRELOAD SCANNER FOR %s\n", m_document->url().string().latin1().data()); @@ -84,20 +84,20 @@ PreloadScanner::~PreloadScanner() #endif } -void PreloadScanner::begin() +void LegacyPreloadScanner::begin() { ASSERT(!m_inProgress); reset(); m_inProgress = true; } -void PreloadScanner::end() +void LegacyPreloadScanner::end() { ASSERT(m_inProgress); m_inProgress = false; } -void PreloadScanner::reset() +void LegacyPreloadScanner::reset() { m_source.clear(); @@ -123,12 +123,12 @@ void PreloadScanner::reset() m_cssRuleValue.clear(); } -bool PreloadScanner::scanningBody() const +bool LegacyPreloadScanner::scanningBody() const { return m_document->body() || m_bodySeen; } -void PreloadScanner::write(const SegmentedString& source) +void LegacyPreloadScanner::write(const SegmentedString& source) { #if PRELOAD_DEBUG double startTime = currentTime(); @@ -144,18 +144,18 @@ static inline bool isWhitespace(UChar c) return c == ' ' || c == '\n' || c == '\r' || c == '\t'; } -inline void PreloadScanner::clearLastCharacters() +inline void LegacyPreloadScanner::clearLastCharacters() { memset(m_lastCharacters, 0, lastCharactersBufferSize * sizeof(UChar)); } -inline void PreloadScanner::rememberCharacter(UChar c) +inline void LegacyPreloadScanner::rememberCharacter(UChar c) { m_lastCharacterIndex = (m_lastCharacterIndex + 1) % lastCharactersBufferSize; m_lastCharacters[m_lastCharacterIndex] = c; } -inline bool PreloadScanner::lastCharactersMatch(const char* chars, unsigned count) const +inline bool LegacyPreloadScanner::lastCharactersMatch(const char* chars, unsigned count) const { unsigned pos = m_lastCharacterIndex; while (count) { @@ -177,7 +177,7 @@ static inline unsigned legalEntityFor(unsigned value) return value; } -unsigned PreloadScanner::consumeEntity(SegmentedString& source, bool& notEnoughCharacters) +unsigned LegacyPreloadScanner::consumeEntity(SegmentedString& source, bool& notEnoughCharacters) { enum EntityState { Initial, @@ -295,7 +295,7 @@ outOfCharacters: return 0; } -void PreloadScanner::tokenize(const SegmentedString& source) +void LegacyPreloadScanner::tokenize(const SegmentedString& source) { ASSERT(m_inProgress); @@ -688,7 +688,7 @@ void PreloadScanner::tokenize(const SegmentedString& source) } } -void PreloadScanner::processAttribute() +void LegacyPreloadScanner::processAttribute() { AtomicString tag = AtomicString(m_tagName.data(), m_tagName.size()); AtomicString attribute = AtomicString(m_attributeName.data(), m_attributeName.size()); @@ -711,13 +711,13 @@ void PreloadScanner::processAttribute() } } -inline void PreloadScanner::emitCharacter(UChar c) +inline void LegacyPreloadScanner::emitCharacter(UChar c) { if (m_contentModel == CDATA && m_lastStartTag == styleTag) tokenizeCSS(c); } -inline void PreloadScanner::tokenizeCSS(UChar c) +inline void LegacyPreloadScanner::tokenizeCSS(UChar c) { // We are just interested in @import rules, no need for real tokenization here // Searching for other types of resources is probably low payoff @@ -796,7 +796,7 @@ inline void PreloadScanner::tokenizeCSS(UChar c) } } -void PreloadScanner::emitTag() +void LegacyPreloadScanner::emitTag() { if (m_closeTag) { m_contentModel = PCDATA; @@ -840,7 +840,7 @@ void PreloadScanner::emitTag() m_linkIsStyleSheet = false; } -void PreloadScanner::emitCSSRule() +void LegacyPreloadScanner::emitCSSRule() { String rule(m_cssRule.data(), m_cssRule.size()); if (equalIgnoringCase(rule, "import") && !m_cssRuleValue.isEmpty()) { diff --git a/WebCore/html/PreloadScanner.h b/WebCore/html/LegacyPreloadScanner.h index 6022ee7..95710ab 100644 --- a/WebCore/html/PreloadScanner.h +++ b/WebCore/html/LegacyPreloadScanner.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PreloadScanner_h -#define PreloadScanner_h +#ifndef LegacyPreloadScanner_h +#define LegacyPreloadScanner_h #include "AtomicString.h" #include "SegmentedString.h" @@ -37,10 +37,10 @@ namespace WebCore { class CachedResourceClient; class Document; - class PreloadScanner : public Noncopyable { + class LegacyPreloadScanner : public Noncopyable { public: - PreloadScanner(Document*); - ~PreloadScanner(); + LegacyPreloadScanner(Document*); + ~LegacyPreloadScanner(); void begin(); void write(const SegmentedString&); void end(); diff --git a/WebCore/html/StepRange.cpp b/WebCore/html/StepRange.cpp index 3923abe..9afde1b 100644 --- a/WebCore/html/StepRange.cpp +++ b/WebCore/html/StepRange.cpp @@ -23,7 +23,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "PlatformString.h" #include <wtf/MathExtras.h> diff --git a/WebCore/html/ValidityState.cpp b/WebCore/html/ValidityState.cpp index 7f6b8be..6a159e8 100644 --- a/WebCore/html/ValidityState.cpp +++ b/WebCore/html/ValidityState.cpp @@ -26,7 +26,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "KURL.h" #include "LocalizedStrings.h" #include "RegularExpression.h" diff --git a/WebCore/html/canvas/ArrayBuffer.idl b/WebCore/html/canvas/ArrayBuffer.idl index 3165494..92098e5 100644 --- a/WebCore/html/canvas/ArrayBuffer.idl +++ b/WebCore/html/canvas/ArrayBuffer.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,7 +24,14 @@ */ module html { - interface [Conditional=3D_CANVAS, CustomConstructor] ArrayBuffer { + + interface [ + Conditional=3D_CANVAS, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor + ] ArrayBuffer { readonly attribute int byteLength; }; + } diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 8531bd5..522e51d 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -929,7 +929,7 @@ void CanvasRenderingContext2D::applyShadow() float width = state().m_shadowOffset.width(); float height = state().m_shadowOffset.height(); - c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace); + c->setShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, DeviceColorSpace); } static IntSize size(HTMLImageElement* image) diff --git a/WebCore/html/canvas/Float32Array.idl b/WebCore/html/canvas/Float32Array.idl index 91a9f4e..651e74f 100644 --- a/WebCore/html/canvas/Float32Array.idl +++ b/WebCore/html/canvas/Float32Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2010 Apple Computer, Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,10 +27,12 @@ module html { interface [ Conditional=3D_CANVAS, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, - CustomConstructor, CustomToJS ] Float32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/WebCore/html/canvas/Int16Array.idl b/WebCore/html/canvas/Int16Array.idl index 95c8204..095611b 100644 --- a/WebCore/html/canvas/Int16Array.idl +++ b/WebCore/html/canvas/Int16Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2010 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,10 +26,12 @@ module html { interface [ Conditional=3D_CANVAS, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, - CustomConstructor, CustomToJS ] Int16Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 2; diff --git a/WebCore/html/canvas/Int32Array.idl b/WebCore/html/canvas/Int32Array.idl index 9c9a50f..9d1e8ee 100644 --- a/WebCore/html/canvas/Int32Array.idl +++ b/WebCore/html/canvas/Int32Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,10 +27,12 @@ module html { interface [ Conditional=3D_CANVAS, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, - CustomConstructor, CustomToJS ] Int32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/WebCore/html/canvas/Int8Array.idl b/WebCore/html/canvas/Int8Array.idl index 9aefd34..43c83f5 100644 --- a/WebCore/html/canvas/Int8Array.idl +++ b/WebCore/html/canvas/Int8Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,10 +27,12 @@ module html { interface [ Conditional=3D_CANVAS, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, - CustomConstructor, CustomToJS ] Int8Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/WebCore/html/canvas/TypedArrayBase.h b/WebCore/html/canvas/TypedArrayBase.h index 06d7ed5..a8bebd9 100644 --- a/WebCore/html/canvas/TypedArrayBase.h +++ b/WebCore/html/canvas/TypedArrayBase.h @@ -61,6 +61,8 @@ class TypedArrayBase : public ArrayBufferView { static PassRefPtr<Subclass> create(unsigned length) { RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(T)); + if (!buffer.get()) + return 0; return create<Subclass>(buffer, 0, length); } @@ -68,8 +70,9 @@ class TypedArrayBase : public ArrayBufferView { static PassRefPtr<Subclass> create(T* array, unsigned length) { RefPtr<Subclass> a = create<Subclass>(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); + if (a) + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); return a; } diff --git a/WebCore/html/canvas/Uint16Array.idl b/WebCore/html/canvas/Uint16Array.idl index baba0d9..4c369a0 100644 --- a/WebCore/html/canvas/Uint16Array.idl +++ b/WebCore/html/canvas/Uint16Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,9 @@ module html { interface [ Conditional=3D_CANVAS, - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, diff --git a/WebCore/html/canvas/Uint32Array.idl b/WebCore/html/canvas/Uint32Array.idl index b7573e6..25f5b71 100644 --- a/WebCore/html/canvas/Uint32Array.idl +++ b/WebCore/html/canvas/Uint32Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,9 @@ module html { interface [ Conditional=3D_CANVAS, - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, diff --git a/WebCore/html/canvas/Uint8Array.idl b/WebCore/html/canvas/Uint8Array.idl index ea4c0f5..76b8cdd 100644 --- a/WebCore/html/canvas/Uint8Array.idl +++ b/WebCore/html/canvas/Uint8Array.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,10 +27,12 @@ module html { interface [ Conditional=3D_CANVAS, + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor, HasNumericIndexGetter, HasCustomIndexSetter, GenerateNativeConverter, - CustomConstructor, CustomToJS ] Uint8Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/WebCore/html/canvas/WebGLBuffer.cpp b/WebCore/html/canvas/WebGLBuffer.cpp index 192967e..8790b1a 100644 --- a/WebCore/html/canvas/WebGLBuffer.cpp +++ b/WebCore/html/canvas/WebGLBuffer.cpp @@ -37,11 +37,6 @@ PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx) return adoptRef(new WebGLBuffer(ctx)); } -PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx, Platform3DObject obj) -{ - return adoptRef(new WebGLBuffer(ctx, obj)); -} - WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx) : CanvasObject(ctx) , m_elementArrayBufferByteLength(0) @@ -52,14 +47,6 @@ WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx) clearCachedMaxIndices(); } -WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx, Platform3DObject obj) - : CanvasObject(ctx) - , m_nextAvailableCacheEntry(0) -{ - setObject(obj, false); - clearCachedMaxIndices(); -} - void WebGLBuffer::_deleteObject(Platform3DObject object) { context()->graphicsContext3D()->deleteBuffer(object); diff --git a/WebCore/html/canvas/WebGLBuffer.h b/WebCore/html/canvas/WebGLBuffer.h index feaadbb..bd9f190 100644 --- a/WebCore/html/canvas/WebGLBuffer.h +++ b/WebCore/html/canvas/WebGLBuffer.h @@ -39,10 +39,6 @@ namespace WebCore { virtual ~WebGLBuffer() { deleteObject(); } static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*); - - // For querying previously created objects via e.g. getFramebufferAttachmentParameter - // FIXME: should consider canonicalizing these objects - static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*, Platform3DObject); bool associateBufferData(unsigned long target, int size); bool associateBufferData(unsigned long target, ArrayBufferView* array); @@ -59,8 +55,7 @@ namespace WebCore { protected: WebGLBuffer(WebGLRenderingContext*); - WebGLBuffer(WebGLRenderingContext*, Platform3DObject obj); - + virtual void _deleteObject(Platform3DObject o); private: diff --git a/WebCore/html/canvas/WebGLFramebuffer.cpp b/WebCore/html/canvas/WebGLFramebuffer.cpp index db88b1c..a3d4681 100644 --- a/WebCore/html/canvas/WebGLFramebuffer.cpp +++ b/WebCore/html/canvas/WebGLFramebuffer.cpp @@ -91,7 +91,7 @@ unsigned long WebGLFramebuffer::getColorBufferFormat() { if (object() && m_colorAttachment && m_colorAttachment->object()) { if (m_colorAttachment->isRenderbuffer()) { - unsigned long format = (reinterpret_cast<WebGLRenderbuffer*>(m_colorAttachment))->getInternalformat(); + unsigned long format = (reinterpret_cast<WebGLRenderbuffer*>(m_colorAttachment))->getInternalFormat(); switch (format) { case GraphicsContext3D::RGBA4: case GraphicsContext3D::RGB5_A1: @@ -100,7 +100,7 @@ unsigned long WebGLFramebuffer::getColorBufferFormat() return GraphicsContext3D::RGB; } } else if (m_colorAttachment->isTexture()) - return (reinterpret_cast<WebGLTexture*>(m_colorAttachment))->getInternalformat(); + return (reinterpret_cast<WebGLTexture*>(m_colorAttachment))->getInternalFormat(); } return 0; } diff --git a/WebCore/html/canvas/WebGLRenderbuffer.cpp b/WebCore/html/canvas/WebGLRenderbuffer.cpp index 8d23b33..701e2c9 100644 --- a/WebCore/html/canvas/WebGLRenderbuffer.cpp +++ b/WebCore/html/canvas/WebGLRenderbuffer.cpp @@ -39,7 +39,7 @@ PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* c WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx) : CanvasObject(ctx) - , m_internalformat(GraphicsContext3D::RGBA4) + , m_internalFormat(GraphicsContext3D::RGBA4) , m_initialized(false) { setObject(context()->graphicsContext3D()->createRenderbuffer()); diff --git a/WebCore/html/canvas/WebGLRenderbuffer.h b/WebCore/html/canvas/WebGLRenderbuffer.h index 4b6fc3e..dbb08c1 100644 --- a/WebCore/html/canvas/WebGLRenderbuffer.h +++ b/WebCore/html/canvas/WebGLRenderbuffer.h @@ -39,8 +39,8 @@ namespace WebCore { static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*); - void setInternalformat(unsigned long internalformat) { m_internalformat = internalformat; } - unsigned long getInternalformat() const { return m_internalformat; } + void setInternalFormat(unsigned long internalformat) { m_internalFormat = internalformat; } + unsigned long getInternalFormat() const { return m_internalFormat; } bool isInitialized() const { return m_initialized; } void setInitialized() { m_initialized = true; } @@ -53,7 +53,7 @@ namespace WebCore { private: virtual bool isRenderbuffer() const { return true; } - unsigned long m_internalformat; + unsigned long m_internalFormat; bool m_initialized; }; diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp index 82a0f8f..2124506 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -52,7 +52,6 @@ #include "WebGLUniformLocation.h" #include <wtf/ByteArray.h> -#include <wtf/MathExtras.h> namespace WebCore { @@ -399,6 +398,14 @@ void WebGLRenderingContext::bufferSubData(unsigned long target, long offset, Arr unsigned long WebGLRenderingContext::checkFramebufferStatus(unsigned long target) { + if (!isGLES2Compliant()) { + if (target != GraphicsContext3D::FRAMEBUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return 0; + } + } + if (!m_framebufferBinding || !m_framebufferBinding->object()) + return GraphicsContext3D::FRAMEBUFFER_COMPLETE; return m_context->checkFramebufferStatus(target); cleanupAfterGraphicsCall(false); } @@ -456,7 +463,7 @@ void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, uns return; if (!isGLES2Compliant()) { if (m_framebufferBinding && m_framebufferBinding->object() - && !isTexInternalformatColorBufferCombinationValid(internalformat, + && !isTexInternalFormatColorBufferCombinationValid(internalformat, m_framebufferBinding->getColorBufferFormat())) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; @@ -473,7 +480,7 @@ void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, uns if (tex && !level) // only for level 0 tex->setSize(target, width, height); if (tex) - tex->setInternalformat(internalformat); + tex->setInternalFormat(internalformat); } if (m_framebufferBinding && tex) m_framebufferBinding->onAttachedObjectChange(tex); @@ -485,7 +492,7 @@ void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, if (!isGLES2Compliant()) { WebGLTexture* tex = getTextureBinding(target); if (m_framebufferBinding && m_framebufferBinding->object() && tex - && !isTexInternalformatColorBufferCombinationValid(tex->getInternalformat(), + && !isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(), m_framebufferBinding->getColorBufferFormat())) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; @@ -908,10 +915,16 @@ void WebGLRenderingContext::flush() void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer* buffer, ExceptionCode& ec) { UNUSED_PARAM(ec); + if (!validateFramebufferFuncParameters(target, attachment)) + return; + if (renderbuffertarget != GraphicsContext3D::RENDERBUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } if (buffer && buffer->context() != this) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; - } + } // Don't allow the default framebuffer to be mutated; all current // implementations use an FBO internally in place of the default // FBO. @@ -925,19 +938,19 @@ void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsign case GraphicsContext3D::DEPTH_ATTACHMENT: if (m_framebufferBinding->isDepthStencilAttached() || m_framebufferBinding->isStencilAttached()) isConflicted = true; - if (buffer->getInternalformat() != GraphicsContext3D::DEPTH_COMPONENT16) + if (buffer->getInternalFormat() != GraphicsContext3D::DEPTH_COMPONENT16) isConflicted = true; break; case GraphicsContext3D::STENCIL_ATTACHMENT: if (m_framebufferBinding->isDepthStencilAttached() || m_framebufferBinding->isDepthAttached()) isConflicted = true; - if (buffer->getInternalformat() != GraphicsContext3D::STENCIL_INDEX8) + if (buffer->getInternalFormat() != GraphicsContext3D::STENCIL_INDEX8) isConflicted = true; break; case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: if (m_framebufferBinding->isDepthAttached() || m_framebufferBinding->isStencilAttached()) isConflicted = true; - if (buffer->getInternalformat() != GraphicsContext3D::DEPTH_STENCIL) + if (buffer->getInternalFormat() != GraphicsContext3D::DEPTH_STENCIL) isConflicted = true; break; } @@ -954,6 +967,12 @@ void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsign void WebGLRenderingContext::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture* texture, long level, ExceptionCode& ec) { UNUSED_PARAM(ec); + if (!validateFramebufferFuncParameters(target, attachment)) + return; + if (level) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } if (texture && texture->context() != this) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; @@ -1063,19 +1082,24 @@ unsigned long WebGLRenderingContext::getError() WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (target != GraphicsContext3D::FRAMEBUFFER - || (attachment != GraphicsContext3D::COLOR_ATTACHMENT0 - && attachment != GraphicsContext3D::DEPTH_ATTACHMENT - && attachment != GraphicsContext3D::STENCIL_ATTACHMENT - && attachment != GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT) - || (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE - && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME - && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL - && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE)) { + if (!validateFramebufferFuncParameters(target, attachment)) + return WebGLGetInfo(); + switch (pname) { + case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: + case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: + case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: + case GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: + break; + default: m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return WebGLGetInfo(); } + if (!m_framebufferBinding || !m_framebufferBinding->object()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return WebGLGetInfo(); + } + if (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) { WebGLStateRestorer(this, false); int value; @@ -1092,9 +1116,9 @@ WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(unsigned l m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &value); switch (type) { case GraphicsContext3D::RENDERBUFFER: - return WebGLGetInfo(findRenderbuffer(static_cast<Platform3DObject>(value))); + return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(findRenderbuffer(static_cast<Platform3DObject>(value)))); case GraphicsContext3D::TEXTURE: - return WebGLGetInfo(findTexture(static_cast<Platform3DObject>(value))); + return WebGLGetInfo(PassRefPtr<WebGLTexture>(findTexture(static_cast<Platform3DObject>(value)))); default: // FIXME: raise exception? return WebGLGetInfo(); @@ -1347,7 +1371,7 @@ WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(unsigned long targe m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return WebGLGetInfo(); } - return WebGLGetInfo(m_renderbufferBinding->getInternalformat()); + return WebGLGetInfo(m_renderbufferBinding->getInternalFormat()); default: m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return WebGLGetInfo(); @@ -1577,11 +1601,7 @@ WebGLGetInfo WebGLRenderingContext::getVertexAttrib(unsigned long index, unsigne case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: { int name = 0; m_context->getVertexAttribiv(index, pname, &name); - if (name == 0) - return WebGLGetInfo(); - RefPtr<WebGLBuffer> tmp = WebGLBuffer::create(this, name); - addObject(tmp.get()); - return WebGLGetInfo(PassRefPtr<WebGLBuffer>(tmp)); + return WebGLGetInfo(PassRefPtr<WebGLBuffer>(findBuffer(static_cast<Platform3DObject>(name)))); } case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_ENABLED: case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_NORMALIZED: { @@ -1725,33 +1745,8 @@ void WebGLRenderingContext::polygonOffset(double factor, double units) void WebGLRenderingContext::readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels) { // Validate input parameters. - unsigned long componentsPerPixel = 0; - switch (format) { - case GraphicsContext3D::ALPHA: - componentsPerPixel = 1; - break; - case GraphicsContext3D::RGB: - componentsPerPixel = 3; - break; - case GraphicsContext3D::RGBA: - componentsPerPixel = 4; - break; - default: - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); - return; - } - unsigned long bytesPerComponent = 0; - switch (type) { - case GraphicsContext3D::UNSIGNED_BYTE: - bytesPerComponent = sizeof(unsigned char); - break; - case GraphicsContext3D::UNSIGNED_SHORT_5_6_5: - case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4: - case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: - componentsPerPixel = 1; - bytesPerComponent = sizeof(unsigned short); - break; - default: + unsigned long componentsPerPixel, bytesPerComponent; + if (!m_context->computeFormatAndTypeParameters(format, type, &componentsPerPixel, &bytesPerComponent)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return; } @@ -1827,7 +1822,7 @@ void WebGLRenderingContext::renderbufferStorage(unsigned long target, unsigned l case GraphicsContext3D::DEPTH_STENCIL: m_context->renderbufferStorage(target, internalformat, width, height); if (m_renderbufferBinding) { - m_renderbufferBinding->setInternalformat(internalformat); + m_renderbufferBinding->setInternalFormat(internalformat); if (m_framebufferBinding) m_framebufferBinding->onAttachedObjectChange(m_renderbufferBinding.get()); } @@ -1916,7 +1911,7 @@ void WebGLRenderingContext::texImage2DBase(unsigned target, unsigned level, unsi if (tex && !level) // only for level 0 tex->setSize(target, width, height); if (tex) - tex->setInternalformat(internalformat); + tex->setInternalFormat(internalformat); } if (m_framebufferBinding && tex) m_framebufferBinding->onAttachedObjectChange(tex); @@ -1927,17 +1922,18 @@ void WebGLRenderingContext::texImage2DImpl(unsigned target, unsigned level, unsi unsigned format, unsigned type, Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { - // FIXME: pay attention to the user's supplied internalformat, format and type - // FIXME: pay attention to UNPACK_ROW_WIDTH - UNUSED_PARAM(type); ec = 0; Vector<uint8_t> data; - if (!m_context->extractImageData(image, flipY, premultiplyAlpha, data, &format, &internalformat)) { + if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + if (m_unpackAlignment != 1) + m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1); texImage2DBase(target, level, internalformat, image->width(), image->height(), 0, - format, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); + format, type, data.data(), ec); + if (m_unpackAlignment != 1) + m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, @@ -1952,18 +1948,18 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned format, unsigned type, ImageData* pixels, ExceptionCode& ec) { - UNUSED_PARAM(internalformat); - UNUSED_PARAM(format); - UNUSED_PARAM(type); - // FIXME: pay attention to the user's supplied internalformat, format and type ec = 0; Vector<uint8_t> data; - if (!m_context->extractImageData(pixels, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { + if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texImage2DBase(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, - GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); + if (m_unpackAlignment != 1) + m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1); + texImage2DBase(target, level, internalformat, pixels->width(), pixels->height(), 0, + format, type, data.data(), ec); + if (m_unpackAlignment != 1) + m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, @@ -2027,7 +2023,7 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageDat printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, ImageData pixels, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; Vector<uint8_t> data; - if (!m_context->extractImageData(pixels, flipY, premultiplyAlpha, data)) { + if (!m_context->extractImageData(pixels, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, premultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } @@ -2186,18 +2182,14 @@ void WebGLRenderingContext::texSubImage2DImpl(unsigned target, unsigned level, u unsigned format, unsigned type, Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { - UNUSED_PARAM(type); - // FIXME: pay attention to the user's supplied format and type - // FIXME: pay attention to UNPACK_ROW_WIDTH ec = 0; Vector<uint8_t> data; - unsigned int internalformat; - if (!m_context->extractImageData(image, flipY, premultiplyAlpha, data, &format, &internalformat)) { + if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } texSubImage2DBase(target, level, xoffset, yoffset, image->width(), image->height(), - format, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); + format, type, data.data(), ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, @@ -2211,17 +2203,14 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned format, unsigned type, ImageData* pixels, ExceptionCode& ec) { - UNUSED_PARAM(format); - UNUSED_PARAM(type); - // FIXME: pay attention to the user's supplied format and type ec = 0; Vector<uint8_t> data; - if (!m_context->extractImageData(pixels, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { + if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), - GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); + format, type, data.data(), ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, @@ -2285,7 +2274,7 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ImageData pixels, GLboolean flipY, GLboolean premultiplyAlpha)"); ec = 0; Vector<uint8_t> data; - if (!m_context->extractImageData(pixels, flipY, premultiplyAlpha, data)) { + if (!m_context->extractImageData(pixels, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, premultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } @@ -3116,26 +3105,38 @@ void WebGLRenderingContext::detachAndRemoveAllObjects() m_canvasObjects.clear(); } -PassRefPtr<WebGLTexture> WebGLRenderingContext::findTexture(Platform3DObject obj) +WebGLTexture* WebGLRenderingContext::findTexture(Platform3DObject obj) { + if (!obj) + return 0; HashSet<RefPtr<CanvasObject> >::iterator pend = m_canvasObjects.end(); for (HashSet<RefPtr<CanvasObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it) { - if ((*it)->isTexture() && (*it)->object() == obj) { - RefPtr<WebGLTexture> tex = reinterpret_cast<WebGLTexture*>((*it).get()); - return tex.release(); - } + if ((*it)->isTexture() && (*it)->object() == obj) + return reinterpret_cast<WebGLTexture*>((*it).get()); } return 0; } -PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::findRenderbuffer(Platform3DObject obj) +WebGLRenderbuffer* WebGLRenderingContext::findRenderbuffer(Platform3DObject obj) { + if (!obj) + return 0; HashSet<RefPtr<CanvasObject> >::iterator pend = m_canvasObjects.end(); for (HashSet<RefPtr<CanvasObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it) { - if ((*it)->isRenderbuffer() && (*it)->object() == obj) { - RefPtr<WebGLRenderbuffer> buffer = reinterpret_cast<WebGLRenderbuffer*>((*it).get()); - return buffer.release(); - } + if ((*it)->isRenderbuffer() && (*it)->object() == obj) + return reinterpret_cast<WebGLRenderbuffer*>((*it).get()); + } + return 0; +} + +WebGLBuffer* WebGLRenderingContext::findBuffer(Platform3DObject obj) +{ + if (!obj) + return 0; + HashSet<RefPtr<CanvasObject> >::iterator pend = m_canvasObjects.end(); + for (HashSet<RefPtr<CanvasObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it) { + if ((*it)->isBuffer() && (*it)->object() == obj) + return reinterpret_cast<WebGLBuffer*>((*it).get()); } return 0; } @@ -3292,17 +3293,17 @@ void WebGLRenderingContext::createFallbackBlackTextures1x1() m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, 0); } -bool WebGLRenderingContext::isTexInternalformatColorBufferCombinationValid(unsigned long texInternalformat, +bool WebGLRenderingContext::isTexInternalFormatColorBufferCombinationValid(unsigned long texInternalFormat, unsigned long colorBufferFormat) { switch (colorBufferFormat) { case GraphicsContext3D::ALPHA: - if (texInternalformat == GraphicsContext3D::ALPHA) + if (texInternalFormat == GraphicsContext3D::ALPHA) return true; break; case GraphicsContext3D::RGB: - if (texInternalformat == GraphicsContext3D::LUMINANCE - || texInternalformat == GraphicsContext3D::RGB) + if (texInternalFormat == GraphicsContext3D::LUMINANCE + || texInternalFormat == GraphicsContext3D::RGB) return true; break; case GraphicsContext3D::RGBA: @@ -3357,6 +3358,35 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(unsigned long format, u return false; } + // Verify that the combination of format and type is supported. + switch (format) { + case GraphicsContext3D::ALPHA: + case GraphicsContext3D::LUMINANCE: + case GraphicsContext3D::LUMINANCE_ALPHA: + if (type != GraphicsContext3D::UNSIGNED_BYTE) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return false; + } + break; + case GraphicsContext3D::RGB: + if (type != GraphicsContext3D::UNSIGNED_BYTE + && type != GraphicsContext3D::UNSIGNED_SHORT_5_6_5) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return false; + } + break; + case GraphicsContext3D::RGBA: + if (type != GraphicsContext3D::UNSIGNED_BYTE + && type != GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4 + && type != GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return false; + } + break; + default: + ASSERT_NOT_REACHED(); + } + return true; } @@ -3365,6 +3395,12 @@ bool WebGLRenderingContext::validateTexFuncParameters(unsigned long target, long long width, long height, long border, unsigned long format, unsigned long type) { + // We absolutely have to validate the format and type combination. + // The texImage2D entry points taking HTMLImage, etc. will produce + // temporary data based on this combination, so it must be legal. + if (!validateTexFuncFormatAndType(format, type)) + return false; + if (isGLES2Compliant()) return true; @@ -3375,9 +3411,7 @@ bool WebGLRenderingContext::validateTexFuncParameters(unsigned long target, long switch (target) { case GraphicsContext3D::TEXTURE_2D: - if (width > m_maxTextureSize || - height > m_maxTextureSize || - level > log(static_cast<double>(m_maxTextureSize)) / log(2.0)) { + if (width > m_maxTextureSize || height > m_maxTextureSize) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return false; } @@ -3388,9 +3422,7 @@ bool WebGLRenderingContext::validateTexFuncParameters(unsigned long target, long case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: - if (width != height || - width > m_maxCubeMapTextureSize || - level > log(static_cast<double>(m_maxCubeMapTextureSize)) / log(2.0)) { + if (width != height || width > m_maxCubeMapTextureSize) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return false; } @@ -3410,7 +3442,7 @@ bool WebGLRenderingContext::validateTexFuncParameters(unsigned long target, long return false; } - return validateTexFuncFormatAndType(format, type); + return true; } bool WebGLRenderingContext::validateDrawMode(unsigned long mode) @@ -3436,6 +3468,25 @@ void WebGLRenderingContext::printWarningToConsole(const String& message) message, 0, canvas()->document()->url().string()); } +bool WebGLRenderingContext::validateFramebufferFuncParameters(unsigned long target, unsigned long attachment) +{ + if (target != GraphicsContext3D::FRAMEBUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return false; + } + switch (attachment) { + case GraphicsContext3D::COLOR_ATTACHMENT0: + case GraphicsContext3D::DEPTH_ATTACHMENT: + case GraphicsContext3D::STENCIL_ATTACHMENT: + case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: + break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return false; + } + return true; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index 552efa9..d05d60b 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -315,8 +315,9 @@ class WebKitCSSMatrix; void addObject(CanvasObject*); void detachAndRemoveAllObjects(); - PassRefPtr<WebGLTexture> findTexture(Platform3DObject); - PassRefPtr<WebGLRenderbuffer> findRenderbuffer(Platform3DObject); + WebGLTexture* findTexture(Platform3DObject); + WebGLRenderbuffer* findRenderbuffer(Platform3DObject); + WebGLBuffer* findBuffer(Platform3DObject); void markContextChanged(); void cleanupAfterGraphicsCall(bool changed) @@ -416,7 +417,7 @@ class WebKitCSSMatrix; // Helper function for copyTex{Sub}Image, check whether the internalformat // and the color buffer format of the current bound framebuffer combination // is valid. - bool isTexInternalformatColorBufferCombinationValid(unsigned long texInternalformat, + bool isTexInternalFormatColorBufferCombinationValid(unsigned long texInternalFormat, unsigned long colorBufferFormat); // Helper function to get the current bound texture. @@ -443,6 +444,10 @@ class WebKitCSSMatrix; // used only to warn about use of obsolete functions. void printWarningToConsole(const String& message); + // Helper function to validate input parameters for framebuffer functions. + // Generate GL error if parameters are illegal. + bool validateFramebufferFuncParameters(unsigned long target, unsigned long attachment); + friend class WebGLStateRestorer; }; diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp index d24405a..1cc7d5d 100644 --- a/WebCore/html/canvas/WebGLTexture.cpp +++ b/WebCore/html/canvas/WebGLTexture.cpp @@ -45,7 +45,7 @@ WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx) , m_magFilter(GraphicsContext3D::LINEAR) , m_wrapS(GraphicsContext3D::REPEAT) , m_wrapT(GraphicsContext3D::REPEAT) - , m_internalformat(0) + , m_internalFormat(0) , m_isNPOT(false) , m_needToUseBlackTexture(false) { diff --git a/WebCore/html/canvas/WebGLTexture.h b/WebCore/html/canvas/WebGLTexture.h index 889e902..4d16b59 100644 --- a/WebCore/html/canvas/WebGLTexture.h +++ b/WebCore/html/canvas/WebGLTexture.h @@ -52,8 +52,8 @@ namespace WebCore { void setParameterf(unsigned long pname, float param); void setSize(unsigned long target, unsigned width, unsigned height); - void setInternalformat(unsigned long internalformat) { m_internalformat = internalformat; } - unsigned long getInternalformat() const { return m_internalformat; } + void setInternalFormat(unsigned long internalformat) { m_internalFormat = internalformat; } + unsigned long getInternalFormat() const { return m_internalFormat; } static bool isNPOT(unsigned, unsigned); @@ -80,7 +80,7 @@ namespace WebCore { int m_wrapS; int m_wrapT; - unsigned long m_internalformat; + unsigned long m_internalFormat; unsigned m_width[6]; unsigned m_height[6]; diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp index 4c3c7ae..e8a9fee 100644 --- a/WebCore/inspector/InjectedScriptHost.cpp +++ b/WebCore/inspector/InjectedScriptHost.cpp @@ -110,17 +110,13 @@ long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, b return id; } -long InjectedScriptHost::pushNodeByPathToFrontend(const String& path) +long InjectedScriptHost::inspectedNode(unsigned long num) { InspectorDOMAgent* domAgent = inspectorDOMAgent(); if (!domAgent) return 0; - Node* node = domAgent->nodeForPath(path); - if (!node) - return 0; - - return domAgent->pushNodePathToFrontend(node); + return domAgent->inspectedNode(num); } #if ENABLE(DATABASE) diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h index 66cf41e..b942148 100644 --- a/WebCore/inspector/InjectedScriptHost.h +++ b/WebCore/inspector/InjectedScriptHost.h @@ -68,8 +68,7 @@ public: void copyText(const String& text); Node* nodeForId(long nodeId); long pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI); - - long pushNodeByPathToFrontend(const String& path); + long inspectedNode(unsigned long num); #if ENABLE(DATABASE) Database* databaseForId(long databaseId); diff --git a/WebCore/inspector/InjectedScriptHost.idl b/WebCore/inspector/InjectedScriptHost.idl index 5a4ce19..21af938 100644 --- a/WebCore/inspector/InjectedScriptHost.idl +++ b/WebCore/inspector/InjectedScriptHost.idl @@ -37,8 +37,7 @@ module core { void copyText(in DOMString text); [Custom] DOMObject nodeForId(in long nodeId); [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean withChildren, in boolean selectInUI); - - long pushNodeByPathToFrontend(in DOMString path); + long inspectedNode(in unsigned long num); #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER [Custom] DOMObject currentCallFrame(); diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 1eedda1..8e9e330 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -109,6 +109,18 @@ void InspectorBackend::disableSearchingForNode() m_inspectorController->setSearchingForNode(false); } +void InspectorBackend::enableMonitoringXHR() +{ + if (m_inspectorController) + m_inspectorController->setMonitoringXHR(true); +} + +void InspectorBackend::disableMonitoringXHR() +{ + if (m_inspectorController) + m_inspectorController->setMonitoringXHR(false); +} + void InspectorBackend::enableResourceTracking(bool always) { if (m_inspectorController) @@ -280,6 +292,12 @@ void InspectorBackend::clearProfiles() if (m_inspectorController) m_inspectorController->clearProfiles(); } + +void InspectorBackend::takeHeapSnapshot() +{ + if (m_inspectorController) + m_inspectorController->takeHeapSnapshot(); +} #endif void InspectorBackend::setInjectedScriptSource(const String& source) @@ -359,10 +377,28 @@ void InspectorBackend::removeNode(long callId, long nodeId) domAgent->removeNode(callId, nodeId); } -void InspectorBackend::changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded) +void InspectorBackend::changeTagName(long callId, long nodeId, const String& tagName) +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + domAgent->changeTagName(callId, nodeId, tagName); +} + +void InspectorBackend::getOuterHTML(long callId, long nodeId) { if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) - domAgent->changeTagName(callId, nodeId, tagName, expanded); + domAgent->getOuterHTML(callId, nodeId); +} + +void InspectorBackend::setOuterHTML(long callId, long nodeId, const String& outerHTML) +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + domAgent->setOuterHTML(callId, nodeId, outerHTML); +} + +void InspectorBackend::addInspectedNode(long nodeId) +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + domAgent->addInspectedNode(nodeId); } void InspectorBackend::performSearch(const String& query, bool runSynchronously) @@ -377,6 +413,23 @@ void InspectorBackend::searchCanceled() domAgent->searchCanceled(); } +void InspectorBackend::pushNodeByPathToFrontend(long callId, const String& path) +{ + InspectorDOMAgent* domAgent = inspectorDOMAgent(); + InspectorFrontend* frontend = inspectorFrontend(); + if (!domAgent || !frontend) + return; + + long id = domAgent->pushNodeByPathToFrontend(path); + frontend->didPushNodeByPathToFrontend(callId, id); +} + +void InspectorBackend::clearConsoleMessages() +{ + if (m_inspectorController) + m_inspectorController->clearConsoleMessages(); +} + void InspectorBackend::getStyles(long callId, long nodeId, bool authorOnly) { if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index 61d73b8..ce5dd99 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -65,6 +65,9 @@ public: void enableSearchingForNode(); void disableSearchingForNode(); + void enableMonitoringXHR(); + void disableMonitoringXHR(); + void enableResourceTracking(bool always); void disableResourceTracking(bool always); void getResourceContent(long callId, unsigned long identifier); @@ -105,6 +108,8 @@ public: void removeProfile(unsigned uid); void clearProfiles(); + + void takeHeapSnapshot(); #endif void setInjectedScriptSource(const String& source); @@ -119,9 +124,15 @@ public: void getEventListenersForNode(long callId, long nodeId); void copyNode(long nodeId); void removeNode(long callId, long nodeId); - void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded); + void changeTagName(long callId, long nodeId, const String& tagName); + void getOuterHTML(long callId, long nodeId); + void setOuterHTML(long callId, long nodeId, const String& outerHTML); + void addInspectedNode(long nodeId); void performSearch(const String& query, bool runSynchronously); void searchCanceled(); + void pushNodeByPathToFrontend(long callId, const String& path); + + void clearConsoleMessages(); void getStyles(long callId, long nodeId, bool authOnly); void getAllStyles(long callId); diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl index c0078ee..eaacaf0 100644 --- a/WebCore/inspector/InspectorBackend.idl +++ b/WebCore/inspector/InspectorBackend.idl @@ -40,6 +40,9 @@ module core { void enableSearchingForNode(); void disableSearchingForNode(); + void enableMonitoringXHR(); + void disableMonitoringXHR(); + void enableResourceTracking(in boolean always); void disableResourceTracking(in boolean always); void getResourceContent(in long callId, in unsigned long identifier); @@ -80,6 +83,8 @@ module core { void removeProfile(in unsigned long uid); void clearProfiles(); + + void takeHeapSnapshot(); #endif void setInjectedScriptSource(in DOMString scriptSource); void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in DOMString methodName, in DOMString arguments, in boolean async); @@ -94,9 +99,15 @@ module core { void getEventListenersForNode(in long callId, in long nodeId); void copyNode(in long nodeId); void removeNode(in long callId, in long nodeId); - void changeTagName(in long callId, in long nodeId, in DOMString newTagName, in boolean expanded); + void changeTagName(in long callId, in long nodeId, in DOMString newTagName); + void getOuterHTML(in long callId, in long nodeId); + void setOuterHTML(in long callId, in long nodeId, in DOMString outerHTML); + void addInspectedNode(in long nodeId); void performSearch(in DOMString query, in boolean runSynchronously); void searchCanceled(); + void pushNodeByPathToFrontend(in long callId, in DOMString path); + + void clearConsoleMessages(); void highlightDOMNode(in long nodeId); void hideDOMNodeHighlight(); diff --git a/WebCore/inspector/InspectorCSSStore.cpp b/WebCore/inspector/InspectorCSSStore.cpp index a080eda..7bc947a 100644 --- a/WebCore/inspector/InspectorCSSStore.cpp +++ b/WebCore/inspector/InspectorCSSStore.cpp @@ -29,6 +29,8 @@ #include "config.h" #include "InspectorCSSStore.h" +#if ENABLE(INSPECTOR) + #include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSRuleList.h" @@ -220,3 +222,5 @@ long InspectorCSSStore::bindRule(CSSStyleRule* rule) } } // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/WebCore/inspector/InspectorClient.h b/WebCore/inspector/InspectorClient.h index 2ce3a09..61900bb 100644 --- a/WebCore/inspector/InspectorClient.h +++ b/WebCore/inspector/InspectorClient.h @@ -50,6 +50,14 @@ public: virtual void storeSetting(const String& key, const String& value) = 0; virtual bool sendMessageToFrontend(const String& message) = 0; + + // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance. + // However, there are some inspector controller states that should survive navigation (such as tracking resources + // or recording timeline). Following callbacks allow embedders to track these states. + virtual void resourceTrackingWasEnabled() { }; + virtual void resourceTrackingWasDisabled() { }; + virtual void timelineProfilerWasStarted() { }; + virtual void timelineProfilerWasStopped() { }; }; } // namespace WebCore diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index 7916cd0..5020634 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -62,6 +62,7 @@ #include "InspectorDatabaseResource.h" #include "InspectorFrontend.h" #include "InspectorResource.h" +#include "InspectorValues.h" #include "InspectorWorkerResource.h" #include "InspectorTimelineAgent.h" #include "Page.h" @@ -86,6 +87,7 @@ #include <wtf/text/CString.h> #include <wtf/CurrentTime.h> #include <wtf/ListHashSet.h> +#include <wtf/MD5.h> #include <wtf/RefCounted.h> #include <wtf/StdLibExtras.h> @@ -120,6 +122,7 @@ static const char* const debuggerEnabledSettingName = "debuggerEnabled"; static const char* const profilerEnabledSettingName = "profilerEnabled"; static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight"; static const char* const lastActivePanelSettingName = "lastActivePanel"; +static const char* const monitoringXHRSettingName = "xhrMonitor"; const String& InspectorController::frontendSettingsSettingName() { @@ -141,6 +144,27 @@ static const unsigned expireConsoleMessagesStep = 100; static unsigned s_inspectorControllerCount; +namespace { + +String md5Base16(const String& string) +{ + static const char digits[] = "0123456789abcdef"; + + MD5 md5; + md5.addBytes(reinterpret_cast<const uint8_t*>(string.characters()), string.length() * 2); + Vector<uint8_t, 16> digest; + md5.checksum(digest); + + Vector<char, 32> result; + for (int i = 0; i < 16; ++i) { + result.append(digits[(digest[i] >> 4) & 0xf]); + result.append(digits[digest[i] & 0xf]); + } + return String(result.data(), result.size()); +} + +} + InspectorController::InspectorController(Page* page, InspectorClient* client) : m_inspectedPage(page) , m_client(client) @@ -151,15 +175,17 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_sessionSettings(InspectorObject::create()) , m_groupLevel(0) , m_searchingForNode(false) + , m_monitoringXHR(false) , m_previousMessage(0) , m_resourceTrackingEnabled(false) - , m_resourceTrackingSettingsLoaded(false) + , m_settingsLoaded(false) , m_inspectorBackend(InspectorBackend::create(this)) , m_injectedScriptHost(InjectedScriptHost::create(this)) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_debuggerEnabled(false) , m_attachDebuggerWhenShown(false) , m_pausedScriptState(0) + , m_breakpointsLoaded(false) , m_profilerEnabled(!WTF_USE_JSC) , m_recordingUserInitiatedProfile(false) , m_currentUserInitiatedProfileNumber(-1) @@ -232,7 +258,7 @@ void InspectorController::setSetting(const String& key, const String& value) void InspectorController::setSessionSettings(const String& settingsJSON) { - m_sessionSettings = InspectorValue::readJSON(settingsJSON); + m_sessionSettings = InspectorValue::parseJSON(settingsJSON); } void InspectorController::inspect(Node* node) @@ -431,6 +457,20 @@ void InspectorController::setSearchingForNode(bool enabled) } } +void InspectorController::setMonitoringXHR(bool enabled) +{ + if (m_monitoringXHR == enabled) + return; + m_monitoringXHR = enabled; + setSetting(monitoringXHRSettingName, enabled ? "true" : "false"); + if (m_frontend) { + if (enabled) + m_frontend->monitoringXHRWasEnabled(); + else + m_frontend->monitoringXHRWasDisabled(); + } +} + void InspectorController::connectFrontend(const ScriptObject& webInspector) { m_openingFrontend = false; @@ -439,6 +479,12 @@ void InspectorController::connectFrontend(const ScriptObject& webInspector) m_domAgent = InspectorDOMAgent::create(m_cssStore.get(), m_frontend.get()); if (m_timelineAgent) m_timelineAgent->resetFrontendProxyObject(m_frontend.get()); + + // Initialize Web Inspector title. + m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string()); + + populateScriptObjects(); + #if ENABLE(JAVASCRIPT_DEBUGGER) if (ScriptDebugServer::shared().isDebuggerAlwaysEnabled()) { // FIXME (40364): This will force pushing script sources to frontend even if script @@ -446,7 +492,7 @@ void InspectorController::connectFrontend(const ScriptObject& webInspector) enableDebuggerFromFrontend(false); } else { String debuggerEnabled = setting(debuggerEnabledSettingName); - if (debuggerEnabled == "true") + if (debuggerEnabled == "true" || m_attachDebuggerWhenShown) enableDebugger(); String profilerEnabled = setting(profilerEnabledSettingName); if (profilerEnabled == "true") @@ -454,11 +500,6 @@ void InspectorController::connectFrontend(const ScriptObject& webInspector) } #endif - // Initialize Web Inspector title. - m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string()); - - populateScriptObjects(); - if (m_showAfterVisible == CurrentPanel) { String lastActivePanelSetting = setting(lastActivePanelSettingName); m_showAfterVisible = specialPanelForJSName(lastActivePanelSetting); @@ -466,10 +507,6 @@ void InspectorController::connectFrontend(const ScriptObject& webInspector) if (m_nodeToFocus) focusNode(); -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (m_attachDebuggerWhenShown) - enableDebugger(); -#endif showPanel(m_showAfterVisible); } @@ -526,8 +563,7 @@ void InspectorController::disconnectFrontend() // opening. bool debuggerWasEnabled = m_debuggerEnabled; disableDebugger(); - if (debuggerWasEnabled) - m_attachDebuggerWhenShown = true; + m_attachDebuggerWhenShown = debuggerWasEnabled; #endif setSearchingForNode(false); unbindAllResources(); @@ -567,8 +603,9 @@ void InspectorController::populateScriptObjects() if (m_searchingForNode) m_frontend->searchingForNodeWasEnabled(); - else - m_frontend->searchingForNodeWasDisabled(); + + if (m_monitoringXHR) + m_frontend->monitoringXHRWasEnabled(); #if ENABLE(JAVASCRIPT_DEBUGGER) if (m_profilerEnabled) @@ -674,11 +711,15 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) #if ENABLE(JAVASCRIPT_DEBUGGER) m_sourceIDToURL.clear(); m_scriptIDToContent.clear(); + m_stickyBreakpoints.clear(); + m_breakpointsLoaded = false; #endif #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) m_profiles.clear(); m_currentUserInitiatedProfileNumber = 1; m_nextUserInitiatedProfileNumber = 1; + if (m_frontend) + m_frontend->resetProfilesPanel(); #endif // unbindAllResources should be called before database and DOM storage // resources are cleared so that it has a chance to unbind them. @@ -812,7 +853,7 @@ void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader, ASSERT(m_inspectedPage); bool isMainResource = isMainResourceLoader(loader, KURL(ParsedURLString, cachedResource->url())); - ensureResourceTrackingSettingsLoaded(); + ensureSettingsLoaded(); if (!isMainResource && !m_resourceTrackingEnabled) return; @@ -836,7 +877,7 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier, ASSERT(m_inspectedPage); bool isMainResource = isMainResourceLoader(loader, request.url()); - ensureResourceTrackingSettingsLoaded(); + ensureSettingsLoaded(); if (!isMainResource && !m_resourceTrackingEnabled) return; @@ -1006,9 +1047,15 @@ void InspectorController::didFailLoading(unsigned long identifier, const Resourc resource->updateScriptObject(m_frontend.get()); } -void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) +void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber) { - if (!enabled() || !m_resourceTrackingEnabled) + if (!enabled()) + return; + + if (m_monitoringXHR) + addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL); + + if (!m_resourceTrackingEnabled) return; InspectorResource* resource = m_resources.get(identifier).get(); @@ -1051,6 +1098,7 @@ void InspectorController::enableResourceTracking(bool always, bool reload) m_resourceTrackingEnabled = true; if (m_frontend) m_frontend->resourceTrackingWasEnabled(); + m_client->resourceTrackingWasEnabled(); if (reload) m_inspectedPage->mainFrame()->redirectScheduler()->scheduleRefresh(true); @@ -1068,17 +1116,23 @@ void InspectorController::disableResourceTracking(bool always) m_resourceTrackingEnabled = false; if (m_frontend) m_frontend->resourceTrackingWasDisabled(); + m_client->resourceTrackingWasDisabled(); } -void InspectorController::ensureResourceTrackingSettingsLoaded() +void InspectorController::ensureSettingsLoaded() { - if (m_resourceTrackingSettingsLoaded) + if (m_settingsLoaded) return; - m_resourceTrackingSettingsLoaded = true; + m_settingsLoaded = true; String resourceTracking = setting(resourceTrackingEnabledSettingName); if (resourceTracking == "true") m_resourceTrackingEnabled = true; + m_client->resourceTrackingWasEnabled(); + + String monitoringXHR = setting(monitoringXHRSettingName); + if (monitoringXHR == "true") + m_monitoringXHR = true; } void InspectorController::startTimelineProfiler() @@ -1092,6 +1146,7 @@ void InspectorController::startTimelineProfiler() m_timelineAgent = new InspectorTimelineAgent(m_frontend.get()); if (m_frontend) m_frontend->timelineProfilerWasStarted(); + m_client->timelineProfilerWasStarted(); } void InspectorController::stopTimelineProfiler() @@ -1105,6 +1160,7 @@ void InspectorController::stopTimelineProfiler() m_timelineAgent = 0; if (m_frontend) m_frontend->timelineProfilerWasStopped(); + m_client->timelineProfilerWasStopped(); } #if ENABLE(WORKERS) @@ -1580,18 +1636,27 @@ void InspectorController::disableProfiler(bool always) if (m_frontend) m_frontend->profilerWasDisabled(); } + +void InspectorController::takeHeapSnapshot() +{ + if (!enabled()) + return; + + ScriptProfiler::takeHeapSnapshot(); +} #endif #if ENABLE(JAVASCRIPT_DEBUGGER) void InspectorController::enableDebuggerFromFrontend(bool always) { + ASSERT(!m_debuggerEnabled); if (always) setSetting(debuggerEnabledSettingName, "true"); ASSERT(m_inspectedPage); - ScriptDebugServer::shared().addListener(this, m_inspectedPage); ScriptDebugServer::shared().clearBreakpoints(); + ScriptDebugServer::shared().addListener(this, m_inspectedPage); m_debuggerEnabled = true; m_frontend->debuggerWasEnabled(); @@ -1678,10 +1743,12 @@ void InspectorController::setBreakpoint(const String& sourceID, unsigned lineNum if (url.isEmpty()) return; - HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(url); + String key = md5Base16(url); + HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(key); if (it == m_stickyBreakpoints.end()) - it = m_stickyBreakpoints.set(url, SourceBreakpoints()).first; + it = m_stickyBreakpoints.set(key, SourceBreakpoints()).first; it->second.set(lineNumber, breakpoint); + saveBreakpoints(); } void InspectorController::removeBreakpoint(const String& sourceID, unsigned lineNumber) @@ -1692,9 +1759,10 @@ void InspectorController::removeBreakpoint(const String& sourceID, unsigned line if (url.isEmpty()) return; - HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(url); + HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(md5Base16(url)); if (it != m_stickyBreakpoints.end()) it->second.remove(lineNumber); + saveBreakpoints(); } // JavaScriptDebugListener functions @@ -1704,10 +1772,13 @@ void InspectorController::didParseSource(const String& sourceID, const String& u // Don't send script content to the front end until it's really needed. m_frontend->parsedScriptSource(sourceID, url, "", firstLine, worldType); + m_scriptIDToContent.set(sourceID, data); + if (url.isEmpty()) return; - HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(url); + loadBreakpoints(); + HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(md5Base16(url)); if (it != m_stickyBreakpoints.end()) { for (SourceBreakpoints::iterator breakpointIt = it->second.begin(); breakpointIt != it->second.end(); ++breakpointIt) { if (firstLine <= breakpointIt->first) { @@ -1716,9 +1787,7 @@ void InspectorController::didParseSource(const String& sourceID, const String& u } } } - m_sourceIDToURL.set(sourceID, url); - m_scriptIDToContent.set(sourceID, data); } void InspectorController::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) @@ -1761,6 +1830,47 @@ void InspectorController::didEvaluateForTestInFrontend(long callId, const String function.call(); } +#if ENABLE(JAVASCRIPT_DEBUGGER) +String InspectorController::breakpointsSettingKey() +{ + DEFINE_STATIC_LOCAL(String, keyPrefix, ("breakpoints:")); + return keyPrefix + md5Base16(m_mainResource->requestURL()); +} + +void InspectorController::loadBreakpoints() +{ + if (m_breakpointsLoaded) + return; + m_breakpointsLoaded = true; + + RefPtr<InspectorValue> parsedSetting = InspectorValue::parseJSON(setting(breakpointsSettingKey())); + if (!parsedSetting) + return; + RefPtr<InspectorObject> breakpoints = parsedSetting->asObject(); + if (!breakpoints) + return; + for (InspectorObject::iterator it = breakpoints->begin(); it != breakpoints->end(); ++it) { + RefPtr<InspectorObject> breakpointsForURL = it->second->asObject(); + if (!breakpointsForURL) + continue; + HashMap<String, SourceBreakpoints>::iterator sourceBreakpointsIt = m_stickyBreakpoints.set(it->first, SourceBreakpoints()).first; + ScriptBreakpoint::sourceBreakpointsFromInspectorObject(breakpointsForURL, &sourceBreakpointsIt->second); + } +} + +void InspectorController::saveBreakpoints() +{ + RefPtr<InspectorObject> breakpoints = InspectorObject::create(); + for (HashMap<String, SourceBreakpoints>::iterator it(m_stickyBreakpoints.begin()); it != m_stickyBreakpoints.end(); ++it) { + if (it->second.isEmpty()) + continue; + RefPtr<InspectorObject> breakpointsForURL = ScriptBreakpoint::inspectorObjectFromSourceBreakpoints(it->second); + breakpoints->set(it->first, breakpointsForURL); + } + setSetting(breakpointsSettingKey(), breakpoints->toJSONString()); +} +#endif + static Path quadToPath(const FloatQuad& quad) { Path quadPath; @@ -1826,7 +1936,7 @@ static void drawHighlightForBox(GraphicsContext& context, const FloatQuad& conte drawOutlinedQuad(context, contentQuad, contentBoxColor); } -static void drawHighlightForLineBoxes(GraphicsContext& context, const Vector<FloatQuad>& lineBoxQuads) +static void drawHighlightForLineBoxesOrSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& lineBoxQuads) { static const Color lineBoxColor(125, 173, 217, 128); @@ -1867,7 +1977,14 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const overlayRect = view->visibleContentRect(); context.translate(-overlayRect.x(), -overlayRect.y()); - if (renderer->isBox()) { + // RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads(). +#if ENABLE(SVG) + bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot(); +#else + bool isSVGRenderer = false; +#endif + + if (renderer->isBox() && !isSVGRenderer) { RenderBox* renderBox = toRenderBox(renderer); IntRect contentBox = renderBox->contentBoxRect(); @@ -1890,16 +2007,14 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const absMarginQuad.move(mainFrameOffset); drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad); - } else if (renderer->isRenderInline()) { - RenderInline* renderInline = toRenderInline(renderer); - + } else if (renderer->isRenderInline() || isSVGRenderer) { // FIXME: We should show margins/padding/border for inlines. Vector<FloatQuad> lineBoxQuads; - renderInline->absoluteQuads(lineBoxQuads); + renderer->absoluteQuads(lineBoxQuads); for (unsigned i = 0; i < lineBoxQuads.size(); ++i) lineBoxQuads[i] += mainFrameOffset; - drawHighlightForLineBoxes(context, lineBoxQuads); + drawHighlightForLineBoxesOrSVGRenderer(context, lineBoxQuads); } } diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 346a8dc..b2d1d5a 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -170,13 +170,14 @@ public: void didReceiveContentLength(unsigned long identifier, int lengthReceived); void didFinishLoading(unsigned long identifier); void didFailLoading(unsigned long identifier, const ResourceError&); - void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString); + void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber); void scriptImported(unsigned long identifier, const String& sourceString); void enableResourceTracking(bool always = false, bool reload = true); void disableResourceTracking(bool always = false); bool resourceTrackingEnabled() const { return m_resourceTrackingEnabled; } - void ensureResourceTrackingSettingsLoaded(); + + void ensureSettingsLoaded(); void startTimelineProfiler(); void stopTimelineProfiler(); @@ -240,6 +241,8 @@ public: void enableProfiler(bool always = false, bool skipRecompile = false); void disableProfiler(bool always = false); bool profilerEnabled() const { return enabled() && m_profilerEnabled; } + + void takeHeapSnapshot(); #endif #if ENABLE(JAVASCRIPT_DEBUGGER) @@ -278,6 +281,7 @@ private: // Following are used from InspectorBackend and internally. void setSearchingForNode(bool enabled); + void setMonitoringXHR(bool enabled); void storeLastActivePanel(const String& panelName); InspectorDOMAgent* domAgent() { return m_domAgent.get(); } void releaseDOMAgent(); @@ -325,6 +329,12 @@ private: void didEvaluateForTestInFrontend(long callId, const String& jsonResult); +#if ENABLE(JAVASCRIPT_DEBUGGER) + String breakpointsSettingKey(); + void loadBreakpoints(); + void saveBreakpoints(); +#endif + Page* m_inspectedPage; InspectorClient* m_client; OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient; @@ -350,12 +360,15 @@ private: #endif SpecialPanels m_showAfterVisible; RefPtr<Node> m_highlightedNode; +#if ENABLE(INSPECTOR) RefPtr<InspectorValue> m_sessionSettings; +#endif unsigned m_groupLevel; bool m_searchingForNode; + bool m_monitoringXHR; ConsoleMessage* m_previousMessage; bool m_resourceTrackingEnabled; - bool m_resourceTrackingSettingsLoaded; + bool m_settingsLoaded; RefPtr<InspectorBackend> m_inspectorBackend; RefPtr<InjectedScriptHost> m_injectedScriptHost; @@ -371,6 +384,7 @@ private: HashMap<String, String> m_sourceIDToURL; HashMap<String, String> m_scriptIDToContent; HashMap<String, SourceBreakpoints> m_stickyBreakpoints; + bool m_breakpointsLoaded; bool m_profilerEnabled; bool m_recordingUserInitiatedProfile; diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index b152dc3..a2f2e15 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -53,9 +53,9 @@ #include "EventTarget.h" #include "Frame.h" #include "FrameTree.h" +#include "HTMLElement.h" #include "HTMLFrameOwnerElement.h" #include "InspectorFrontend.h" -#include "markup.h" #include "MutationEvent.h" #include "Node.h" #include "NodeList.h" @@ -355,12 +355,28 @@ void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId) m_frontend->setChildNodes(nodeId, children); } +long InspectorDOMAgent::pushNodeByPathToFrontend(const String& path) +{ + Node* node = nodeForPath(path); + if (!node) + return 0; + return pushNodePathToFrontend(node); +} + +long InspectorDOMAgent::inspectedNode(unsigned long num) +{ + if (num < m_inspectedNodes.size()) + return m_inspectedNodes[num]; + return 0; +} + void InspectorDOMAgent::discardBindings() { m_documentNodeToIdMap.clear(); m_idToNode.clear(); releaseDanglingNodes(); m_childrenRequested.clear(); + m_inspectedNodes.clear(); } Node* InspectorDOMAgent::nodeForId(long id) @@ -374,35 +390,6 @@ Node* InspectorDOMAgent::nodeForId(long id) return 0; } -Node* InspectorDOMAgent::nodeForPath(const String& path) -{ - // The path is of form "1,HTML,2,BODY,1,DIV" - Node* node = mainFrameDocument(); - if (!node) - return 0; - - Vector<String> pathTokens; - path.split(",", false, pathTokens); - for (size_t i = 0; i < pathTokens.size() - 1; i += 2) { - bool success = true; - unsigned childNumber = pathTokens[i].toUInt(&success); - if (!success) - return 0; - if (childNumber >= innerChildNodeCount(node)) - return 0; - - Node* child = innerFirstChild(node); - String childName = pathTokens[i + 1]; - for (size_t j = 0; child && j < childNumber; ++j) - child = innerNextSibling(child); - - if (!child || child->nodeName() != childName) - return 0; - node = child; - } - return node; -} - void InspectorDOMAgent::getChildNodes(long callId, long nodeId) { pushChildNodesToFrontend(nodeId); @@ -481,40 +468,40 @@ void InspectorDOMAgent::removeNode(long callId, long nodeId) { Node* node = nodeForId(nodeId); if (!node) { - // Use -1 to denote an error condition. - m_frontend->didRemoveNode(callId, -1); + m_frontend->didRemoveNode(callId, 0); return; } Node* parentNode = node->parentNode(); if (!parentNode) { - m_frontend->didRemoveNode(callId, -1); + m_frontend->didRemoveNode(callId, 0); return; } - ExceptionCode code; - parentNode->removeChild(node, code); - if (code) { - m_frontend->didRemoveNode(callId, -1); + ExceptionCode ec = 0; + parentNode->removeChild(node, ec); + if (ec) { + m_frontend->didRemoveNode(callId, 0); return; } m_frontend->didRemoveNode(callId, nodeId); } -void InspectorDOMAgent::changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded) +void InspectorDOMAgent::changeTagName(long callId, long nodeId, const String& tagName) { Node* oldNode = nodeForId(nodeId); if (!oldNode || !oldNode->isElementNode()) { - // Use -1 to denote an error condition. - m_frontend->didChangeTagName(callId, -1); + m_frontend->didChangeTagName(callId, 0); return; } - ExceptionCode code = 0; - RefPtr<Element> newElem = oldNode->document()->createElement(tagName, code); - if (code) { - m_frontend->didChangeTagName(callId, -1); + bool childrenRequested = m_childrenRequested.contains(nodeId); + + ExceptionCode ec = 0; + RefPtr<Element> newElem = oldNode->document()->createElement(tagName, ec); + if (ec) { + m_frontend->didChangeTagName(callId, 0); return; } @@ -527,24 +514,63 @@ void InspectorDOMAgent::changeTagName(long callId, long nodeId, const AtomicStri // Copy over the original node's children. Node* child; while ((child = oldNode->firstChild())) - newElem->appendChild(child, code); + newElem->appendChild(child, ec); // Replace the old node with the new node Node* parent = oldNode->parentNode(); - parent->insertBefore(newElem, oldNode->nextSibling(), code); - parent->removeChild(oldNode, code); + parent->insertBefore(newElem, oldNode->nextSibling(), ec); + parent->removeChild(oldNode, ec); - if (code) { - m_frontend->didChangeTagName(callId, -1); + if (ec) { + m_frontend->didChangeTagName(callId, 0); return; } long newId = pushNodePathToFrontend(newElem.get()); - if (expanded) + if (childrenRequested) pushChildNodesToFrontend(newId); m_frontend->didChangeTagName(callId, newId); } +void InspectorDOMAgent::getOuterHTML(long callId, long nodeId) +{ + Node* node = nodeForId(nodeId); + if (!node || !node->isHTMLElement()) { + m_frontend->didGetOuterHTML(callId, ""); + return; + } + + HTMLElement* htmlElement = static_cast<HTMLElement*>(node); + m_frontend->didGetOuterHTML(callId, htmlElement->outerHTML()); +} + +void InspectorDOMAgent::setOuterHTML(long callId, long nodeId, const String& outerHTML) +{ + Node* node = nodeForId(nodeId); + if (!node || !node->isHTMLElement()) { + m_frontend->didSetOuterHTML(callId, 0); + return; + } + + bool childrenRequested = m_childrenRequested.contains(nodeId); + Node* previousSibling = node->previousSibling(); + Node* parentNode = node->parentNode(); + + HTMLElement* htmlElement = static_cast<HTMLElement*>(node); + ExceptionCode ec = 0; + htmlElement->setOuterHTML(outerHTML, ec); + if (ec) + m_frontend->didSetOuterHTML(callId, 0); + + Node* newNode = previousSibling ? previousSibling->nextSibling() : parentNode->firstChild(); + + long newId = pushNodePathToFrontend(newNode); + if (childrenRequested) + pushChildNodesToFrontend(newId); + + m_frontend->didSetOuterHTML(callId, newId); +} + void InspectorDOMAgent::setTextNodeValue(long callId, long nodeId, const String& value) { Node* node = nodeForId(nodeId); @@ -632,6 +658,13 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId) m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray); } +void InspectorDOMAgent::addInspectedNode(long nodeId) +{ + m_inspectedNodes.prepend(nodeId); + while (m_inspectedNodes.size() > 5) + m_inspectedNodes.removeLast(); +} + void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously) { // FIXME: Few things are missing here: @@ -1531,6 +1564,35 @@ bool InspectorDOMAgent::ruleAffectsNode(CSSStyleRule* rule, Node* node) return false; } +Node* InspectorDOMAgent::nodeForPath(const String& path) +{ + // The path is of form "1,HTML,2,BODY,1,DIV" + Node* node = mainFrameDocument(); + if (!node) + return 0; + + Vector<String> pathTokens; + path.split(",", false, pathTokens); + for (size_t i = 0; i < pathTokens.size() - 1; i += 2) { + bool success = true; + unsigned childNumber = pathTokens[i].toUInt(&success); + if (!success) + return 0; + if (childNumber >= innerChildNodeCount(node)) + return 0; + + Node* child = innerFirstChild(node); + String childName = pathTokens[i + 1]; + for (size_t j = 0; child && j < childNumber; ++j) + child = innerNextSibling(child); + + if (!child || child->nodeName() != childName) + return 0; + node = child; + } + return node; +} + ScriptArray InspectorDOMAgent::toArray(const Vector<String>& data) { ScriptArray result = m_frontend->newScriptArray(); diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index a962569..70d5b94 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -102,9 +102,12 @@ namespace WebCore { void setAttribute(long callId, long elementId, const String& name, const String& value); void removeAttribute(long callId, long elementId, const String& name); void removeNode(long callId, long nodeId); - void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded); + void changeTagName(long callId, long nodeId, const String& tagName); + void getOuterHTML(long callId, long nodeId); + void setOuterHTML(long callId, long nodeId, const String& outerHTML); void setTextNodeValue(long callId, long nodeId, const String& value); void getEventListenersForNode(long callId, long nodeId); + void addInspectedNode(long nodeId); void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously); void searchCanceled(); @@ -131,9 +134,10 @@ namespace WebCore { void didModifyDOMAttr(Element*); Node* nodeForId(long nodeId); - Node* nodeForPath(const String& path); long pushNodePathToFrontend(Node* node); void pushChildNodesToFrontend(long nodeId); + long pushNodeByPathToFrontend(const String& path); + long inspectedNode(unsigned long num); private: static CSSStyleSheet* getParentStyleSheet(CSSStyleDeclaration*); @@ -183,6 +187,7 @@ namespace WebCore { String shorthandValue(CSSStyleDeclaration*, const String& shorthandProperty); String shorthandPriority(CSSStyleDeclaration*, const String& shorthandProperty); bool ruleAffectsNode(CSSStyleRule*, Node*); + Node* nodeForPath(const String& path); ScriptArray toArray(const Vector<String>& data); void discardBindings(); @@ -200,6 +205,7 @@ namespace WebCore { Deque<MatchJob*> m_pendingMatchJobs; Timer<InspectorDOMAgent> m_matchJobsTimer; HashSet<RefPtr<Node> > m_searchResults; + Vector<long> m_inspectedNodes; }; } // namespace WebCore diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index c9aa730..cde5a70 100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp @@ -184,14 +184,6 @@ void InspectorFrontend::updateFocusedNode(long nodeId) function.call(); } -void InspectorFrontend::setAttachedWindow(bool attached) -{ - ScriptFunctionCall function(m_webInspector, "dispatch"); - function.appendArgument("setAttachedWindow"); - function.appendArgument(attached); - function.call(); -} - void InspectorFrontend::showPanel(int panel) { const char* showFunctionName; @@ -239,6 +231,11 @@ void InspectorFrontend::reset() callSimpleFunction("reset"); } +void InspectorFrontend::resetProfilesPanel() +{ + callSimpleFunction("resetProfilesPanel"); +} + void InspectorFrontend::bringToFront() { callSimpleFunction("bringToFront"); @@ -262,7 +259,6 @@ void InspectorFrontend::resourceTrackingWasDisabled() callSimpleFunction("resourceTrackingWasDisabled"); } - void InspectorFrontend::searchingForNodeWasEnabled() { callSimpleFunction("searchingForNodeWasEnabled"); @@ -273,6 +269,16 @@ void InspectorFrontend::searchingForNodeWasDisabled() callSimpleFunction("searchingForNodeWasDisabled"); } +void InspectorFrontend::monitoringXHRWasEnabled() +{ + callSimpleFunction("monitoringXHRWasEnabled"); +} + +void InspectorFrontend::monitoringXHRWasDisabled() +{ + callSimpleFunction("monitoringXHRWasDisabled"); +} + void InspectorFrontend::updatePauseOnExceptionsState(long state) { ScriptFunctionCall function(m_webInspector, "dispatch"); @@ -514,6 +520,33 @@ void InspectorFrontend::didChangeTagName(long callId, long nodeId) function.call(); } +void InspectorFrontend::didGetOuterHTML(long callId, const String& outerHTML) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetOuterHTML"); + function.appendArgument(callId); + function.appendArgument(outerHTML); + function.call(); +} + +void InspectorFrontend::didSetOuterHTML(long callId, long nodeId) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didSetOuterHTML"); + function.appendArgument(callId); + function.appendArgument(nodeId); + function.call(); +} + +void InspectorFrontend::didPushNodeByPathToFrontend(long callId, long nodeId) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didPushNodeByPathToFrontend"); + function.appendArgument(callId); + function.appendArgument(nodeId); + function.call(); +} + void InspectorFrontend::didGetChildNodes(long callId) { ScriptFunctionCall function(m_webInspector, "dispatch"); diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h index 1762014..0b19983 100644 --- a/WebCore/inspector/InspectorFrontend.h +++ b/WebCore/inspector/InspectorFrontend.h @@ -77,10 +77,10 @@ namespace WebCore { void didGetResourceContent(long callId, const String& content); void updateFocusedNode(long nodeId); - void setAttachedWindow(bool attached); void showPanel(int panel); void populateInterface(); void reset(); + void resetProfilesPanel(); void bringToFront(); void inspectedURLChanged(const String&); @@ -91,6 +91,9 @@ namespace WebCore { void searchingForNodeWasEnabled(); void searchingForNodeWasDisabled(); + void monitoringXHRWasEnabled(); + void monitoringXHRWasDisabled(); + void updatePauseOnExceptionsState(long state); #if ENABLE(JAVASCRIPT_DEBUGGER) @@ -142,6 +145,9 @@ namespace WebCore { void didGetEventListenersForNode(long callId, long nodeId, const ScriptArray& listenersArray); void didRemoveNode(long callId, long nodeId); void didChangeTagName(long callId, long nodeId); + void didGetOuterHTML(long callId, const String& outerHTML); + void didSetOuterHTML(long callId, long nodeId); + void didPushNodeByPathToFrontend(long callId, long nodeId); void didGetStyles(long callId, const ScriptValue& styles); void didGetAllStyles(long callId, const ScriptArray& styles); diff --git a/WebCore/inspector/InspectorFrontendClientLocal.cpp b/WebCore/inspector/InspectorFrontendClientLocal.cpp index 188566f..16a6a8b 100644 --- a/WebCore/inspector/InspectorFrontendClientLocal.cpp +++ b/WebCore/inspector/InspectorFrontendClientLocal.cpp @@ -148,7 +148,7 @@ void InspectorFrontendClientLocal::restoreAttachedWindowHeight() String attachedHeight = m_inspectorController->setting(inspectorAttachedHeightName); bool success = true; int height = attachedHeight.toInt(&success); - unsigned preferredHeight = success ? height : defaultAttachedHeight; + unsigned preferredHeight = success ? static_cast<unsigned>(height) : defaultAttachedHeight; // This call might not go through (if the window starts out detached), but if the window is initially created attached, // InspectorController::attachWindow is never called, so we need to make sure to set the attachedWindowHeight. diff --git a/WebCore/inspector/InspectorValues.cpp b/WebCore/inspector/InspectorValues.cpp index 5c7d0c8..f95116c 100644 --- a/WebCore/inspector/InspectorValues.cpp +++ b/WebCore/inspector/InspectorValues.cpp @@ -499,7 +499,7 @@ PassRefPtr<InspectorArray> InspectorValue::asArray() return 0; } -PassRefPtr<InspectorValue> InspectorValue::readJSON(const String& json) +PassRefPtr<InspectorValue> InspectorValue::parseJSON(const String& json) { const UChar* start = json.characters(); const UChar* end = json.characters() + json.length(); @@ -599,7 +599,7 @@ PassRefPtr<InspectorObject> InspectorObject::getObject(const String& name) const { PassRefPtr<InspectorValue> value = get(name); if (!value) - return false; + return 0; return value->asObject(); } @@ -607,7 +607,7 @@ PassRefPtr<InspectorArray> InspectorObject::getArray(const String& name) const { PassRefPtr<InspectorValue> value = get(name); if (!value) - return false; + return 0; return value->asArray(); } diff --git a/WebCore/inspector/InspectorValues.h b/WebCore/inspector/InspectorValues.h index b9920c4..30ba95a 100644 --- a/WebCore/inspector/InspectorValues.h +++ b/WebCore/inspector/InspectorValues.h @@ -73,7 +73,7 @@ public: virtual PassRefPtr<InspectorObject> asObject(); virtual PassRefPtr<InspectorArray> asArray(); - static PassRefPtr<InspectorValue> readJSON(const String& json); + static PassRefPtr<InspectorValue> parseJSON(const String& json); String toJSONString() const; virtual void writeJSON(Vector<UChar>* output) const; diff --git a/WebCore/inspector/ScriptBreakpoint.cpp b/WebCore/inspector/ScriptBreakpoint.cpp new file mode 100644 index 0000000..ce0d18a --- /dev/null +++ b/WebCore/inspector/ScriptBreakpoint.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScriptBreakpoint.h" + +#if ENABLE(INSPECTOR) + +#include "InspectorValues.h" + +namespace WebCore { + +void ScriptBreakpoint::sourceBreakpointsFromInspectorObject(PassRefPtr<InspectorObject> breakpoints, SourceBreakpoints* sourceBreakpoints) +{ + for (InspectorObject::iterator it = breakpoints->begin(); it != breakpoints->end(); ++it) { + bool ok; + int lineNumber = it->first.toInt(&ok); + if (!ok) + continue; + RefPtr<InspectorObject> breakpoint = it->second->asObject(); + if (!breakpoint) + continue; + bool enabled; + RefPtr<InspectorValue> enabledValue = breakpoint->get("enabled"); + if (!enabledValue || !enabledValue->asBool(&enabled)) + continue; + String condition; + RefPtr<InspectorValue> conditionValue = breakpoint->get("condition"); + if (!conditionValue || !conditionValue->asString(&condition)) + continue; + sourceBreakpoints->set(lineNumber, ScriptBreakpoint(enabled, condition)); + } +} + +PassRefPtr<InspectorObject> ScriptBreakpoint::inspectorObjectFromSourceBreakpoints(const SourceBreakpoints& sourceBreakpoints) +{ + RefPtr<InspectorObject> breakpoints = InspectorObject::create(); + for (SourceBreakpoints::const_iterator it = sourceBreakpoints.begin(); it != sourceBreakpoints.end(); ++it) { + RefPtr<InspectorObject> breakpoint = InspectorObject::create(); + breakpoint->setBool("enabled", it->second.enabled); + breakpoint->setString("condition", it->second.condition); + breakpoints->set(String::number(it->first), breakpoint); + } + return breakpoints.release(); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/WebCore/inspector/ScriptBreakpoint.h b/WebCore/inspector/ScriptBreakpoint.h index 8775901..b7c7a37 100644 --- a/WebCore/inspector/ScriptBreakpoint.h +++ b/WebCore/inspector/ScriptBreakpoint.h @@ -35,6 +35,11 @@ namespace WebCore { +class InspectorObject; +struct ScriptBreakpoint; + +typedef HashMap<int, ScriptBreakpoint> SourceBreakpoints; + struct ScriptBreakpoint { ScriptBreakpoint(bool enabled, const String& condition) : enabled(enabled) @@ -48,9 +53,10 @@ struct ScriptBreakpoint { bool enabled; String condition; -}; -typedef HashMap<int, ScriptBreakpoint> SourceBreakpoints; + static void sourceBreakpointsFromInspectorObject(PassRefPtr<InspectorObject>, SourceBreakpoints*); + static PassRefPtr<InspectorObject> inspectorObjectFromSourceBreakpoints(const SourceBreakpoints&); +}; } // namespace WebCore diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js index 3ccccac..4f6965a 100644 --- a/WebCore/inspector/front-end/BreakpointManager.js +++ b/WebCore/inspector/front-end/BreakpointManager.js @@ -38,6 +38,7 @@ WebInspector.BreakpointManager.prototype = { if (this._oneTimeBreakpoint) this._removeBreakpointFromBackend(this._oneTimeBreakpoint); this._oneTimeBreakpoint = breakpoint; + // FIXME(40669): one time breakpoint will be persisted in inspector settings if not hit. this._saveBreakpointOnBackend(breakpoint); }, @@ -51,15 +52,15 @@ WebInspector.BreakpointManager.prototype = { addBreakpoint: function(sourceID, sourceURL, line, enabled, condition) { - var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition); - if (this._breakpoints[breakpoint.id]) - return; - if (this._oneTimeBreakpoint && (this._oneTimeBreakpoint.id == breakpoint.id)) - delete this._oneTimeBreakpoint; - this._breakpoints[breakpoint.id] = breakpoint; - this._saveBreakpointOnBackend(breakpoint); - this.dispatchEventToListeners("breakpoint-added", breakpoint); - }, + var breakpoint = this._addBreakpoint(sourceID, sourceURL, line, enabled, condition); + if (breakpoint) + this._saveBreakpointOnBackend(breakpoint); + }, + + restoredBreakpoint: function(sourceID, sourceURL, line, enabled, condition) + { + this._addBreakpoint(sourceID, sourceURL, line, enabled, condition); + }, removeBreakpoint: function(breakpoint) { @@ -78,7 +79,7 @@ WebInspector.BreakpointManager.prototype = { breakpoints.push(this._breakpoints[id]); } return breakpoints; - }, + }, breakpointsForURL: function(url) { @@ -87,7 +88,7 @@ WebInspector.BreakpointManager.prototype = { if (this._breakpoints[id].url === url) breakpoints.push(this._breakpoints[id]); } - return breakpoints; + return breakpoints; }, reset: function() @@ -96,6 +97,18 @@ WebInspector.BreakpointManager.prototype = { delete this._oneTimeBreakpoint; }, + _addBreakpoint: function(sourceID, sourceURL, line, enabled, condition) + { + var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition); + if (this._breakpoints[breakpoint.id]) + return; + if (this._oneTimeBreakpoint && (this._oneTimeBreakpoint.id == breakpoint.id)) + delete this._oneTimeBreakpoint; + this._breakpoints[breakpoint.id] = breakpoint; + this.dispatchEventToListeners("breakpoint-added", breakpoint); + return breakpoint; + }, + _saveBreakpointOnBackend: function(breakpoint) { InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition); diff --git a/WebCore/inspector/front-end/CSSCompletions.js b/WebCore/inspector/front-end/CSSCompletions.js new file mode 100644 index 0000000..5485464 --- /dev/null +++ b/WebCore/inspector/front-end/CSSCompletions.js @@ -0,0 +1,102 @@ +WebInspector.CSSCompletions = (function() { + var used = {}; + var properties = []; + var style = document.documentElement.style; + var list = document.defaultView.getComputedStyle(document.documentElement, ""); + var length = list.length; + for (var i = 0; i < length; ++i) + used[properties[i] = list[i]] = true; + + for (var i = 0, end = length; i < length; ++i) { + var propertyWords = properties[i].split("-"); + var j = propertyWords.length; + while (--j) { + propertyWords.pop(); + var shorthand = propertyWords.join("-"); + if (!(shorthand in used) && style[shorthand] !== undefined) { + used[shorthand] = true; + properties[end++] = shorthand; + } + } + } + + return properties.sort(); +})(); + +WebInspector.CSSCompletions.startsWith = function(prefix) +{ + var firstIndex = this._firstIndexOfPrefix(prefix); + if (firstIndex === -1) + return []; + + var results = []; + while (this[firstIndex].indexOf(prefix) === 0) + results.push(this[firstIndex++]); + return results; +} + +WebInspector.CSSCompletions.firstStartsWith = function(prefix) +{ + var foundIndex = this._firstIndexOfPrefix(prefix); + return (foundIndex === -1 ? "" : this[foundIndex]); +} + +WebInspector.CSSCompletions._firstIndexOfPrefix = function(prefix) +{ + if (!prefix) + return -1; + + var maxIndex = this.length - 1; + var minIndex = 0; + var foundIndex; + + do { + var middleIndex = (maxIndex + minIndex) >> 1; + if (this[middleIndex].indexOf(prefix) === 0) { + foundIndex = middleIndex; + break; + } + if (this[middleIndex] < prefix) + minIndex = middleIndex + 1; + else + maxIndex = middleIndex - 1; + } while (minIndex <= maxIndex); + + if (!foundIndex) + return -1; + + while (foundIndex && this[foundIndex - 1].indexOf(prefix) === 0) + foundIndex--; + + return foundIndex; +} + +WebInspector.CSSCompletions.next = function(str, prefix) +{ + return WebInspector.CSSCompletions._closest(str, prefix, 1); +} + +WebInspector.CSSCompletions.previous = function(str, prefix) +{ + return WebInspector.CSSCompletions._closest(str, prefix, -1); +} + +WebInspector.CSSCompletions._closest = function(str, prefix, shift) +{ + if (!str) + return ""; + + var index = this.indexOf(str); + if (index === -1) + return ""; + + if (!prefix) { + index = (index + this.length + shift) % this.length; + return this[index]; + } + + var propertiesWithPrefix = this.startsWith(prefix); + var j = propertiesWithPrefix.indexOf(str); + j = (j + propertiesWithPrefix.length + shift) % propertiesWithPrefix.length; + return propertiesWithPrefix[j]; +} diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js index d1f347b..8bb71e6 100644 --- a/WebCore/inspector/front-end/ConsoleView.js +++ b/WebCore/inspector/front-end/ConsoleView.js @@ -296,7 +296,7 @@ WebInspector.ConsoleView.prototype = { requestClearMessages: function() { - InjectedScriptAccess.getDefault().clearConsoleMessages(function() {}); + InspectorBackend.clearConsoleMessages(); }, clearMessages: function() @@ -399,7 +399,13 @@ WebInspector.ConsoleView.prototype = { return; } - this._contextMenu.show(event); + var contextMenu = new WebInspector.ContextMenu(); + if (!WebInspector.monitoringXHREnabled) + contextMenu.appendItem(WebInspector.UIString("Enable XMLHttpRequest logging"), InspectorBackend.enableMonitoringXHR.bind(InspectorBackend)); + else + contextMenu.appendItem(WebInspector.UIString("Disable XMLHttpRequest logging"), InspectorBackend.disableMonitoringXHR.bind(InspectorBackend)); + contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this)); + contextMenu.show(event); }, _messagesSelectStart: function(event) @@ -444,8 +450,6 @@ WebInspector.ConsoleView.prototype = { var clearConsoleHandler = this.requestClearMessages.bind(this); var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl); this._shortcuts[shortcutL.key] = clearConsoleHandler; - this._contextMenu = new WebInspector.ContextMenu(); - this._contextMenu.appendItem(WebInspector.UIString("Clear Console"), clearConsoleHandler); var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("Console")); var keys = WebInspector.isMac() ? [ shortcutK.name, shortcutL.name ] : [ shortcutL.name ]; diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js index 5bde12f..ee85d1c 100644 --- a/WebCore/inspector/front-end/DOMAgent.js +++ b/WebCore/inspector/front-end/DOMAgent.js @@ -669,6 +669,9 @@ WebInspector.didRemoveAttribute = WebInspector.Callback.processCallback; WebInspector.didSetTextNodeValue = WebInspector.Callback.processCallback; WebInspector.didRemoveNode = WebInspector.Callback.processCallback; WebInspector.didChangeTagName = WebInspector.Callback.processCallback; +WebInspector.didGetOuterHTML = WebInspector.Callback.processCallback; +WebInspector.didSetOuterHTML = WebInspector.Callback.processCallback; +WebInspector.didPushNodeByPathToFrontend = WebInspector.Callback.processCallback; WebInspector.didGetEventListenersForNode = WebInspector.Callback.processCallback; WebInspector.didGetStyles = WebInspector.Callback.processCallback; diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index 55ba82d..c8eb3dd 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -59,7 +59,7 @@ WebInspector.ElementsPanel = function() this.panel.updateEventListeners(); if (this._focusedDOMNode) - InjectedScriptAccess.get(this._focusedDOMNode.injectedScriptId).addInspectedNode(this._focusedDOMNode.id, function() {}); + InspectorBackend.addInspectedNode(this._focusedDOMNode.id); }; this.contentElement.appendChild(this.treeOutline.element); @@ -224,9 +224,10 @@ WebInspector.ElementsPanel.prototype = { selectNode.call(this, node); } - if (this._selectedPathOnReset) - InjectedScriptAccess.getDefault().nodeByPath(this._selectedPathOnReset, selectLastSelectedNode.bind(this)); - else + if (this._selectedPathOnReset) { + var callId = WebInspector.Callback.wrap(selectLastSelectedNode.bind(this)); + InspectorBackend.pushNodeByPathToFrontend(callId, this._selectedPathOnReset); + } else selectNode.call(this); delete this._selectedPathOnReset; }, diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index e8fecb0..1b84b83 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -1094,7 +1094,7 @@ WebInspector.ElementsTreeElement.prototype = { function changeTagNameCallback(nodeId) { - if (nodeId === -1) { + if (!nodeId) { cancel(); return; } @@ -1111,7 +1111,7 @@ WebInspector.ElementsTreeElement.prototype = { } var callId = WebInspector.Callback.wrap(changeTagNameCallback); - InspectorBackend.changeTagName(callId, this.representedObject.id, newText, wasExpanded); + InspectorBackend.changeTagName(callId, this.representedObject.id, newText); }, _textNodeEditingCommitted: function(element, newText) @@ -1382,10 +1382,12 @@ WebInspector.ElementsTreeElement.prototype = { function commitChange(value) { - InjectedScriptAccess.get(node.injectedScriptId).setOuterHTML(node.id, value, wasExpanded, selectNode.bind(this)); + var setCallId = WebInspector.Callback.wrap(selectNode); + InspectorBackend.setOuterHTML(setCallId, node.id, value); } - InjectedScriptAccess.get(node.injectedScriptId).getNodePropertyValue(node.id, "outerHTML", this._startEditingAsHTML.bind(this, commitChange)); + var getCallId = WebInspector.Callback.wrap(this._startEditingAsHTML.bind(this, commitChange)); + InspectorBackend.getOuterHTML(getCallId, node.id); }, _copyHTML: function() diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index e62a916..26495e8 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -80,13 +80,6 @@ InjectedScript.releaseWrapperObjectGroup = function(objectGroupName) { delete InjectedScript.objectGroups[objectGroupName]; }; -// Called from within InspectorController on the 'inspected page' side. -InjectedScript.reset = function() -{ -} - -InjectedScript.reset(); - InjectedScript.dispatch = function(methodName, args, callId) { var argsArray = eval("(" + args + ")"); @@ -218,29 +211,6 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression } } -InjectedScript.getNodePropertyValue = function(nodeId, propertyName) -{ - var node = InjectedScript._nodeForId(nodeId); - if (!node) - return false; - var result = node[propertyName]; - return result !== undefined ? result : false; -} - -InjectedScript.setOuterHTML = function(nodeId, value, expanded) -{ - var node = InjectedScript._nodeForId(nodeId); - if (!node) - return false; - - var parent = node.parentNode; - var prevSibling = node.previousSibling; - node.outerHTML = value; - var newNode = prevSibling ? prevSibling.nextSibling : parent.firstChild; - - return InjectedScriptHost.pushNodePathToFrontend(newNode, expanded, false); -} - InjectedScript._populatePropertyNames = function(object, resultSet) { for (var o = object; o; o = o.__proto__) { @@ -281,14 +251,15 @@ InjectedScript.getCompletions = function(expression, includeInspectorCommandLine } else { if (!expression) expression = "this"; - expressionResult = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression); + expressionResult = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); } - if (typeof expressionResult == "object") + if (typeof expressionResult === "object") InjectedScript._populatePropertyNames(expressionResult, props); - if (includeInspectorCommandLineAPI) - for (var prop in inspectedWindow.console._inspectorCommandLineAPI) - if (prop.charAt(0) !== '_') - props[prop] = true; + + if (includeInspectorCommandLineAPI) { + for (var prop in InjectedScript._commandLineAPI) + props[prop] = true; + } } catch(e) { } return props; @@ -319,14 +290,21 @@ InjectedScript._evaluateAndWrap = function(evalFunction, object, expression, obj InjectedScript._evaluateOn = function(evalFunction, object, expression, dontUseCommandLineAPI) { - InjectedScript._ensureCommandLineAPIInstalled(evalFunction, object); - // Surround the expression in with statements to inject our command line API so that - // the window object properties still take more precedent than our API functions. - if (!dontUseCommandLineAPI) - expression = "with (window.console._inspectorCommandLineAPI) { with (window) {\n" + expression + "\n} }"; + if (!dontUseCommandLineAPI) { + // Only install command line api object for the time of evaluation. + + // Surround the expression in with statements to inject our command line API so that + // the window object properties still take more precedent than our API functions. + inspectedWindow.console._commandLineAPI = InjectedScript._commandLineAPI; + + expression = "with (window.console._commandLineAPI) { with (window) {\n" + expression + "\n} }"; + } var value = evalFunction.call(object, expression); + if (!dontUseCommandLineAPI) + delete inspectedWindow.console._commandLineAPI; + // When evaluating on call frame error is not thrown, but returned as a value. if (InjectedScript._type(value) === "error") throw value.toString(); @@ -334,20 +312,6 @@ InjectedScript._evaluateOn = function(evalFunction, object, expression, dontUseC return value; } -InjectedScript.addInspectedNode = function(nodeId) -{ - var node = InjectedScript._nodeForId(nodeId); - if (!node) - return false; - - InjectedScript._ensureCommandLineAPIInstalled(inspectedWindow.eval, inspectedWindow); - var inspectedNodes = inspectedWindow.console._inspectorCommandLineAPI._inspectedNodes; - inspectedNodes.unshift(node); - if (inspectedNodes.length >= 5) - inspectedNodes.pop(); - return true; -} - InjectedScript.getNodeId = function(node) { return InjectedScriptHost.pushNodePathToFrontend(node, false, false); @@ -392,125 +356,10 @@ InjectedScript._callFrameForId = function(id) return callFrame; } -InjectedScript.clearConsoleMessages = function() -{ - InjectedScriptHost.clearConsoleMessages(); - return true; -} - -InjectedScript._inspectObject = function(o) -{ - if (arguments.length === 0) - return; - - inspectedWindow.console.log(o); - if (InjectedScript._type(o) === "node") { - InjectedScriptHost.pushNodePathToFrontend(o, false, true); - } else { - switch (InjectedScript._describe(o)) { - case "Database": - InjectedScriptHost.selectDatabase(o); - break; - case "Storage": - InjectedScriptHost.selectDOMStorage(o); - break; - } - } -} - -InjectedScript._copy = function(o) -{ - if (InjectedScript._type(o) === "node") { - var nodeId = InjectedScriptHost.pushNodePathToFrontend(o, false, false); - InjectedScriptHost.copyNode(nodeId); - } else { - InjectedScriptHost.copyText(o); - } -} - -InjectedScript._ensureCommandLineAPIInstalled = function(evalFunction, evalObject) -{ - if (evalFunction.call(evalObject, "window.console._inspectorCommandLineAPI")) - return; - var inspectorCommandLineAPI = evalFunction.call(evalObject, "window.console._inspectorCommandLineAPI = { \n\ - $: function() { return document.getElementById.apply(document, arguments) }, \n\ - $$: function() { return document.querySelectorAll.apply(document, arguments) }, \n\ - $x: function(xpath, context) \n\ - { \n\ - var nodes = []; \n\ - try { \n\ - var doc = context || document; \n\ - var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); \n\ - var node; \n\ - while (node = results.iterateNext()) nodes.push(node); \n\ - } catch (e) {} \n\ - return nodes; \n\ - }, \n\ - dir: function() { return console.dir.apply(console, arguments) }, \n\ - dirxml: function() { return console.dirxml.apply(console, arguments) }, \n\ - keys: function(o) { var a = []; for (var k in o) a.push(k); return a; }, \n\ - values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \n\ - profile: function() { return console.profile.apply(console, arguments) }, \n\ - profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \n\ - _logEvent: function _inspectorCommandLineAPI_logEvent(e) { console.log(e.type, e); }, \n\ - _allEventTypes: [\"mouse\", \"key\", \"load\", \"unload\", \"abort\", \"error\", \n\ - \"select\", \"change\", \"submit\", \"reset\", \"focus\", \"blur\", \n\ - \"resize\", \"scroll\"], \n\ - _normalizeEventTypes: function(t) \n\ - { \n\ - if (typeof t === \"undefined\") \n\ - t = console._inspectorCommandLineAPI._allEventTypes; \n\ - else if (typeof t === \"string\") \n\ - t = [t]; \n\ - var i, te = []; \n\ - for (i = 0; i < t.length; i++) { \n\ - if (t[i] === \"mouse\") \n\ - te.splice(0, 0, \"mousedown\", \"mouseup\", \"click\", \"dblclick\", \n\ - \"mousemove\", \"mouseover\", \"mouseout\"); \n\ - else if (t[i] === \"key\") \n\ - te.splice(0, 0, \"keydown\", \"keyup\", \"keypress\"); \n\ - else \n\ - te.push(t[i]); \n\ - } \n\ - return te; \n\ - }, \n\ - monitorEvents: function(o, t) \n\ - { \n\ - if (!o || !o.addEventListener || !o.removeEventListener) \n\ - return; \n\ - t = console._inspectorCommandLineAPI._normalizeEventTypes(t); \n\ - for (i = 0; i < t.length; i++) { \n\ - o.removeEventListener(t[i], console._inspectorCommandLineAPI._logEvent, false); \n\ - o.addEventListener(t[i], console._inspectorCommandLineAPI._logEvent, false); \n\ - } \n\ - }, \n\ - unmonitorEvents: function(o, t) \n\ - { \n\ - if (!o || !o.removeEventListener) \n\ - return; \n\ - t = console._inspectorCommandLineAPI._normalizeEventTypes(t); \n\ - for (i = 0; i < t.length; i++) { \n\ - o.removeEventListener(t[i], console._inspectorCommandLineAPI._logEvent, false); \n\ - } \n\ - }, \n\ - _inspectedNodes: [], \n\ - get $0() { return console._inspectorCommandLineAPI._inspectedNodes[0] }, \n\ - get $1() { return console._inspectorCommandLineAPI._inspectedNodes[1] }, \n\ - get $2() { return console._inspectorCommandLineAPI._inspectedNodes[2] }, \n\ - get $3() { return console._inspectorCommandLineAPI._inspectedNodes[3] }, \n\ - get $4() { return console._inspectorCommandLineAPI._inspectedNodes[4] }, \n\ - };"); - - inspectorCommandLineAPI.clear = InjectedScript.clearConsoleMessages; - inspectorCommandLineAPI.inspect = InjectedScript._inspectObject; - inspectorCommandLineAPI.copy = InjectedScript._copy; -} - InjectedScript._resolveObject = function(objectProxy) { var object = InjectedScript._objectForId(objectProxy.objectId); var path = objectProxy.path; - var protoDepth = objectProxy.protoDepth; // Follow the property path. for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i) @@ -532,11 +381,11 @@ InjectedScript._objectForId = function(objectId) // - numbers point to DOM Node via the InspectorDOMAgent mapping // - strings point to console objects cached in InspectorController for lazy evaluation upon them // - objects contain complex ids and are currently used for scoped objects - if (typeof objectId === "number") { + if (typeof objectId === "number") return InjectedScript._nodeForId(objectId); - } else if (typeof objectId === "string") { + else if (typeof objectId === "string") return InjectedScript.unwrapObject(objectId); - } else if (typeof objectId === "object") { + else if (typeof objectId === "object") { var callFrame = InjectedScript._callFrameForId(objectId.callFrame); if (objectId.thisObject) return callFrame.thisObject; @@ -554,13 +403,6 @@ InjectedScript.pushNodeToFrontend = function(objectProxy) return InjectedScriptHost.pushNodePathToFrontend(object, false, false); } -InjectedScript.nodeByPath = function(path) -{ - // We make this call through the injected script only to get a nice - // callback for it. - return InjectedScriptHost.pushNodeByPathToFrontend(path.join(",")); -} - // Called from within InspectorController on the 'inspected page' side. InjectedScript.createProxyObject = function(object, objectId, abbreviate) { @@ -736,14 +578,13 @@ InjectedScript._type = function(obj) InjectedScript._describe = function(obj, abbreviated) { - var type1 = InjectedScript._type(obj); - var type2 = InjectedScript._className(obj); + var type = InjectedScript._type(obj); - switch (type1) { + switch (type) { case "object": case "node": case "array": - return type2; + return InjectedScript._className(obj); case "string": if (!abbreviated) return obj; @@ -752,10 +593,8 @@ InjectedScript._describe = function(obj, abbreviated) return "\"" + obj + "\""; case "function": var objectText = InjectedScript._toString(obj); - if (!/^function /.test(objectText)) - objectText = (type2 == "object") ? type1 : type2; - else if (abbreviated) - objectText = /.*/.exec(obj)[0].replace(/ +$/g, ""); + if (abbreviated) + objectText = /.*/.exec(objectText)[0].replace(/ +$/g, ""); return objectText; default: return InjectedScript._toString(obj); @@ -779,11 +618,185 @@ InjectedScript._className = function(obj) return str.replace(/^\[object (.*)\]$/i, "$1"); } else { // V8 - if (typeof obj !== "object") - return "null"; - return obj.constructor.name || "Object"; + return obj.constructor && obj.constructor.name || "Object"; + } +} + +InjectedScript._logEvent = function(event) +{ + console.log(event.type, event); +} + +InjectedScript._normalizeEventTypes = function(types) +{ + if (typeof types === "undefined") + types = [ "mouse", "key", "load", "unload", "abort", "error", "select", "change", "submit", "reset", "focus", "blur", "resize", "scroll" ]; + else if (typeof types === "string") + types = [ types ]; + + var result = []; + for (var i = 0; i < types.length; i++) { + if (types[i] === "mouse") + result.splice(0, 0, "mousedown", "mouseup", "click", "dblclick", "mousemove", "mouseover", "mouseout"); + else if (types[i] === "key") + result.splice(0, 0, "keydown", "keyup", "keypress"); + else + result.push(types[i]); + } + return result; +} + +InjectedScript._inspectedNode = function(num) +{ + var nodeId = InjectedScriptHost.inspectedNode(num); + return InjectedScript._nodeForId(nodeId); +} + +function CommandLineAPI() +{ +} + +CommandLineAPI.prototype = { + // Only add API functions here, private stuff should go to + // InjectedScript so that it is not suggested by the completion. + $: function() + { + return document.getElementById.apply(document, arguments) + }, + + $$: function() + { + return document.querySelectorAll.apply(document, arguments) + }, + + $x: function(xpath, context) + { + var nodes = []; + try { + var doc = context || document; + var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); + var node; + while (node = results.iterateNext()) + nodes.push(node); + } catch (e) { + } + return nodes; + }, + + dir: function() + { + return console.dir.apply(console, arguments) + }, + + dirxml: function() + { + return console.dirxml.apply(console, arguments) + }, + + keys: function(object) + { + return Object.keys(object); + }, + + values: function(object) + { + var result = []; + for (var key in object) + result.push(object[key]); + return result; + }, + + profile: function() + { + return console.profile.apply(console, arguments) + }, + + profileEnd: function() + { + return console.profileEnd.apply(console, arguments) + }, + + monitorEvents: function(object, types) + { + if (!object || !object.addEventListener || !object.removeEventListener) + return; + types = InjectedScript._normalizeEventTypes(types); + for (var i = 0; i < types.length; ++i) { + object.removeEventListener(types[i], InjectedScript._logEvent, false); + object.addEventListener(types[i], InjectedScript._logEvent, false); + } + }, + + unmonitorEvents: function(object, types) + { + if (!object || !object.addEventListener || !object.removeEventListener) + return; + types = InjectedScript._normalizeEventTypes(types); + for (var i = 0; i < types.length; ++i) + object.removeEventListener(types[i], InjectedScript._logEvent, false); + }, + + inspect: function(object) + { + if (arguments.length === 0) + return; + + inspectedWindow.console.log(object); + if (InjectedScript._type(object) === "node") + InjectedScriptHost.pushNodePathToFrontend(object, false, true); + else { + switch (InjectedScript._describe(object)) { + case "Database": + InjectedScriptHost.selectDatabase(object); + break; + case "Storage": + InjectedScriptHost.selectDOMStorage(object); + break; + } + } + }, + + copy: function(object) + { + if (InjectedScript._type(object) === "node") { + var nodeId = InjectedScriptHost.pushNodePathToFrontend(object, false, false); + InjectedScriptHost.copyNode(nodeId); + } else + InjectedScriptHost.copyText(object); + }, + + clear: function() + { + InjectedScriptHost.clearConsoleMessages(); + }, + + get $0() + { + return InjectedScript._inspectedNode(0); + }, + + get $1() + { + return InjectedScript._inspectedNode(1); + }, + + get $2() + { + return InjectedScript._inspectedNode(2); + }, + + get $3() + { + return InjectedScript._inspectedNode(3); + }, + + get $4() + { + return InjectedScript._inspectedNode(4); } } +InjectedScript._commandLineAPI = new CommandLineAPI(); + return InjectedScript; }); diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js index c388213..90daab7 100644 --- a/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -70,18 +70,13 @@ InjectedScriptAccess._installHandler = function(methodName, async) // - Make sure corresponding methods in InjectedScript return non-null and non-undefined values, // - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function. // We keep these sorted. -InjectedScriptAccess._installHandler("addInspectedNode"); -InjectedScriptAccess._installHandler("clearConsoleMessages"); InjectedScriptAccess._installHandler("evaluate"); InjectedScriptAccess._installHandler("evaluateInCallFrame"); InjectedScriptAccess._installHandler("getCompletions"); -InjectedScriptAccess._installHandler("getNodePropertyValue"); InjectedScriptAccess._installHandler("getProperties"); InjectedScriptAccess._installHandler("getPrototypes"); InjectedScriptAccess._installHandler("openInInspectedWindow"); InjectedScriptAccess._installHandler("pushNodeToFrontend"); -InjectedScriptAccess._installHandler("nodeByPath"); -InjectedScriptAccess._installHandler("setOuterHTML"); InjectedScriptAccess._installHandler("setPropertyValue"); InjectedScriptAccess._installHandler("evaluateOnSelf"); diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js index 492bf87..1ae32b5 100644 --- a/WebCore/inspector/front-end/InspectorBackendStub.js +++ b/WebCore/inspector/front-end/InspectorBackendStub.js @@ -32,7 +32,6 @@ if (!window.InspectorBackend) { WebInspector.InspectorBackendStub = function() { - this._searchingForNode = false; this._attachedWindowHeight = 0; this._timelineEnabled = false; } @@ -60,25 +59,23 @@ WebInspector.InspectorBackendStub.prototype = { { }, - clearMessages: function() + clearConsoleMessages: function() { }, - searchingForNode: function() + getOuterHTML: function() { - return this._searchingForNode; }, - search: function(sourceRow, query) + setOuterHTML: function() { }, - toggleNodeSearch: function() + addInspectedNode: function() { - this._searchingForNode = !this._searchingForNode; }, - setAttachedWindowHeight: function(height) + search: function(sourceRow, query) { }, @@ -144,6 +141,16 @@ WebInspector.InspectorBackendStub.prototype = { WebInspector.searchingForNodeWasDisabled(); }, + enableMonitoringXHR: function() + { + WebInspector.monitoringXHRWasEnabled(); + }, + + disableMonitoringXHR: function() + { + WebInspector.monitoringXHRWasDisabled(); + }, + reloadPage: function() { }, diff --git a/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/WebCore/inspector/front-end/InspectorFrontendHostStub.js index 5456069..39bbe02 100644 --- a/WebCore/inspector/front-end/InspectorFrontendHostStub.js +++ b/WebCore/inspector/front-end/InspectorFrontendHostStub.js @@ -40,7 +40,13 @@ WebInspector._platformFlavor = WebInspector.PlatformFlavor.MacLeopard; WebInspector.InspectorFrontendHostStub.prototype = { platform: function() { - return "mac"; + var match = navigator.userAgent.match(/Windows NT/); + if (match) + return "windows"; + match = navigator.userAgent.match(/Mac OS X/); + if (match) + return "mac"; + return "linux"; }, port: function() diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js index 1980fa5..b5122af 100644 --- a/WebCore/inspector/front-end/ProfilesPanel.js +++ b/WebCore/inspector/front-end/ProfilesPanel.js @@ -124,7 +124,7 @@ WebInspector.ProfilesPanel = function() this._profiles = []; this._profilerEnabled = Preferences.profilerAlwaysEnabled; - this.reset(); + this._reset(); } WebInspector.ProfilesPanel.prototype = { @@ -167,7 +167,7 @@ WebInspector.ProfilesPanel.prototype = { populateInterface: function() { - this.reset(); + this._reset(); if (this.visible) this._populateProfiles(); else @@ -189,10 +189,15 @@ WebInspector.ProfilesPanel.prototype = { return; this._profilerEnabled = false; - this.reset(); + this._reset(); }, - reset: function() + resetProfiles: function() + { + this._reset(); + }, + + _reset: function() { for (var i = 0; i < this._profiles.length; ++i) delete this._profiles[i]._profileView; @@ -222,7 +227,7 @@ WebInspector.ProfilesPanel.prototype = { _clearProfiles: function() { InspectorBackend.clearProfiles(); - this.reset(); + this._reset(); }, registerProfileType: function(profileType) @@ -618,7 +623,8 @@ WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle) WebInspector.ProfileGroupSidebarTreeElement.prototype = { onselect: function() { - WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile); + if (this.children.length > 0) + WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile); } } diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js index fb0bb4b..1883fb3 100644 --- a/WebCore/inspector/front-end/ScriptView.js +++ b/WebCore/inspector/front-end/ScriptView.js @@ -105,7 +105,12 @@ WebInspector.ScriptView.prototype = { this.sourceFrame.updateContent(this._prependWhitespace(newBody)); }, - // The follow methods are pulled from SourceView, since they are + _sourceIDForLine: function(line) + { + return this.script.sourceID; + }, + + // The following methods are pulled from SourceView, since they are // generic and work with ScriptView just fine. hide: WebInspector.SourceView.prototype.hide, diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 4504d57..c23db14 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -169,8 +169,6 @@ WebInspector.ScriptsPanel = function() this._registerShortcuts(); this._debuggerEnabled = Preferences.debuggerAlwaysEnabled; - if (Preferences.debuggerAlwaysEnabled) - this._attachDebuggerWhenShown = true; WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this); WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this); diff --git a/WebCore/inspector/front-end/Section.js b/WebCore/inspector/front-end/Section.js index 7710192..913d495 100644 --- a/WebCore/inspector/front-end/Section.js +++ b/WebCore/inspector/front-end/Section.js @@ -82,7 +82,22 @@ WebInspector.Section.prototype = { if (this._subtitle === x) return; this._subtitle = x; - this.subtitleElement.innerHTML = x; + this.subtitleElement.setAttribute("data-uncopyable", x); + }, + + get subtitleAsText() + { + var result = ""; + var data = this.subtitleElement.getAttribute("data-uncopyable"); + if (data) + result += data; + var child = this.subtitleElement.querySelector("[data-uncopyable]"); + if (child) { + var linkData = child.getAttribute("data-uncopyable"); + if (linkData) + result += linkData; + } + return result; }, get expanded() diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js index ca1b276..fef7802 100644 --- a/WebCore/inspector/front-end/StoragePanel.js +++ b/WebCore/inspector/front-end/StoragePanel.js @@ -289,6 +289,7 @@ WebInspector.StoragePanel.prototype = { var column = {}; column.width = columnIdentifier.length; column.title = columnIdentifier; + column.sortable = true; columns[columnIdentifier] = column; ++numColumns; @@ -313,9 +314,45 @@ WebInspector.StoragePanel.prototype = { for (var i = 0; i < length; ++i) dataGrid.appendChild(nodes[i]); + dataGrid.addEventListener("sorting changed", this._sortDataGrid.bind(this, dataGrid), this); return dataGrid; }, + _sortDataGrid: function(dataGrid) + { + var nodes = dataGrid.children.slice(); + var sortColumnIdentifier = dataGrid.sortColumnIdentifier; + var sortDirection = dataGrid.sortOrder === "ascending" ? 1 : -1; + var columnIsNumeric = true; + + for (var i = 0; i < nodes.length; i++) { + if (isNaN(Number(nodes[i].data[sortColumnIdentifier]))) + columnIsNumeric = false; + } + + function comparator(dataGridNode1, dataGridNode2) + { + var item1 = dataGridNode1.data[sortColumnIdentifier]; + var item2 = dataGridNode2.data[sortColumnIdentifier]; + + var comparison; + if (columnIsNumeric) { + // Sort numbers based on comparing their values rather than a lexicographical comparison. + var number1 = parseFloat(item1); + var number2 = parseFloat(item2); + comparison = number1 < number2 ? -1 : (number1 > number2 ? 1 : 0); + } else + comparison = item1 < item2 ? -1 : (item1 > item2 ? 1 : 0); + + return sortDirection * comparison; + } + + nodes.sort(comparator); + dataGrid.removeChildren(); + for (var i = 0; i < nodes.length; i++) + dataGrid.appendChild(nodes[i]); + }, + updateDOMStorage: function(storageId) { var domStorage = this._domStorageForId(storageId); diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js index 18b7f0f..649b9d0 100644 --- a/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/WebCore/inspector/front-end/StylesSidebarPane.js @@ -651,7 +651,10 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl if (!subtitle) { if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href) { var url = this.styleRule.parentStyleSheet.href; - this.subtitleElement.appendChild(WebInspector.linkifyResourceAsNode(url, "resources", this.rule.sourceLine + 1)); + var link = WebInspector.linkifyResourceAsNode(url, "resources", this.rule.sourceLine + 1); + link.setAttribute("data-uncopyable", link.textContent); + link.textContent = ""; + this.subtitleElement.appendChild(link); } else if (isUserAgent) subtitle = WebInspector.UIString("user agent stylesheet"); else if (isUser) @@ -669,7 +672,7 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl this.identifier = styleRule.selectorText; if (this.subtitle) - this.identifier += ":" + this.subtitleElement.textContent; + this.identifier += ":" + this.subtitle; } WebInspector.StylePropertiesSection.prototype = { @@ -1315,6 +1318,18 @@ WebInspector.StylePropertyTreeElement.prototype = { event.stopPropagation(); }, + restoreNameElement: function() + { + // Restore <span class="webkit-css-property"> if it doesn't yet exist or was accidentally deleted. + if (this.nameElement === this.listItemElement.querySelector(".webkit-css-property")) + return; + + this.nameElement = document.createElement("span"); + this.nameElement.className = "webkit-css-property"; + this.nameElement.textContent = ""; + this.listItemElement.insertBefore(this.nameElement, this.listItemElement.firstChild); + }, + startEditing: function(selectElement) { // FIXME: we don't allow editing of longhand properties under a shorthand right now. @@ -1324,7 +1339,12 @@ WebInspector.StylePropertyTreeElement.prototype = { if (WebInspector.isBeingEdited(this.listItemElement) || (this.treeOutline.section && !this.treeOutline.section.editable)) return; - var context = { expanded: this.expanded, hasChildren: this.hasChildren, keyDownListener: this.editingKeyDown.bind(this) }; + var context = { + expanded: this.expanded, + hasChildren: this.hasChildren, + keyDownListener: this.editingKeyDown.bind(this), + keyPressListener: this.editingKeyPress.bind(this) + }; // Lie about our children to prevent expanding on double click and to collapse shorthands. this.hasChildren = false; @@ -1333,11 +1353,42 @@ WebInspector.StylePropertyTreeElement.prototype = { selectElement = this.listItemElement; this.listItemElement.addEventListener("keydown", context.keyDownListener, false); + this.listItemElement.addEventListener("keypress", context.keyPressListener, false); WebInspector.startEditing(this.listItemElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context); window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1); }, + editingKeyPress: function(event) + { + var selection = window.getSelection(); + var colonIndex = this.listItemElement.textContent.indexOf(":"); + var selectionLeftOffset = event.target.selectionLeftOffset; + + if (colonIndex < 0 || selectionLeftOffset <= colonIndex) { + // Complete property names. + var character = event.data.toLowerCase(); + if (character && /[a-z-]/.test(character)) { + var prefix = selection.anchorNode.textContent.substring(0, selection.anchorOffset); + var property = WebInspector.CSSCompletions.firstStartsWith(prefix + character); + + if (!selection.isCollapsed) + selection.deleteFromDocument(); + + this.restoreNameElement(); + + if (property) { + if (property !== this.nameElement.textContent) + this.nameElement.textContent = property; + this.nameElement.firstChild.select(prefix.length + 1); + event.preventDefault(); + } + } + } else { + // FIXME: This should complete property values. + } + }, + editingKeyDown: function(event) { var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down"); @@ -1396,9 +1447,24 @@ WebInspector.StylePropertyTreeElement.prototype = { } replacementString = prefix + number + suffix; - } else { - // FIXME: this should cycle through known keywords for the current property name. + } else if (selection.containsNode(this.nameElement, true)) { + var prefix = selectionRange.startContainer.textContent.substring(0, selectionRange.startOffset); + var property; + + if (event.keyIdentifier === "Up") + property = WebInspector.CSSCompletions.previous(wordString, prefix); + else if (event.keyIdentifier === "Down") + property = WebInspector.CSSCompletions.next(wordString, prefix); + + var startOffset = selectionRange.startOffset; + if (property) { + this.nameElement.textContent = property; + this.nameElement.firstChild.select(startOffset); + } + event.preventDefault(); return; + } else { + // FIXME: this should cycle through known keywords for the current property value. } var replacementTextNode = document.createTextNode(replacementString); @@ -1434,6 +1500,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (context.expanded) this.expand(); this.listItemElement.removeEventListener("keydown", context.keyDownListener, false); + this.listItemElement.removeEventListener("keypress", context.keyPressListener, false); delete this.originalCSSText; }, diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index fd84586..add50e1 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -19,6 +19,7 @@ <file>ConsoleView.js</file> <file>ContextMenu.js</file> <file>CookieItemsView.js</file> + <file>CSSCompletions.js</file> <file>CSSStyleModel.js</file> <file>Database.js</file> <file>DatabaseQueryView.js</file> diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index 52b85bc..b92672a 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -27,6 +27,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +html { + height: 100%; +} + body { cursor: default; position: absolute; @@ -4038,6 +4042,10 @@ a.worker-item { color: inherit; } +.styles-section .subtitle::before, .styles-section .subtitle a::before { + content: attr(data-uncopyable); +} + .styles-section .properties { display: none; margin: 0; diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index 4c51634..8a8b7d5 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -82,6 +82,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="PropertiesSidebarPane.js"></script> <script type="text/javascript" src="EventListenersSidebarPane.js"></script> <script type="text/javascript" src="Color.js"></script> + <script type="text/javascript" src="CSSCompletions.js"></script> <script type="text/javascript" src="StylesSidebarPane.js"></script> <script type="text/javascript" src="PanelEnablerView.js"></script> <script type="text/javascript" src="WelcomeView.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index e8108af..3bb4180 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -1297,6 +1297,16 @@ WebInspector.searchingForNodeWasDisabled = function() this.panels.elements.searchingForNodeWasDisabled(); } +WebInspector.monitoringXHRWasEnabled = function() +{ + this.monitoringXHREnabled = true; +} + +WebInspector.monitoringXHRWasDisabled = function() +{ + this.monitoringXHREnabled = false; +} + WebInspector.attachDebuggerWhenShown = function() { this.panels.scripts.attachDebuggerWhenShown(); @@ -1334,7 +1344,7 @@ WebInspector.parsedScriptSource = function(sourceID, sourceURL, source, starting WebInspector.restoredBreakpoint = function(sourceID, sourceURL, line, enabled, condition) { - this.breakpointManager.addBreakpoint(sourceID, sourceURL, line, enabled, condition); + this.breakpointManager.restoredBreakpoint(sourceID, sourceURL, line, enabled, condition); } WebInspector.failedToParseScriptSource = function(sourceURL, source, startingLine, errorLine, errorMessage) @@ -1385,6 +1395,12 @@ WebInspector.reset = function() this.console.clearMessages(); } +WebInspector.resetProfilesPanel = function() +{ + if (WebInspector.panels.profiles) + WebInspector.panels.profiles.resetProfiles(); +} + WebInspector.bringToFront = function() { InspectorFrontendHost.bringToFront(); diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js index bb19dbd..1312e5b 100644 --- a/WebCore/inspector/front-end/utilities.js +++ b/WebCore/inspector/front-end/utilities.js @@ -328,6 +328,63 @@ Element.prototype.offsetRelativeToWindow = function(targetWindow) return elementOffset; } +KeyboardEvent.prototype.__defineGetter__("data", function() +{ + // Emulate "data" attribute from DOM 3 TextInput event. + // See http://www.w3.org/TR/DOM-Level-3-Events/#events-Events-TextEvent-data + switch (this.type) { + case "keypress": + if (!this.ctrlKey && !this.metaKey) + return String.fromCharCode(this.charCode); + else + return ""; + case "keydown": + case "keyup": + if (!this.ctrlKey && !this.metaKey && !this.altKey) + return String.fromCharCode(this.which); + else + return ""; + } +}); + +Text.prototype.select = function(start, end) +{ + start = start || 0; + end = end || this.textContent.length; + + if (start < 0) + start = end + start; + + var selection = window.getSelection(); + selection.removeAllRanges(); + var range = document.createRange(); + range.setStart(this, start); + range.setEnd(this, end); + selection.addRange(range); + return this; +} + +Element.prototype.__defineGetter__("selectionLeftOffset", function() { + // Calculate selection offset relative to the current element. + + var selection = window.getSelection(); + if (!selection.containsNode(this, true)) + return null; + + var leftOffset = selection.anchorOffset; + var node = selection.anchorNode; + + while (node !== this) { + while (node.previousSibling) { + node = node.previousSibling; + leftOffset += node.textContent.length; + } + node = node.parentNode; + } + + return leftOffset; +}); + Node.prototype.isWhitespace = isNodeWhitespace; Node.prototype.displayName = nodeDisplayName; Node.prototype.isAncestor = function(node) @@ -672,6 +729,12 @@ Array.prototype.keySet = function() return keys; } +Array.convert = function(list) +{ + // Cast array-like object to an array. + return Array.prototype.slice.call(list); +} + function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction) { // indexOf returns (-lowerBound - 1). Taking (-result - 1) works out to lowerBound. diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp index af0c235..71dd8f9 100644 --- a/WebCore/loader/CachedFont.cpp +++ b/WebCore/loader/CachedFont.cpp @@ -136,7 +136,7 @@ bool CachedFont::ensureSVGFontData() { ASSERT(m_isSVGFont); if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) { - m_externalSVGDocument = SVGDocument::create(0); + m_externalSVGDocument = SVGDocument::create(0, KURL()); m_externalSVGDocument->open(); RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); diff --git a/WebCore/loader/CrossOriginPreflightResultCache.h b/WebCore/loader/CrossOriginPreflightResultCache.h index f8a7c55..8e5b239 100644 --- a/WebCore/loader/CrossOriginPreflightResultCache.h +++ b/WebCore/loader/CrossOriginPreflightResultCache.h @@ -24,8 +24,8 @@ * */ -#ifndef CrossOriginPreflightResultCacheItem_h -#define CrossOriginPreflightResultCacheItem_h +#ifndef CrossOriginPreflightResultCache_h +#define CrossOriginPreflightResultCache_h #include "KURLHash.h" #include "StringHash.h" diff --git a/WebCore/loader/DocumentWriter.cpp b/WebCore/loader/DocumentWriter.cpp index cc2632b..2ea1afd 100644 --- a/WebCore/loader/DocumentWriter.cpp +++ b/WebCore/loader/DocumentWriter.cpp @@ -34,6 +34,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "FrameLoaderStateMachine.h" #include "FrameView.h" #include "PlaceholderDocument.h" #include "PluginDocument.h" @@ -58,11 +59,26 @@ DocumentWriter::DocumentWriter(Frame* frame) { } -void DocumentWriter::replaceDocument(const String& html) +// This is only called by ScriptController::executeIfJavaScriptURL +// and always contains the result of evaluating a javascript: url. +// This is the <iframe src="javascript:'html'"> case. +void DocumentWriter::replaceDocument(const String& source) { m_frame->loader()->stopAllLoaders(); begin(m_frame->loader()->url(), true, m_frame->document()->securityOrigin()); - addData(html); + + if (!source.isNull()) { + if (!m_receivedData) { + m_receivedData = true; + m_frame->document()->setParseMode(Document::Strict); + } + + // FIXME: If we wanted to support the <img src='javascript:'imagedata'> + // case then we would need to call addData(char*, int) instead. + if (DocumentParser* parser = m_frame->document()->parser()) + parser->write(source, true); + } + end(); } @@ -79,13 +95,13 @@ void DocumentWriter::begin() begin(KURL()); } -PassRefPtr<Document> DocumentWriter::createDocument() +PassRefPtr<Document> DocumentWriter::createDocument(const KURL& url) { - if (!m_frame->loader()->isDisplayingInitialEmptyDocument() && m_frame->loader()->client()->shouldUsePluginDocument(m_mimeType)) - return PluginDocument::create(m_frame); + if (!m_frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->loader()->client()->shouldUsePluginDocument(m_mimeType)) + return PluginDocument::create(m_frame, url); if (!m_frame->loader()->client()->hasHTMLView()) - return PlaceholderDocument::create(m_frame); - return DOMImplementation::createDocument(m_mimeType, m_frame, m_frame->inViewSourceMode()); + return PlaceholderDocument::create(m_frame, url); + return DOMImplementation::createDocument(m_mimeType, m_frame, url, m_frame->inViewSourceMode()); } void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) @@ -96,20 +112,19 @@ void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origi // Create a new document before clearing the frame, because it may need to // inherit an aliased security context. - RefPtr<Document> document = createDocument(); + RefPtr<Document> document = createDocument(url); // If the new document is for a Plugin but we're supposed to be sandboxed from Plugins, // then replace the document with one whose parser will ignore the incoming data (bug 39323) if (document->isPluginDocument() && m_frame->loader()->isSandboxed(SandboxPlugins)) - document = SinkDocument::create(m_frame); + document = SinkDocument::create(m_frame, url); - bool resetScripting = !(m_frame->loader()->isDisplayingInitialEmptyDocument() && m_frame->document()->securityOrigin()->isSecureTransitionTo(url)); + bool resetScripting = !(m_frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->document()->securityOrigin()->isSecureTransitionTo(url)); m_frame->loader()->clear(resetScripting, resetScripting); if (resetScripting) m_frame->script()->updatePlatformScriptObjects(); m_frame->loader()->setURL(url); - document->setURL(url); m_frame->setDocument(document); if (m_decoder) @@ -192,20 +207,6 @@ void DocumentWriter::addData(const char* str, int len, bool flush) } } -void DocumentWriter::addData(const String& str) -{ - if (str.isNull()) - return; - - if (!m_receivedData) { - m_receivedData = true; - m_frame->document()->setParseMode(Document::Strict); - } - - if (DocumentParser* parser = m_frame->document()->parser()) - parser->write(str, true); -} - void DocumentWriter::end() { m_frame->loader()->didEndDocument(); diff --git a/WebCore/loader/DocumentWriter.h b/WebCore/loader/DocumentWriter.h index a06fb7f..6644093 100644 --- a/WebCore/loader/DocumentWriter.h +++ b/WebCore/loader/DocumentWriter.h @@ -43,12 +43,13 @@ class DocumentWriter : public Noncopyable { public: DocumentWriter(Frame*); + // This is only called by ScriptController::executeIfJavaScriptURL + // and always contains the result of evaluating a javascript: url. void replaceDocument(const String&); void begin(); void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOrigin* forcedSecurityOrigin = 0); void addData(const char* string, int length = -1, bool flush = false); - void addData(const String&); void end(); void endIfNotLoadingMainResource(); void clear(); @@ -67,7 +68,7 @@ public: void setDecoder(TextResourceDecoder*); private: - PassRefPtr<Document> createDocument(); + PassRefPtr<Document> createDocument(const KURL&); Frame* m_frame; diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index 5d1b2bf..2a19fa3 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -29,7 +29,7 @@ #include "CharacterNames.h" #include "HTMLNames.h" #include "HTMLTableElement.h" -#include "HTMLDocumentParser.h" +#include "LegacyHTMLDocumentParser.h" #include "LocalizedStrings.h" #include "Logging.h" #include "FTPDirectoryParser.h" @@ -48,7 +48,7 @@ namespace WebCore { using namespace HTMLNames; -class FTPDirectoryDocumentParser : public HTMLDocumentParser { +class FTPDirectoryDocumentParser : public LegacyHTMLDocumentParser { public: FTPDirectoryDocumentParser(HTMLDocument*); @@ -80,7 +80,6 @@ private: void appendEntry(const String& name, const String& size, const String& date, bool isDirectory); PassRefPtr<Element> createTDForFilename(const String&); - Document* m_doc; RefPtr<HTMLTableElement> m_tableElement; bool m_skipLF; @@ -94,9 +93,8 @@ private: ListState m_listState; }; -FTPDirectoryDocumentParser::FTPDirectoryDocumentParser(HTMLDocument* doc) - : HTMLDocumentParser(doc, false) - , m_doc(doc) +FTPDirectoryDocumentParser::FTPDirectoryDocumentParser(HTMLDocument* document) + : LegacyHTMLDocumentParser(document, false) , m_skipLF(false) , m_parsedTemplate(false) , m_size(254) @@ -112,8 +110,8 @@ void FTPDirectoryDocumentParser::appendEntry(const String& filename, const Strin RefPtr<Element> rowElement = m_tableElement->insertRow(-1, ec); rowElement->setAttribute("class", "ftpDirectoryEntryRow", ec); - RefPtr<Element> element = m_doc->createElement(tdTag, false); - element->appendChild(Text::create(m_doc, String(&noBreakSpace, 1)), ec); + RefPtr<Element> element = document()->createElement(tdTag, false); + element->appendChild(Text::create(document(), String(&noBreakSpace, 1)), ec); if (isDirectory) element->setAttribute("class", "ftpDirectoryIcon ftpDirectoryTypeDirectory", ec); else @@ -124,13 +122,13 @@ void FTPDirectoryDocumentParser::appendEntry(const String& filename, const Strin element->setAttribute("class", "ftpDirectoryFileName", ec); rowElement->appendChild(element, ec); - element = m_doc->createElement(tdTag, false); - element->appendChild(Text::create(m_doc, date), ec); + element = document()->createElement(tdTag, false); + element->appendChild(Text::create(document(), date), ec); element->setAttribute("class", "ftpDirectoryFileDate", ec); rowElement->appendChild(element, ec); - element = m_doc->createElement(tdTag, false); - element->appendChild(Text::create(m_doc, size), ec); + element = document()->createElement(tdTag, false); + element->appendChild(Text::create(document(), size), ec); element->setAttribute("class", "ftpDirectoryFileSize", ec); rowElement->appendChild(element, ec); } @@ -139,17 +137,17 @@ PassRefPtr<Element> FTPDirectoryDocumentParser::createTDForFilename(const String { ExceptionCode ec; - String fullURL = m_doc->baseURL().string(); + String fullURL = document()->baseURL().string(); if (fullURL[fullURL.length() - 1] == '/') fullURL.append(filename); else fullURL.append("/" + filename); - RefPtr<Element> anchorElement = m_doc->createElement(aTag, false); + RefPtr<Element> anchorElement = document()->createElement(aTag, false); anchorElement->setAttribute("href", fullURL, ec); - anchorElement->appendChild(Text::create(m_doc, filename), ec); + anchorElement->appendChild(Text::create(document(), filename), ec); - RefPtr<Element> tdElement = m_doc->createElement(tdTag, false); + RefPtr<Element> tdElement = document()->createElement(tdTag, false); tdElement->appendChild(anchorElement, ec); return tdElement.release(); @@ -294,7 +292,7 @@ static inline PassRefPtr<SharedBuffer> createTemplateDocumentData(Settings* sett bool FTPDirectoryDocumentParser::loadDocumentTemplate() { - DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTemplateDocumentData(m_doc->settings()))); + DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTemplateDocumentData(document()->settings()))); // FIXME: Instead of storing the data, we'd rather actually parse the template data into the template Document once, // store that document, then "copy" it whenever we get an FTP directory listing. There are complexities with this // approach that make it worth putting this off. @@ -306,10 +304,10 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate() // Tokenize the template as an HTML document synchronously setForceSynchronous(true); - HTMLDocumentParser::write(String(templateDocumentData->data(), templateDocumentData->size()), true); + LegacyHTMLDocumentParser::write(String(templateDocumentData->data(), templateDocumentData->size()), true); setForceSynchronous(false); - RefPtr<Element> tableElement = m_doc->getElementById("ftpDirectoryTable"); + RefPtr<Element> tableElement = document()->getElementById("ftpDirectoryTable"); if (!tableElement) LOG_ERROR("Unable to find element by id \"ftpDirectoryTable\" in the template document."); else if (!tableElement->hasTagName(tableTag)) @@ -322,7 +320,7 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate() return true; // Otherwise create one manually - tableElement = m_doc->createElement(tableTag, false); + tableElement = document()->createElement(tableTag, false); m_tableElement = static_cast<HTMLTableElement*>(tableElement.get()); ExceptionCode ec; m_tableElement->setAttribute("id", "ftpDirectoryTable", ec); @@ -330,10 +328,10 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate() // If we didn't find the table element, lets try to append our own to the body // If that fails for some reason, cram it on the end of the document as a last // ditch effort - if (Element* body = m_doc->body()) + if (Element* body = document()->body()) body->appendChild(m_tableElement, ec); else - m_doc->appendChild(m_tableElement, ec); + document()->appendChild(m_tableElement, ec); return true; } @@ -344,13 +342,12 @@ void FTPDirectoryDocumentParser::createBasicDocument() // FIXME: Make this "basic document" more acceptable - - RefPtr<Element> bodyElement = m_doc->createElement(bodyTag, false); + RefPtr<Element> bodyElement = document()->createElement(bodyTag, false); ExceptionCode ec; - m_doc->appendChild(bodyElement, ec); + document()->appendChild(bodyElement, ec); - RefPtr<Element> tableElement = m_doc->createElement(tableTag, false); + RefPtr<Element> tableElement = document()->createElement(tableTag, false); m_tableElement = static_cast<HTMLTableElement*>(tableElement.get()); m_tableElement->setAttribute("id", "ftpDirectoryTable", ec); @@ -431,11 +428,11 @@ void FTPDirectoryDocumentParser::finish() m_tableElement = 0; fastFree(m_buffer); - HTMLDocumentParser::finish(); + LegacyHTMLDocumentParser::finish(); } -FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame) - : HTMLDocument(frame) +FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame, const KURL& url) + : HTMLDocument(frame, url) { #ifndef NDEBUG LogFTP.state = WTFLogChannelOn; diff --git a/WebCore/loader/FTPDirectoryDocument.h b/WebCore/loader/FTPDirectoryDocument.h index f74508c..920f870 100644 --- a/WebCore/loader/FTPDirectoryDocument.h +++ b/WebCore/loader/FTPDirectoryDocument.h @@ -33,13 +33,13 @@ class DOMImplementation; class FTPDirectoryDocument : public HTMLDocument { public: - static PassRefPtr<FTPDirectoryDocument> create(Frame* frame) + static PassRefPtr<FTPDirectoryDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new FTPDirectoryDocument(frame)); + return adoptRef(new FTPDirectoryDocument(frame, url)); } private: - FTPDirectoryDocument(Frame*); + FTPDirectoryDocument(Frame*, const KURL&); virtual DocumentParser* createParser(); }; diff --git a/WebCore/loader/FormSubmission.cpp b/WebCore/loader/FormSubmission.cpp new file mode 100644 index 0000000..4d44174 --- /dev/null +++ b/WebCore/loader/FormSubmission.cpp @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#include "config.h" +#include "FormSubmission.h" + +#include "Event.h" +#include "FormData.h" +#include "FormState.h" +#include "Frame.h" +#include "FrameLoadRequest.h" +#include "FrameLoader.h" +#include "HTMLFormElement.h" +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +FormSubmission::FormSubmission(Method method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState> state, PassRefPtr<FormData> data, const String& boundary, bool lockHistory, PassRefPtr<Event> event) + : m_method(method) + , m_action(action) + , m_target(target) + , m_contentType(contentType) + , m_formState(state) + , m_formData(data) + , m_boundary(boundary) + , m_lockHistory(lockHistory) + , m_event(event) +{ +} + +PassRefPtr<FormSubmission> FormSubmission::create(Method method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState> state, PassRefPtr<FormData> data, const String& boundary, bool lockHistory, PassRefPtr<Event> event) +{ + return adoptRef(new FormSubmission(method, action, target, contentType, state, data, boundary, lockHistory, event)); +} + +void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) +{ + if (!m_target.isEmpty()) + frameRequest.setFrameName(m_target); + + if (!m_referrer.isEmpty()) + frameRequest.resourceRequest().setHTTPReferrer(m_referrer); + + if (m_method == FormSubmission::GetMethod) + m_action.setQuery(m_formData->flattenToString()); + else { + frameRequest.resourceRequest().setHTTPMethod("POST"); + frameRequest.resourceRequest().setHTTPBody(m_formData); + + // construct some user headers if necessary + if (m_contentType.isNull() || m_contentType == "application/x-www-form-urlencoded") + frameRequest.resourceRequest().setHTTPContentType(m_contentType); + else // contentType must be "multipart/form-data" + frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary); + } + + frameRequest.resourceRequest().setURL(m_action); + FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin); +} + +} diff --git a/WebCore/loader/FormSubmission.h b/WebCore/loader/FormSubmission.h new file mode 100644 index 0000000..647c6c6 --- /dev/null +++ b/WebCore/loader/FormSubmission.h @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#ifndef FormSubmission_h +#define FormSubmission_h + +#include "KURL.h" + +namespace WebCore { + +class Event; +class FormData; +class FormState; +struct FrameLoadRequest; + +class FormSubmission : public RefCounted<FormSubmission> { +public: + enum Method { + GetMethod, + PostMethod + }; + + static PassRefPtr<FormSubmission> create(Method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const String& boundary, bool lockHistory, PassRefPtr<Event>); + + void populateFrameLoadRequest(FrameLoadRequest&); + + Method method() const { return m_method; } + const KURL& action() const { return m_action; } + String target() const { return m_target; } + void clearTarget() { m_target = String(); } + String contentType() const { return m_contentType; } + FormState* state() const { return m_formState.get(); } + FormData* data() const { return m_formData.get(); } + String boundary() const { return m_boundary; } + bool lockHistory() const { return m_lockHistory; } + Event* event() const { return m_event.get(); } + + const String& referrer() const { return m_referrer; } + void setReferrer(const String& referrer) { m_referrer = referrer; } + const String& origin() const { return m_origin; } + void setOrigin(const String& origin) { m_origin = origin; } + +private: + FormSubmission(Method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const String& boundary, bool lockHistory, PassRefPtr<Event>); + + Method m_method; + KURL m_action; + String m_target; + String m_contentType; + RefPtr<FormState> m_formState; + RefPtr<FormData> m_formData; + String m_boundary; + bool m_lockHistory; + RefPtr<Event> m_event; + String m_referrer; + String m_origin; +}; + +} + +#endif // FormSubmission_h diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 7920e2e..3c622ee 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -55,6 +55,7 @@ #include "EventNames.h" #include "FloatRect.h" #include "FormState.h" +#include "FormSubmission.h" #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameLoaderClient.h" @@ -64,12 +65,7 @@ #include "Geolocation.h" #endif // PLATFORM(ANDROID) #include "HTMLAnchorElement.h" -#include "HTMLAppletElement.h" #include "HTMLFormElement.h" -#include "HTMLFrameElement.h" -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -#include "HTMLMediaElement.h" -#endif #include "HTMLNames.h" #include "HTMLObjectElement.h" #include "HTTPParsers.h" @@ -92,11 +88,6 @@ #include "PluginDatabase.h" #include "PluginDocument.h" #include "ProgressTracker.h" -#include "RenderEmbeddedObject.h" -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -#include "RenderVideo.h" -#endif -#include "RenderView.h" #include "ResourceHandle.h" #include "ResourceRequest.h" #include "ScriptController.h" @@ -106,20 +97,21 @@ #include "SecurityOrigin.h" #include "SegmentedString.h" #include "Settings.h" - -#if ENABLE(SHARED_WORKERS) -#include "SharedWorkerRepository.h" -#endif - #include "TextResourceDecoder.h" #include "WindowFeatures.h" -#include "XMLHttpRequest.h" #include "XMLDocumentParser.h" -#include "XSSAuditor.h" -#include <wtf/text/CString.h> #include <wtf/CurrentTime.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/CString.h> + +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +#include "HTMLMediaElement.h" +#include "RenderVideo.h" +#endif +#if ENABLE(SHARED_WORKERS) +#include "SharedWorkerRepository.h" +#endif #if ENABLE(SVG) #include "SVGDocument.h" @@ -138,16 +130,18 @@ namespace WebCore { +using namespace HTMLNames; + #if ENABLE(SVG) using namespace SVGNames; #endif -using namespace HTMLNames; #if ENABLE(XHTMLMP) static const char defaultAcceptHeader[] = "application/xml,application/vnd.wap.xhtml+xml,application/xhtml+xml;profile='http://www.wapforum.org/xhtml',text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; #else static const char defaultAcceptHeader[] = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; #endif + static double storedTimeOfLastCompletedLoad; bool isBackForwardLoadType(FrameLoadType type) @@ -202,10 +196,10 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_history(frame) , m_notifer(frame) , m_writer(frame) + , m_subframeLoader(frame) , m_state(FrameStateCommittedPage) , m_loadType(FrameLoadTypeStandard) , m_delegateIsHandlingProvisionalLoadError(false) - , m_firstLayoutDone(false) , m_quickRedirectComing(false) , m_sentRedirectNotification(false) , m_inStopAllLoaders(false) @@ -216,15 +210,10 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_isComplete(false) , m_isLoadingMainResource(false) , m_needsClear(false) - , m_receivedData(false) - , m_containsPlugIns(false) , m_checkTimer(this, &FrameLoader::checkTimerFired) , m_shouldCallCheckCompleted(false) , m_shouldCallCheckLoadComplete(false) , m_opener(0) - , m_creatingInitialEmptyDocument(false) - , m_isDisplayingInitialEmptyDocument(false) - , m_committedFirstRealDocumentLoad(false) , m_didPerformFirstNavigation(false) , m_loadingFromCachedPage(false) , m_suppressOpenerInNewFrame(false) @@ -254,8 +243,7 @@ void FrameLoader::init() updateSandboxFlags(); // this somewhat odd set of steps is needed to give the frame an initial empty document - m_isDisplayingInitialEmptyDocument = false; - m_creatingInitialEmptyDocument = true; + m_stateMachine.advanceTo(FrameLoaderStateMachine::CreatingInitialEmptyDocument); setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL(ParsedURLString, "")), SubstituteData()).get()); setProvisionalDocumentLoader(m_policyDocumentLoader.get()); setState(FrameStateProvisional); @@ -264,7 +252,7 @@ void FrameLoader::init() writer()->begin(KURL(), false); writer()->end(); m_frame->document()->cancelParsing(); - m_creatingInitialEmptyDocument = false; + m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocument); m_didCallImplicitClose = true; } @@ -400,114 +388,32 @@ void FrameLoader::urlSelected(const ResourceRequest& request, const String& pass m_suppressOpenerInNewFrame = false; } -bool FrameLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const String& urlString, const AtomicString& frameName, bool lockHistory, bool lockBackForwardList) -{ - // Support for <frame src="javascript:string"> - KURL scriptURL; - KURL url; - if (protocolIsJavaScript(urlString)) { - scriptURL = completeURL(urlString); // completeURL() encodes the URL. - url = blankURL(); - } else - url = completeURL(urlString); - - Frame* frame = ownerElement->contentFrame(); - if (frame) - frame->redirectScheduler()->scheduleLocationChange(url.string(), m_outgoingReferrer, lockHistory, lockBackForwardList, isProcessingUserGesture()); - else - frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer); - - if (!frame) - return false; - - if (!scriptURL.isEmpty()) - frame->script()->executeIfJavaScriptURL(scriptURL); - - return true; -} - -Frame* FrameLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL& url, const String& name, const String& referrer) +void FrameLoader::submitForm(PassRefPtr<FormSubmission> submission) { - bool allowsScrolling = true; - int marginWidth = -1; - int marginHeight = -1; - if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) { - HTMLFrameElementBase* o = static_cast<HTMLFrameElementBase*>(ownerElement); - allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff; - marginWidth = o->getMarginWidth(); - marginHeight = o->getMarginHeight(); - } - - if (!SecurityOrigin::canLoad(url, referrer, 0)) { - FrameLoader::reportLocalLoadFailed(m_frame, url.string()); - return 0; - } - - bool hideReferrer = SecurityOrigin::shouldHideReferrer(url, referrer); - RefPtr<Frame> frame = m_client->createFrame(url, name, ownerElement, hideReferrer ? String() : referrer, allowsScrolling, marginWidth, marginHeight); + ASSERT(submission->method() == FormSubmission::PostMethod || submission->method() == FormSubmission::GetMethod); - if (!frame) { - checkCallImplicitClose(); - return 0; - } - - // All new frames will have m_isComplete set to true at this point due to synchronously loading - // an empty document in FrameLoader::init(). But many frames will now be starting an - // asynchronous load of url, so we set m_isComplete to false and then check if the load is - // actually completed below. (Note that we set m_isComplete to false even for synchronous - // loads, so that checkCompleted() below won't bail early.) - // FIXME: Can we remove this entirely? m_isComplete normally gets set to false when a load is committed. - frame->loader()->m_isComplete = false; - - RenderObject* renderer = ownerElement->renderer(); - FrameView* view = frame->view(); - if (renderer && renderer->isWidget() && view) - toRenderWidget(renderer)->setWidget(view); - - checkCallImplicitClose(); - - // Some loads are performed synchronously (e.g., about:blank and loads - // cancelled by returning a null ResourceRequest from requestFromDelegate). - // In these cases, the synchronous load would have finished - // before we could connect the signals, so make sure to send the - // completed() signal for the child by hand and mark the load as being - // complete. - // FIXME: In this case the Frame will have finished loading before - // it's being added to the child list. It would be a good idea to - // create the child first, then invoke the loader separately. - if (frame->loader()->state() == FrameStateComplete) - frame->loader()->checkCompleted(); - - return frame.get(); -} - -void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<FormData> formData, - const String& target, const String& contentType, const String& boundary, - bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState) -{ - ASSERT(action); - ASSERT(strcmp(action, "GET") == 0 || strcmp(action, "POST") == 0); - ASSERT(formData); - ASSERT(formState); - ASSERT(formState->sourceFrame() == m_frame); + // FIXME: Find a good spot for these. + ASSERT(submission->data()); + ASSERT(submission->state()); + ASSERT(submission->state()->sourceFrame() == m_frame); if (!m_frame->page()) return; - KURL u = completeURL(url.isNull() ? "" : url); - if (u.isEmpty()) + if (submission->action().isEmpty()) return; if (isDocumentSandboxed(m_frame, SandboxForms)) return; - if (protocolIsJavaScript(u)) { + if (protocolIsJavaScript(submission->action())) { m_isExecutingJavaScriptFormAction = true; - m_frame->script()->executeIfJavaScriptURL(u, false, DoNotReplaceDocumentIfJavaScriptURL); + m_frame->script()->executeIfJavaScriptURL(submission->action(), false, DoNotReplaceDocumentIfJavaScriptURL); m_isExecutingJavaScriptFormAction = false; return; } +<<<<<<< HEAD FrameLoadRequest frameRequest; #ifdef ANDROID_USER_GESTURE frameRequest.resourceRequest().setUserGesture(isProcessingUserGesture()); @@ -515,6 +421,9 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F String targetOrBaseTarget = target.isEmpty() ? m_frame->document()->baseTarget() : target; Frame* targetFrame = m_frame->tree()->find(targetOrBaseTarget); +======= + Frame* targetFrame = m_frame->tree()->find(submission->target()); +>>>>>>> webkit.org at r61871 if (!shouldAllowNavigation(targetFrame)) return; if (!targetFrame) { @@ -522,8 +431,9 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F return; targetFrame = m_frame; - frameRequest.setFrameName(targetOrBaseTarget); - } + } else + submission->clearTarget(); + if (!targetFrame->page()) return; @@ -540,33 +450,16 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F // needed any more now that we reset m_submittedFormURL on each mouse or key down event. if (m_frame->tree()->isDescendantOf(targetFrame)) { - if (m_submittedFormURL == u) + if (m_submittedFormURL == submission->action()) return; - m_submittedFormURL = u; - } - - formData->generateFiles(m_frame->document()); - - if (!m_outgoingReferrer.isEmpty()) - frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer); - - if (strcmp(action, "GET") == 0) - u.setQuery(formData->flattenToString()); - else { - frameRequest.resourceRequest().setHTTPMethod("POST"); - frameRequest.resourceRequest().setHTTPBody(formData); - - // construct some user headers if necessary - if (contentType.isNull() || contentType == "application/x-www-form-urlencoded") - frameRequest.resourceRequest().setHTTPContentType(contentType); - else // contentType must be "multipart/form-data" - frameRequest.resourceRequest().setHTTPContentType(contentType + "; boundary=" + boundary); + m_submittedFormURL = submission->action(); } - frameRequest.resourceRequest().setURL(u); - addHTTPOriginIfNeeded(frameRequest.resourceRequest(), outgoingOrigin()); + submission->data()->generateFiles(m_frame->document()); + submission->setReferrer(m_outgoingReferrer); + submission->setOrigin(outgoingOrigin()); - targetFrame->redirectScheduler()->scheduleFormSubmission(frameRequest, lockHistory, event, formState); + targetFrame->redirectScheduler()->scheduleFormSubmission(submission); } void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolicy databasePolicy) @@ -597,7 +490,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic // Dispatching the unload event could have made m_frame->document() null. if (m_frame->document() && !m_frame->document()->inPageCache()) { // Don't remove event listeners from a transitional empty document (see bug 28716 for more information). - bool keepEventListeners = m_isDisplayingInitialEmptyDocument && m_provisionalDocumentLoader + bool keepEventListeners = m_stateMachine.isDisplayingInitialEmptyDocument() && m_provisionalDocumentLoader && m_frame->document()->securityOrigin()->isSecureTransitionTo(m_provisionalDocumentLoader->url()); if (!keepEventListeners) @@ -628,6 +521,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic #endif } +<<<<<<< HEAD #if PLATFORM(ANDROID) // Stop the Geolocation object, if present. This call is made after the unload // event has fired, so no new Geolocation activity is possible. @@ -639,6 +533,9 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) child->loader()->stopLoading(unloadEventPolicy); +======= + // FIXME: This will cancel redirection timer, which really needs to be restarted when restoring the frame from b/f cache. +>>>>>>> webkit.org at r61871 m_frame->redirectScheduler()->cancel(); } @@ -710,9 +607,11 @@ bool FrameLoader::didOpenURL(const KURL& url) // If we are still in the process of initializing an empty document then // its frame is not in a consistent state for rendering, so avoid setJSStatusBarText // since it may cause clients to attempt to render the frame. - if (!m_creatingInitialEmptyDocument) { - m_frame->setJSStatusBarText(String()); - m_frame->setJSDefaultStatusBarText(String()); + if (!m_stateMachine.creatingInitialEmptyDocument()) { + if (DOMWindow* window = m_frame->existingDOMWindow()) { + window->setStatus(String()); + window->setDefaultStatus(String()); + } } m_URL = url; if (m_URL.protocolInHTTPFamily() && !m_URL.host().isEmpty() && m_URL.path().isEmpty()) @@ -730,7 +629,8 @@ void FrameLoader::didExplicitOpen() m_didCallImplicitClose = false; // Calling document.open counts as committing the first real document load. - m_committedFirstRealDocumentLoad = true; + if (!m_stateMachine.committedFirstRealDocumentLoad()) + m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit); // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results // from a subsequent window.document.open / window.document.write call. @@ -788,7 +688,7 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo m_frame->setDocument(0); writer()->clear(); - m_containsPlugIns = false; + m_subframeLoader.clear(); if (clearScriptObjects) m_frame->script()->clearScriptObjects(); @@ -799,7 +699,8 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo m_shouldCallCheckCompleted = false; m_shouldCallCheckLoadComplete = false; - m_isDisplayingInitialEmptyDocument = false; + if (m_stateMachine.isDisplayingInitialEmptyDocument() && m_stateMachine.committedFirstRealDocumentLoad()) + m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad); } void FrameLoader::receivedFirstData() @@ -851,7 +752,6 @@ void FrameLoader::didBeginDocument(bool dispatch) m_isComplete = false; m_didCallImplicitClose = false; m_isLoadingMainResource = true; - m_isDisplayingInitialEmptyDocument = m_creatingInitialEmptyDocument; if (m_pendingStateObject) { m_frame->document()->statePopped(m_pendingStateObject.get()); @@ -965,7 +865,7 @@ void FrameLoader::commitIconURLToIconDatabase(const KURL& icon) void FrameLoader::finishedParsing() { - if (m_creatingInitialEmptyDocument) + if (m_stateMachine.creatingInitialEmptyDocument()) return; m_frame->injectUserScripts(InjectAtDocumentEnd); @@ -1166,68 +1066,6 @@ void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive) } #endif -bool FrameLoader::requestObject(RenderEmbeddedObject* renderer, const String& url, const AtomicString& frameName, - const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) -{ - if (url.isEmpty() && mimeType.isEmpty()) - return false; - - if (!m_frame->script()->xssAuditor()->canLoadObject(url)) { - // It is unsafe to honor the request for this object. - return false; - } - - KURL completedURL; - if (!url.isEmpty()) - completedURL = completeURL(url); - - bool useFallback; - if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback)) { - Settings* settings = m_frame->settings(); - if ((!allowPlugins(AboutToInstantiatePlugin) - // Application plugins are plugins implemented by the user agent, for example Qt plugins, - // as opposed to third-party code such as flash. The user agent decides whether or not they are - // permitted, rather than WebKit. - && !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType)) - || (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) - return false; - if (isDocumentSandboxed(m_frame, SandboxPlugins)) - return false; - return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback); - } - - ASSERT(renderer->node()->hasTagName(objectTag) || renderer->node()->hasTagName(embedTag)); - HTMLPlugInElement* element = static_cast<HTMLPlugInElement*>(renderer->node()); - - // If the plug-in element already contains a subframe, requestFrame will re-use it. Otherwise, - // it will create a new frame and set it as the RenderPart's widget, causing what was previously - // in the widget to be torn down. - return requestFrame(element, completedURL, frameName); -} - -bool FrameLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback) -{ - if (m_client->shouldUsePluginDocument(mimeType)) { - useFallback = false; - return true; - } - - // Allow other plug-ins to win over QuickTime because if the user has installed a plug-in that - // can handle TIFF (which QuickTime can also handle) they probably intended to override QT. - if (m_frame->page() && (mimeType == "image/tiff" || mimeType == "image/tif" || mimeType == "image/x-tiff")) { - const PluginData* pluginData = m_frame->page()->pluginData(); - String pluginName = pluginData ? pluginData->pluginNameForMimeType(mimeType) : String(); - if (!pluginName.isEmpty() && !pluginName.contains("QuickTime", false)) - return true; - } - - ObjectContentType objectType = m_client->objectContentType(url, mimeType); - // If an object's content can't be handled and it has no fallback, let - // it be handled as a plugin to show the broken plugin icon. - useFallback = objectType == ObjectContentNone && hasFallback; - return objectType == ObjectContentNone || objectType == ObjectContentNetscapePlugin || objectType == ObjectContentOtherPlugin; -} - ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeTypeIn) { String mimeType = mimeTypeIn; @@ -1252,91 +1090,6 @@ ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const S return WebCore::ObjectContentNone; } -static HTMLPlugInElement* toPlugInElement(Node* node) -{ - if (!node) - return 0; - - ASSERT(node->hasTagName(objectTag) || node->hasTagName(embedTag) - || node->hasTagName(appletTag)); - - return static_cast<HTMLPlugInElement*>(node); -} - -bool FrameLoader::loadPlugin(RenderEmbeddedObject* renderer, const KURL& url, const String& mimeType, - const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) -{ - RefPtr<Widget> widget; - - if (renderer && !useFallback) { - HTMLPlugInElement* element = toPlugInElement(renderer->node()); - - if (!SecurityOrigin::canLoad(url, String(), frame()->document())) { - FrameLoader::reportLocalLoadFailed(m_frame, url.string()); - return false; - } - - checkIfRunInsecureContent(m_frame->document()->securityOrigin(), url); - - widget = m_client->createPlugin(IntSize(renderer->contentWidth(), renderer->contentHeight()), - element, url, paramNames, paramValues, mimeType, - m_frame->document()->isPluginDocument() && !m_containsPlugIns); - if (widget) { - renderer->setWidget(widget); - m_containsPlugIns = true; - -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) - renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange); -#endif - } else - renderer->setShowsMissingPluginIndicator(); - } - - return widget != 0; -} - -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -PassRefPtr<Widget> FrameLoader::loadMediaPlayerProxyPlugin(Node* node, const KURL& url, - const Vector<String>& paramNames, const Vector<String>& paramValues) -{ - ASSERT(node->hasTagName(videoTag) || node->hasTagName(audioTag)); - - if (!m_frame->script()->xssAuditor()->canLoadObject(url.string())) - return 0; - - KURL completedURL; - if (!url.isEmpty()) - completedURL = completeURL(url); - - if (!SecurityOrigin::canLoad(completedURL, String(), frame()->document())) { - FrameLoader::reportLocalLoadFailed(m_frame, completedURL.string()); - return 0; - } - - HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(node); - RenderPart* renderer = toRenderPart(node->renderer()); - IntSize size; - - if (renderer) - size = IntSize(renderer->contentWidth(), renderer->contentHeight()); - else if (mediaElement->isVideo()) - size = RenderVideo::defaultSize(); - - checkIfRunInsecureContent(m_frame->document()->securityOrigin(), completedURL); - - RefPtr<Widget> widget = m_client->createMediaPlayerProxyPlugin(size, mediaElement, completedURL, - paramNames, paramValues, "application/x-media-element-proxy-plugin"); - - if (widget && renderer) { - renderer->setWidget(widget); - m_containsPlugIns = true; - renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange); - } - - return widget ? widget.release() : 0; -} -#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) - String FrameLoader::outgoingReferrer() const { return m_outgoingReferrer; @@ -1410,12 +1163,18 @@ void FrameLoader::handleFallbackContent() } void FrameLoader::provisionalLoadStarted() +<<<<<<< HEAD { #ifdef ANDROID_INSTRUMENT if (!m_frame->tree()->parent()) android::TimeCounter::reset(); #endif m_firstLayoutDone = false; +======= +{ + if (m_stateMachine.firstLayoutDone()) + m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad); +>>>>>>> webkit.org at r61871 m_frame->redirectScheduler()->cancel(true); m_client->provisionalLoadStarted(); } @@ -1569,20 +1328,6 @@ void FrameLoader::started() frame->loader()->m_isComplete = false; } -bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) -{ - Settings* settings = m_frame->settings(); - bool allowed = m_client->allowPlugins(settings && settings->arePluginsEnabled()); - if (!allowed && reason == AboutToInstantiatePlugin) - m_frame->loader()->client()->didNotAllowPlugins(); - return allowed; -} - -bool FrameLoader::containsPlugins() const -{ - return m_containsPlugIns; -} - void FrameLoader::prepareForLoadStart() { if (Page* page = m_frame->page()) @@ -2141,7 +1886,7 @@ bool FrameLoader::isLoading() const bool FrameLoader::frameHasLoaded() const { - return m_committedFirstRealDocumentLoad || (m_provisionalDocumentLoader && !m_creatingInitialEmptyDocument); + return m_stateMachine.committedFirstRealDocumentLoad() || (m_provisionalDocumentLoader && !m_stateMachine.creatingInitialEmptyDocument()); } void FrameLoader::setDocumentLoader(DocumentLoader* loader) @@ -2230,15 +1975,13 @@ void FrameLoader::commitProvisionalLoad() // Check to see if we need to cache the page we are navigating away from into the back/forward cache. // We are doing this here because we know for sure that a new page is about to be loaded. HistoryItem* item = history()->currentItem(); - if (!m_frame->tree()->parent() && PageCache::canCache(m_frame->page()) && !item->isInPageCache()) { - pageHidden(); + if (!m_frame->tree()->parent() && PageCache::canCache(m_frame->page()) && !item->isInPageCache()) pageCache()->add(item, m_frame->page()); - } if (m_loadType != FrameLoadTypeReplace) closeOldDataSources(); - if (!cachedPage && !m_creatingInitialEmptyDocument) + if (!cachedPage && !m_stateMachine.creatingInitialEmptyDocument()) m_client->makeRepresentation(pdl.get()); transitionToCommitted(cachedPage); @@ -2342,18 +2085,24 @@ void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage) case FrameLoadTypeIndexedBackForward: if (Page* page = m_frame->page()) { if (page->backForwardList()) { + // If the first load within a frame is a navigation within a back/forward list that was attached + // without any of the items being loaded then we need to update the history in a similar manner as + // for a standard load with the exception of updating the back/forward list (<rdar://problem/8091103>). + if (!m_stateMachine.committedFirstRealDocumentLoad()) + history()->updateForStandardLoad(HistoryController::UpdateAllExceptBackForwardList); + history()->updateForBackForwardNavigation(); if (history()->currentItem()) m_pendingStateObject = history()->currentItem()->stateObject(); - + // Create a document view for this document, or used the cached view. if (cachedPage) { DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader(); ASSERT(cachedDocumentLoader); cachedDocumentLoader->setFrame(m_frame); m_client->transitionToCommittedFromCachedFrame(cachedPage->cachedMainFrame()); - + } else m_client->transitionToCommittedForNewPage(); } @@ -2395,10 +2144,11 @@ void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage) // Tell the client we've committed this URL. ASSERT(m_frame->view()); - if (m_creatingInitialEmptyDocument) + if (m_stateMachine.creatingInitialEmptyDocument()) return; - - m_committedFirstRealDocumentLoad = true; + + if (!m_stateMachine.committedFirstRealDocumentLoad()) + m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit); if (!m_client->hasHTMLView()) receivedFirstData(); @@ -2483,8 +2233,10 @@ void FrameLoader::prepareForCachedPageRestore() // Delete old status bar messages (if it _was_ activated on last URL). if (m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) { - m_frame->setJSStatusBarText(String()); - m_frame->setJSDefaultStatusBarText(String()); + if (DOMWindow* window = m_frame->existingDOMWindow()) { + window->setStatus(String()); + window->setDefaultStatus(String()); + } } } @@ -2592,8 +2344,13 @@ void FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame() void FrameLoader::finishedLoadingDocument(DocumentLoader* loader) { // FIXME: Platforms shouldn't differ here! +<<<<<<< HEAD #if PLATFORM(WIN) || PLATFORM(CHROMIUM) || defined(ANDROID) if (m_creatingInitialEmptyDocument) +======= +#if PLATFORM(WIN) || PLATFORM(CHROMIUM) + if (m_stateMachine.creatingInitialEmptyDocument()) +>>>>>>> webkit.org at r61871 return; #endif @@ -2789,7 +2546,7 @@ void FrameLoader::checkLoadCompleteForThisFrame() if ((isBackForwardLoadType(m_loadType) || m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadFromOrigin) && page->backForwardList()) history()->restoreScrollPositionAndViewState(); - if (m_creatingInitialEmptyDocument || !m_committedFirstRealDocumentLoad) + if (m_stateMachine.creatingInitialEmptyDocument() || !m_stateMachine.committedFirstRealDocumentLoad()) return; const ResourceError& error = dl->mainDocumentError(); @@ -2856,7 +2613,8 @@ void FrameLoader::didFirstLayout() if (isBackForwardLoadType(m_loadType) && page->backForwardList()) history()->restoreScrollPositionAndViewState(); - m_firstLayoutDone = true; + if (m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone()) + m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone); m_client->dispatchDidFirstLayout(); } @@ -2875,13 +2633,8 @@ void FrameLoader::frameLoadCompleted() // After a canceled provisional load, firstLayoutDone is false. // Reset it to true if we're displaying a page. - if (m_documentLoader) - m_firstLayoutDone = true; -} - -bool FrameLoader::firstLayoutDone() const -{ - return m_firstLayoutDone; + if (m_documentLoader && m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone()) + m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone); } void FrameLoader::detachChildren() @@ -3308,7 +3061,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass // is the user responding Cancel to the form repost nag sheet. // 2) User responded Cancel to an alert popped up by the before unload event handler. // The "before unload" event handler runs only for the main frame. - bool canContinue = shouldContinue && (!isLoadingMainFrame() || m_frame->shouldClose()); + bool canContinue = shouldContinue && (!isLoadingMainFrame() || shouldClose()); if (!canContinue) { // If we were waiting for a quick redirect, but the policy delegate decided to ignore it, then we @@ -3483,18 +3236,6 @@ void FrameLoader::loadProvisionalItemFromCachedPage() commitProvisionalLoad(); } -void FrameLoader::pageHidden() -{ - m_pageDismissalEventBeingDispatched = true; - if (m_frame->domWindow()) - m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, true), m_frame->document()); - m_pageDismissalEventBeingDispatched = false; - - // Send pagehide event for subframes as well - for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->loader()->pageHidden(); -} - bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const { if (!history()->currentItem()) @@ -3631,14 +3372,11 @@ void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType l void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType) { // We do same-document navigation in the following cases: - // - The HistoryItem has a history state object - // - Navigating to an anchor within the page, with no form data stored on the target item or the current history entry, - // and the URLs in the frame tree match the history item for fragment scrolling. - // - The HistoryItem is not the same as the current item, because such cases are treated as a new load. + // - The HistoryItem corresponds to the same document. + // - The HistoryItem is not the same as the current item. HistoryItem* currentItem = history()->currentItem(); - bool sameDocumentNavigation = ((!item->formData() && !(currentItem && currentItem->formData()) && history()->urlsMatchItem(item)) - || (currentItem && item->documentSequenceNumber() == currentItem->documentSequenceNumber())) - && item != currentItem; + bool sameDocumentNavigation = currentItem && item != currentItem + && item->documentSequenceNumber() == currentItem->documentSequenceNumber(); #if ENABLE(WML) // All WML decks should go through the real load mechanism, not the scroll-to-anchor code @@ -3782,42 +3520,6 @@ void FrameLoader::updateSandboxFlags() child->loader()->updateSandboxFlags(); } -PassRefPtr<Widget> FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) -{ - String baseURLString; - String codeBaseURLString; - Vector<String> paramNames; - Vector<String> paramValues; - HashMap<String, String>::const_iterator end = args.end(); - for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) { - if (equalIgnoringCase(it->first, "baseurl")) - baseURLString = it->second; - else if (equalIgnoringCase(it->first, "codebase")) - codeBaseURLString = it->second; - paramNames.append(it->first); - paramValues.append(it->second); - } - - if (!codeBaseURLString.isEmpty()) { - KURL codeBaseURL = completeURL(codeBaseURLString); - if (!SecurityOrigin::canLoad(codeBaseURL, String(), element->document())) { - FrameLoader::reportLocalLoadFailed(m_frame, codeBaseURL.string()); - return 0; - } - } - - if (baseURLString.isEmpty()) - baseURLString = m_frame->document()->baseURL().string(); - KURL baseURL = completeURL(baseURLString); - - RefPtr<Widget> widget = m_client->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); - if (!widget) - return 0; - - m_containsPlugIns = true; - return widget; -} - void FrameLoader::didChangeTitle(DocumentLoader* loader) { m_client->didChangeTitle(loader); @@ -3840,7 +3542,7 @@ void FrameLoader::didChangeIcons(DocumentLoader* loader) void FrameLoader::dispatchDidCommitLoad() { - if (m_creatingInitialEmptyDocument) + if (m_stateMachine.creatingInitialEmptyDocument()) return; #ifndef NDEBUG diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index a04937d..b361b51 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -33,6 +33,7 @@ #include "CachePolicy.h" #include "DocumentWriter.h" +#include "FrameLoaderStateMachine.h" #include "FrameLoaderTypes.h" #include "HistoryController.h" #include "PolicyCallback.h" @@ -40,6 +41,7 @@ #include "RedirectScheduler.h" #include "ResourceLoadNotifier.h" #include "ResourceRequest.h" +#include "SubframeLoader.h" #include "ThreadableLoader.h" #include "Timer.h" #include <wtf/Forward.h> @@ -59,20 +61,14 @@ class DocumentLoader; class Event; class FormData; class FormState; +class FormSubmission; class Frame; class FrameLoaderClient; class HistoryItem; -class HTMLAppletElement; class HTMLFormElement; -class HTMLFrameOwnerElement; class IconLoader; -class IntSize; class NavigationAction; -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -class Node; -#endif class ProtectionSpace; -class RenderEmbeddedObject; class ResourceError; class ResourceLoader; class ResourceResponse; @@ -84,7 +80,6 @@ class SerializedScriptValue; class SharedBuffer; class SubstituteData; class TextResourceDecoder; -class Widget; struct FrameLoadRequest; struct WindowFeatures; @@ -104,6 +99,7 @@ public: HistoryController* history() const { return &m_history; } ResourceLoadNotifier* notifier() const { return &m_notifer; } DocumentWriter* writer() const { return &m_writer; } + SubframeLoader* subframeLoader() const { return &m_subframeLoader; } // FIXME: This is not cool, people. There are too many different functions that all start loads. // We should aim to consolidate these into a smaller set of functions, and try to reuse more of @@ -204,7 +200,6 @@ public: CachePolicy subresourceCachePolicy() const; void didFirstLayout(); - bool firstLayoutDone() const; void didFirstVisuallyNonEmptyLayout(); @@ -226,11 +221,8 @@ public: void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false, bool refresh = false); void urlSelected(const KURL&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture, ReferrerPolicy); - bool requestFrame(HTMLFrameOwnerElement*, const String& url, const AtomicString& frameName, bool lockHistory = true, bool lockBackForwardList = true); - void submitForm(const char* action, const String& url, - PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary, - bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>); + void submitForm(PassRefPtr<FormSubmission>); void stop(); void stopLoading(UnloadEventPolicy, DatabasePolicy = DatabasePolicyStop); @@ -251,8 +243,6 @@ public: void handledOnloadEvents(); String userAgent(const KURL&) const; - PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args); - void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); void dispatchDidClearWindowObjectsInAllWorlds(); void dispatchDocumentElementAvailable(); @@ -288,9 +278,6 @@ public: // setURL is a low-level setter and does not trigger loading. void setURL(const KURL&); - bool allowPlugins(ReasonForCallingAllowPlugins); - bool containsPlugins() const; - void loadDone(); void finishedParsing(); void checkCompleted(); @@ -299,9 +286,6 @@ public: bool isComplete() const; - bool requestObject(RenderEmbeddedObject*, const String& url, const AtomicString& frameName, - const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues); - KURL completeURL(const String& url); void cancelAndClear(); @@ -312,9 +296,7 @@ public: void commitProvisionalLoad(); bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } - bool committingFirstRealLoad() const { return !m_creatingInitialEmptyDocument && !m_committedFirstRealDocumentLoad; } - bool committedFirstRealDocumentLoad() const { return m_committedFirstRealDocumentLoad; } - bool creatingInitialEmptyDocument() const { return m_creatingInitialEmptyDocument; } + FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } void iconLoadDecisionAvailable(); @@ -329,10 +311,6 @@ public: void open(CachedFrameBase&); -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) - PassRefPtr<Widget> loadMediaPlayerProxyPlugin(Node*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues); -#endif - // FIXME: Should these really be public? void completed(); bool allAncestorsAreComplete() const; // including this @@ -350,13 +328,13 @@ public: static ObjectContentType defaultObjectContentType(const KURL& url, const String& mimeType); - bool isDisplayingInitialEmptyDocument() const { return m_isDisplayingInitialEmptyDocument; } - void clear(bool clearWindowProperties = true, bool clearScriptObjects = true, bool clearFrameView = true); bool quickRedirectComing() const { return m_quickRedirectComing; } bool shouldClose(); + + void started(); private: bool canCachePageContainingThisFrame(); @@ -366,18 +344,11 @@ private: #endif void checkTimerFired(Timer<FrameLoader>*); - - void started(); - - bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback); - bool loadPlugin(RenderEmbeddedObject*, const KURL&, const String& mimeType, - const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback); void navigateWithinDocument(HistoryItem*); void navigateToDifferentDocument(HistoryItem*, FrameLoadType); void loadProvisionalItemFromCachedPage(); - void pageHidden(); void receivedFirstData(); @@ -454,8 +425,6 @@ private: void detachChildren(); void closeAndRemoveChild(Frame*); - Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer); - void loadInSameDocument(const KURL&, SerializedScriptValue* stateObject, bool isNewNavigation); void provisionalLoadStarted(); @@ -481,6 +450,8 @@ private: mutable HistoryController m_history; mutable ResourceLoadNotifier m_notifer; mutable DocumentWriter m_writer; + mutable SubframeLoader m_subframeLoader; + mutable FrameLoaderStateMachine m_stateMachine; FrameState m_state; FrameLoadType m_loadType; @@ -495,7 +466,6 @@ private: bool m_delegateIsHandlingProvisionalLoadError; - bool m_firstLayoutDone; bool m_quickRedirectComing; bool m_sentRedirectNotification; bool m_inStopAllLoaders; @@ -518,12 +488,7 @@ private: OwnPtr<IconLoader> m_iconLoader; bool m_mayLoadIconLater; - bool m_cancellingWithLoadInProgress; - bool m_needsClear; - bool m_receivedData; - - bool m_containsPlugIns; KURL m_submittedFormURL; @@ -534,10 +499,6 @@ private: Frame* m_opener; HashSet<Frame*> m_openedFrames; - bool m_creatingInitialEmptyDocument; - bool m_isDisplayingInitialEmptyDocument; - bool m_committedFirstRealDocumentLoad; - bool m_didPerformFirstNavigation; bool m_loadingFromCachedPage; bool m_suppressOpenerInNewFrame; diff --git a/WebCore/loader/FrameLoaderStateMachine.cpp b/WebCore/loader/FrameLoaderStateMachine.cpp new file mode 100644 index 0000000..790b144 --- /dev/null +++ b/WebCore/loader/FrameLoaderStateMachine.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Google, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FrameLoaderStateMachine.h" + +#include <wtf/Assertions.h> + +namespace WebCore { + + +FrameLoaderStateMachine::FrameLoaderStateMachine() + : m_state(Uninitialized) +{ +} + +bool FrameLoaderStateMachine::committingFirstRealLoad() const +{ + return m_state == DisplayingInitialEmptyDocument; +} + +bool FrameLoaderStateMachine::committedFirstRealDocumentLoad() const +{ + return m_state >= DisplayingInitialEmptyDocumentPostCommit; +} + +bool FrameLoaderStateMachine::creatingInitialEmptyDocument() const +{ + return m_state == CreatingInitialEmptyDocument; +} + +bool FrameLoaderStateMachine::isDisplayingInitialEmptyDocument() const +{ + return m_state == DisplayingInitialEmptyDocument || m_state == DisplayingInitialEmptyDocumentPostCommit; +} + +bool FrameLoaderStateMachine::firstLayoutDone() const +{ + return m_state == FirstLayoutDone; +} + +void FrameLoaderStateMachine::advanceTo(State state) +{ + ASSERT(State(m_state + 1) == state || (firstLayoutDone() && state == CommittedFirstRealLoad)); + m_state = state; +} + +} // namespace WebCore diff --git a/WebCore/loader/FrameLoaderStateMachine.h b/WebCore/loader/FrameLoaderStateMachine.h new file mode 100644 index 0000000..c3408c2 --- /dev/null +++ b/WebCore/loader/FrameLoaderStateMachine.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Google, Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 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 FrameLoaderStateMachine_h +#define FrameLoaderStateMachine_h + +#include <wtf/Noncopyable.h> + +namespace WebCore { + +// Encapsulates a state machine for FrameLoader. Note that this is different from FrameState, +// which stores the state of the current load that FrameLoader is executing. +class FrameLoaderStateMachine : public Noncopyable { +public: + FrameLoaderStateMachine(); + + // Once a load has been committed, the state may + // alternate between CommittedFirstRealLoad and FirstLayoutDone. + // Otherwise, the states only go down the list. + enum State { + Uninitialized, + CreatingInitialEmptyDocument, + DisplayingInitialEmptyDocument, + DisplayingInitialEmptyDocumentPostCommit, + CommittedFirstRealLoad, + FirstLayoutDone + }; + + bool committingFirstRealLoad() const; + bool committedFirstRealDocumentLoad() const; + bool creatingInitialEmptyDocument() const; + bool isDisplayingInitialEmptyDocument() const; + bool firstLayoutDone() const; + void advanceTo(State); + +private: + State m_state; +}; + +} // namespace WebCore + +#endif // FrameLoaderStateMachine_h diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp index c4e9e5a..5ccdf72 100644 --- a/WebCore/loader/HistoryController.cpp +++ b/WebCore/loader/HistoryController.cpp @@ -37,6 +37,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "FrameLoaderStateMachine.h" #include "FrameTree.h" #include "FrameView.h" #include "HistoryItem.h" @@ -81,7 +82,7 @@ void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item) */ void HistoryController::restoreScrollPositionAndViewState() { - if (!m_frame->loader()->committedFirstRealDocumentLoad()) + if (!m_frame->loader()->stateMachine()->committedFirstRealDocumentLoad()) return; ASSERT(m_currentItem); @@ -106,21 +107,13 @@ void HistoryController::restoreScrollPositionAndViewState() void HistoryController::updateBackForwardListForFragmentScroll() { updateBackForwardListClippedAtTarget(false); - - // Since the document isn't changed as a result of a fragment scroll, we should - // preserve the DocumentSequenceNumber of the previous item. - if (!m_previousItem) - return; - - ASSERT(m_currentItem); - m_currentItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber()); } void HistoryController::saveDocumentState() { // FIXME: Reading this bit of FrameLoader state here is unfortunate. I need to study // this more to see if we can remove this dependency. - if (m_frame->loader()->creatingInitialEmptyDocument()) + if (m_frame->loader()->stateMachine()->creatingInitialEmptyDocument()) return; // For a standard page load, we will have a previous item set, which will be used to @@ -231,25 +224,6 @@ void HistoryController::goToItem(HistoryItem* targetItem, FrameLoadType type) recursiveGoToItem(targetItem, currentItem, type); } -// Walk the frame tree and ensure that the URLs match the URLs in the item. -bool HistoryController::urlsMatchItem(HistoryItem* item) const -{ - const KURL& currentURL = m_frame->loader()->documentLoader()->url(); - if (!equalIgnoringFragmentIdentifier(currentURL, item->url())) - return false; - - const HistoryItemVector& childItems = item->children(); - - unsigned size = childItems.size(); - for (unsigned i = 0; i < size; ++i) { - Frame* childFrame = m_frame->tree()->child(childItems[i]->target()); - if (childFrame && !childFrame->loader()->history()->urlsMatchItem(childItems[i].get())) - return false; - } - - return true; -} - void HistoryController::updateForBackForwardNavigation() { #if !LOG_DISABLED @@ -286,7 +260,7 @@ void HistoryController::updateForReload() // 2) Global history: Handled by the client. // 3) Visited links: Handled by the PageGroup. -void HistoryController::updateForStandardLoad() +void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) { LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); @@ -298,7 +272,8 @@ void HistoryController::updateForStandardLoad() if (!frameLoader->documentLoader()->isClientRedirect()) { if (!historyURL.isEmpty()) { - updateBackForwardListClippedAtTarget(true); + if (updateType != UpdateAllExceptBackForwardList) + updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { frameLoader->client()->updateGlobalHistory(); frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); @@ -521,9 +496,21 @@ PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bo RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false); if (m_previousItem) saveScrollPositionAndViewStateToItem(m_previousItem.get()); - if (!(clipAtTarget && m_frame == targetFrame)) { + + if (!clipAtTarget || m_frame != targetFrame) { // save frame state for items that aren't loading (khtml doesn't save those) saveDocumentState(); + + // clipAtTarget is false for navigations within the same document, so + // we should copy the documentSequenceNumber over to the newly create + // item. Non-target items are just clones, and they should therefore + // preserve the same itemSequenceNumber. + if (m_previousItem) { + if (m_frame != targetFrame) + bfItem->setItemSequenceNumber(m_previousItem->itemSequenceNumber()); + bfItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber()); + } + for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { FrameLoader* childLoader = child->loader(); bool hasChildLoaded = childLoader->frameHasLoaded(); @@ -536,6 +523,7 @@ PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bo bfItem->addChildItem(childLoader->history()->createItemTree(targetFrame, clipAtTarget)); } } + // FIXME: Eliminate the isTargetItem flag in favor of itemSequenceNumber. if (m_frame == targetFrame) bfItem->setIsTargetItem(true); return bfItem; @@ -550,21 +538,15 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt ASSERT(item); ASSERT(fromItem); - KURL itemURL = item->url(); - KURL currentURL; - if (m_frame->loader()->documentLoader()) - currentURL = m_frame->loader()->documentLoader()->url(); - - // Always reload the target frame of the item we're going to. This ensures that we will - // do -some- load for the transition, which means a proper notification will be posted - // to the app. - // The exact URL has to match, including fragment. We want to go through the _load - // method, even if to do a within-page navigation. - // The current frame tree and the frame tree snapshot in the item have to match. - if (!item->isTargetItem() && - itemURL == currentURL && - ((m_frame->tree()->name().isEmpty() && item->target().isEmpty()) || m_frame->tree()->name() == item->target()) && - childFramesMatchItem(item)) + // If the item we're going to is a clone of the item we're at, then do + // not load it again, and continue history traversal to its children. + // The current frame tree and the frame tree snapshot in the item have + // to match. + // Note: If item and fromItem are the same, then we need to create a new + // document. + if (item != fromItem && item->itemSequenceNumber() == fromItem->itemSequenceNumber() + && ((m_frame->tree()->name().isEmpty() && item->target().isEmpty()) || m_frame->tree()->name() == item->target()) + && childFramesMatchItem(item)) { // This content is good, so leave it alone and look for children that need reloading // Save form state (works from currentItem, since prevItem is nil) @@ -659,10 +641,6 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, item->setStateObject(stateObject); item->setURLString(urlString); - // Since the document isn't changed as a result of a pushState call, we - // should preserve the DocumentSequenceNumber of the previous item. - item->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber()); - page->backForwardList()->pushStateItem(item.release()); } diff --git a/WebCore/loader/HistoryController.h b/WebCore/loader/HistoryController.h index 64f7854..19902f8 100644 --- a/WebCore/loader/HistoryController.h +++ b/WebCore/loader/HistoryController.h @@ -43,6 +43,8 @@ class SerializedScriptValue; class HistoryController : public Noncopyable { public: + enum HistoryUpdateType { UpdateAll, UpdateAllExceptBackForwardList }; + HistoryController(Frame*); ~HistoryController(); @@ -58,11 +60,10 @@ public: void invalidateCurrentItemCachedPage(); void goToItem(HistoryItem*, FrameLoadType); - bool urlsMatchItem(HistoryItem*) const; void updateForBackForwardNavigation(); void updateForReload(); - void updateForStandardLoad(); + void updateForStandardLoad(HistoryUpdateType updateType = UpdateAll); void updateForRedirectWithLockedBackForwardList(); void updateForClientRedirect(); void updateForCommit(); diff --git a/WebCore/loader/ImageDocument.cpp b/WebCore/loader/ImageDocument.cpp index 8ab412f..49f54e2 100644 --- a/WebCore/loader/ImageDocument.cpp +++ b/WebCore/loader/ImageDocument.cpp @@ -25,14 +25,11 @@ #include "config.h" #include "ImageDocument.h" -#include "CSSStyleDeclaration.h" #include "CachedImage.h" #include "DocumentLoader.h" -#include "Element.h" #include "EventListener.h" #include "EventNames.h" #include "Frame.h" -#include "FrameLoader.h" #include "FrameLoaderClient.h" #include "FrameView.h" #include "HTMLImageElement.h" @@ -41,10 +38,8 @@ #include "MouseEvent.h" #include "NotImplemented.h" #include "Page.h" -#include "SegmentedString.h" +#include "RawDataDocumentParser.h" #include "Settings.h" -#include "Text.h" -#include "XMLDocumentParser.h" using std::min; @@ -76,19 +71,21 @@ private: ImageDocument* m_doc; }; -class ImageTokenizer : public DocumentParser { +class ImageDocumentParser : public RawDataDocumentParser { public: - ImageTokenizer(ImageDocument* doc) : m_doc(doc) {} + ImageDocumentParser(ImageDocument* document) + : RawDataDocumentParser(document) + { + } - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool isWaitingForScripts() const; - - virtual bool wantsRawData() const { return true; } - virtual bool writeRawData(const char* data, int len); + ImageDocument* document() const + { + return static_cast<ImageDocument*>(m_document); + } private: - ImageDocument* m_doc; + virtual bool writeRawData(const char* data, int len); + virtual void finish(); }; class ImageDocumentElement : public HTMLImageElement { @@ -110,7 +107,7 @@ private: inline PassRefPtr<ImageDocumentElement> ImageDocumentElement::create(ImageDocument* document) { - return new ImageDocumentElement(document); + return adoptRef(new ImageDocumentElement(document)); } // -------- @@ -121,69 +118,57 @@ static float pageZoomFactor(Document* document) return view ? view->pageZoomFactor() : 1; } -void ImageTokenizer::write(const SegmentedString&, bool) +bool ImageDocumentParser::writeRawData(const char*, int) { - // <https://bugs.webkit.org/show_bug.cgi?id=25397>: JS code can always call document.write, we need to handle it. - notImplemented(); -} - -bool ImageTokenizer::writeRawData(const char*, int) -{ - Frame* frame = m_doc->frame(); + Frame* frame = document()->frame(); Settings* settings = frame->settings(); if (!frame->loader()->client()->allowImages(!settings || settings->areImagesEnabled())) return false; - - CachedImage* cachedImage = m_doc->cachedImage(); + + CachedImage* cachedImage = document()->cachedImage(); cachedImage->data(frame->loader()->documentLoader()->mainResourceData(), false); - m_doc->imageChanged(); + document()->imageChanged(); return false; } -void ImageTokenizer::finish() +void ImageDocumentParser::finish() { - if (!m_parserStopped && m_doc->imageElement()) { - CachedImage* cachedImage = m_doc->cachedImage(); - RefPtr<SharedBuffer> data = m_doc->frame()->loader()->documentLoader()->mainResourceData(); + if (!m_parserStopped && document()->imageElement()) { + CachedImage* cachedImage = document()->cachedImage(); + RefPtr<SharedBuffer> data = document()->frame()->loader()->documentLoader()->mainResourceData(); // If this is a multipart image, make a copy of the current part, since the resource data // will be overwritten by the next part. - if (m_doc->frame()->loader()->documentLoader()->isLoadingMultipartContent()) + if (document()->frame()->loader()->documentLoader()->isLoadingMultipartContent()) data = data->copy(); cachedImage->data(data.release(), true); cachedImage->finish(); - cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response()); + cachedImage->setResponse(document()->frame()->loader()->documentLoader()->response()); - IntSize size = cachedImage->imageSize(pageZoomFactor(m_doc)); + IntSize size = cachedImage->imageSize(pageZoomFactor(document())); if (size.width()) { // Compute the title, we use the decoded filename of the resource, falling // back on the (decoded) hostname if there is no path. - String fileName = decodeURLEscapeSequences(m_doc->url().lastPathComponent()); + String fileName = decodeURLEscapeSequences(document()->url().lastPathComponent()); if (fileName.isEmpty()) - fileName = m_doc->url().host(); - m_doc->setTitle(imageTitle(fileName, size)); + fileName = document()->url().host(); + document()->setTitle(imageTitle(fileName, size)); } - m_doc->imageChanged(); + document()->imageChanged(); } - m_doc->finishedParsing(); -} - -bool ImageTokenizer::isWaitingForScripts() const -{ - // An image document is never waiting for scripts - return false; + document()->finishedParsing(); } // -------- -ImageDocument::ImageDocument(Frame* frame) - : HTMLDocument(frame) +ImageDocument::ImageDocument(Frame* frame, const KURL& url) + : HTMLDocument(frame, url) , m_imageElement(0) , m_imageSizeIsKnown(false) , m_didShrinkImage(false) @@ -194,7 +179,7 @@ ImageDocument::ImageDocument(Frame* frame) DocumentParser* ImageDocument::createParser() { - return new ImageTokenizer(this); + return new ImageDocumentParser(this); } void ImageDocument::createDocumentStructure() @@ -203,6 +188,9 @@ void ImageDocument::createDocumentStructure() RefPtr<Element> rootElement = Document::createElement(htmlTag, false); appendChild(rootElement, ec); + + if (frame() && frame()->loader()) + frame()->loader()->dispatchDocumentElementAvailable(); RefPtr<Element> body = Document::createElement(bodyTag, false); body->setAttribute(styleAttr, "margin: 0px;"); diff --git a/WebCore/loader/ImageDocument.h b/WebCore/loader/ImageDocument.h index bd627b4..e85b3ab 100644 --- a/WebCore/loader/ImageDocument.h +++ b/WebCore/loader/ImageDocument.h @@ -33,9 +33,9 @@ class ImageDocumentElement; class ImageDocument : public HTMLDocument { public: - static PassRefPtr<ImageDocument> create(Frame* frame) + static PassRefPtr<ImageDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new ImageDocument(frame)); + return adoptRef(new ImageDocument(frame, url)); } CachedImage* cachedImage(); @@ -47,7 +47,7 @@ public: void imageClicked(int x, int y); private: - ImageDocument(Frame*); + ImageDocument(Frame*, const KURL&); virtual DocumentParser* createParser(); virtual bool isImageDocument() const { return true; } diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp index 28587e2..0a5bf40 100644 --- a/WebCore/loader/MainResourceLoader.cpp +++ b/WebCore/loader/MainResourceLoader.cpp @@ -285,7 +285,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction policy) #if PLATFORM(QT) void MainResourceLoader::substituteMIMETypeFromPluginDatabase(const ResourceResponse& r) { - if (!m_frame->loader()->allowPlugins(NotAboutToInstantiatePlugin)) + if (!m_frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) return; String filename = r.url().lastPathComponent(); diff --git a/WebCore/loader/MediaDocument.cpp b/WebCore/loader/MediaDocument.cpp index e505c2f..97ca783 100644 --- a/WebCore/loader/MediaDocument.cpp +++ b/WebCore/loader/MediaDocument.cpp @@ -29,11 +29,8 @@ #include "MediaDocument.h" #include "DocumentLoader.h" -#include "Element.h" -#include "Event.h" #include "EventNames.h" #include "Frame.h" -#include "FrameLoader.h" #include "FrameLoaderClient.h" #include "HTMLEmbedElement.h" #include "HTMLNames.h" @@ -41,51 +38,41 @@ #include "KeyboardEvent.h" #include "MainResourceLoader.h" #include "NodeList.h" -#include "Page.h" -#include "SegmentedString.h" -#include "Settings.h" -#include "Text.h" -#include "XMLDocumentParser.h" +#include "RawDataDocumentParser.h" namespace WebCore { using namespace HTMLNames; -class MediaDocumentParser : public DocumentParser { +// FIXME: Share more code with PluginDocumentParser. +class MediaDocumentParser : public RawDataDocumentParser { public: - MediaDocumentParser(Document* doc) : m_doc(doc), m_mediaElement(0) {} - + MediaDocumentParser(Document* document) + : RawDataDocumentParser(document) + , m_mediaElement(0) + { + } + private: - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool isWaitingForScripts() const; - - virtual bool wantsRawData() const { return true; } virtual bool writeRawData(const char* data, int len); - + void createDocumentStructure(); - Document* m_doc; HTMLMediaElement* m_mediaElement; }; - -void MediaDocumentParser::write(const SegmentedString&, bool) -{ - ASSERT_NOT_REACHED(); -} void MediaDocumentParser::createDocumentStructure() { ExceptionCode ec; - RefPtr<Element> rootElement = m_doc->createElement(htmlTag, false); - m_doc->appendChild(rootElement, ec); + RefPtr<Element> rootElement = document()->createElement(htmlTag, false); + document()->appendChild(rootElement, ec); - RefPtr<Element> body = m_doc->createElement(bodyTag, false); + RefPtr<Element> body = document()->createElement(bodyTag, false); body->setAttribute(styleAttr, "background-color: rgb(38,38,38);"); rootElement->appendChild(body, ec); - RefPtr<Element> mediaElement = m_doc->createElement(videoTag, false); + RefPtr<Element> mediaElement = document()->createElement(videoTag, false); m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get()); m_mediaElement->setAttribute(controlsAttr, ""); @@ -93,11 +80,11 @@ void MediaDocumentParser::createDocumentStructure() m_mediaElement->setAttribute(styleAttr, "margin: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0;"); m_mediaElement->setAttribute(nameAttr, "media"); - m_mediaElement->setSrc(m_doc->url()); + m_mediaElement->setSrc(document()->url()); body->appendChild(mediaElement, ec); - Frame* frame = m_doc->frame(); + Frame* frame = document()->frame(); if (!frame) return; @@ -114,21 +101,9 @@ bool MediaDocumentParser::writeRawData(const char*, int) finish(); return false; } - -void MediaDocumentParser::finish() -{ - if (!m_parserStopped) - m_doc->finishedParsing(); -} - -bool MediaDocumentParser::isWaitingForScripts() const -{ - // A media document is never waiting for scripts - return false; -} -MediaDocument::MediaDocument(Frame* frame) - : HTMLDocument(frame) +MediaDocument::MediaDocument(Frame* frame, const KURL& url) + : HTMLDocument(frame, url) , m_replaceMediaElementTimer(this, &MediaDocument::replaceMediaElementTimerFired) { setParseMode(Compat); diff --git a/WebCore/loader/MediaDocument.h b/WebCore/loader/MediaDocument.h index 98eb02f..5a8ec52 100644 --- a/WebCore/loader/MediaDocument.h +++ b/WebCore/loader/MediaDocument.h @@ -34,16 +34,16 @@ namespace WebCore { class MediaDocument : public HTMLDocument { public: - static PassRefPtr<MediaDocument> create(Frame* frame) + static PassRefPtr<MediaDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new MediaDocument(frame)); + return adoptRef(new MediaDocument(frame, url)); } virtual ~MediaDocument(); void mediaElementSawUnsupportedTracks(); private: - MediaDocument(Frame*); + MediaDocument(Frame*, const KURL&); virtual bool isMediaDocument() const { return true; } virtual DocumentParser* createParser(); diff --git a/WebCore/loader/PlaceholderDocument.h b/WebCore/loader/PlaceholderDocument.h index 5b76a9c..3d40a6e 100644 --- a/WebCore/loader/PlaceholderDocument.h +++ b/WebCore/loader/PlaceholderDocument.h @@ -32,15 +32,15 @@ namespace WebCore { class PlaceholderDocument : public Document { public: - static PassRefPtr<PlaceholderDocument> create(Frame* frame) + static PassRefPtr<PlaceholderDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new PlaceholderDocument(frame)); + return adoptRef(new PlaceholderDocument(frame, url)); } virtual void attach(); private: - PlaceholderDocument(Frame* frame) : Document(frame, false, false) { } + PlaceholderDocument(Frame* frame, const KURL& url) : Document(frame, url, false, false) { } }; } // namespace WebCore diff --git a/WebCore/loader/PluginDocument.cpp b/WebCore/loader/PluginDocument.cpp index 7833d41..12ab746 100644 --- a/WebCore/loader/PluginDocument.cpp +++ b/WebCore/loader/PluginDocument.cpp @@ -26,41 +26,36 @@ #include "PluginDocument.h" #include "DocumentLoader.h" -#include "Element.h" #include "Frame.h" -#include "FrameLoader.h" #include "FrameLoaderClient.h" #include "HTMLEmbedElement.h" #include "HTMLNames.h" #include "MainResourceLoader.h" #include "Page.h" +#include "RawDataDocumentParser.h" #include "RenderEmbeddedObject.h" -#include "RenderWidget.h" -#include "SegmentedString.h" #include "Settings.h" -#include "Text.h" -#include "XMLDocumentParser.h" namespace WebCore { using namespace HTMLNames; - -class PluginDocumentParser : public DocumentParser { + +// FIXME: Share more code with MediaDocumentParser. +class PluginDocumentParser : public RawDataDocumentParser { public: - PluginDocumentParser(Document* doc) : m_doc(doc), m_embedElement(0) {} - static Widget* pluginWidgetFromDocument(Document* doc); - + PluginDocumentParser(Document* document) + : RawDataDocumentParser(document) + , m_embedElement(0) + { + } + + static Widget* pluginWidgetFromDocument(Document*); + private: - virtual void write(const SegmentedString&, bool appendData); - virtual void finish(); - virtual bool isWaitingForScripts() const; - - virtual bool wantsRawData() const { return true; } virtual bool writeRawData(const char* data, int len); - + void createDocumentStructure(); - Document* m_doc; HTMLEmbedElement* m_embedElement; }; @@ -78,33 +73,28 @@ Widget* PluginDocumentParser::pluginWidgetFromDocument(Document* doc) return 0; } -void PluginDocumentParser::write(const SegmentedString&, bool) -{ - ASSERT_NOT_REACHED(); -} - void PluginDocumentParser::createDocumentStructure() { ExceptionCode ec; - RefPtr<Element> rootElement = m_doc->createElement(htmlTag, false); - m_doc->appendChild(rootElement, ec); + RefPtr<Element> rootElement = document()->createElement(htmlTag, false); + document()->appendChild(rootElement, ec); - RefPtr<Element> body = m_doc->createElement(bodyTag, false); + RefPtr<Element> body = document()->createElement(bodyTag, false); body->setAttribute(marginwidthAttr, "0"); body->setAttribute(marginheightAttr, "0"); body->setAttribute(bgcolorAttr, "rgb(38,38,38)"); rootElement->appendChild(body, ec); - RefPtr<Element> embedElement = m_doc->createElement(embedTag, false); + RefPtr<Element> embedElement = document()->createElement(embedTag, false); m_embedElement = static_cast<HTMLEmbedElement*>(embedElement.get()); m_embedElement->setAttribute(widthAttr, "100%"); m_embedElement->setAttribute(heightAttr, "100%"); m_embedElement->setAttribute(nameAttr, "plugin"); - m_embedElement->setAttribute(srcAttr, m_doc->url().string()); - m_embedElement->setAttribute(typeAttr, m_doc->frame()->loader()->writer()->mimeType()); + m_embedElement->setAttribute(srcAttr, document()->url().string()); + m_embedElement->setAttribute(typeAttr, document()->frame()->loader()->writer()->mimeType()); body->appendChild(embedElement, ec); } @@ -117,10 +107,10 @@ bool PluginDocumentParser::writeRawData(const char*, int) createDocumentStructure(); - if (Frame* frame = m_doc->frame()) { + if (Frame* frame = document()->frame()) { Settings* settings = frame->settings(); - if (settings && frame->loader()->allowPlugins(NotAboutToInstantiatePlugin)) { - m_doc->updateLayout(); + if (settings && frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) { + document()->updateLayout(); if (RenderWidget* renderer = toRenderWidget(m_embedElement->renderer())) { frame->loader()->client()->redirectDataToPlugin(renderer->widget()); @@ -134,20 +124,8 @@ bool PluginDocumentParser::writeRawData(const char*, int) return false; } -void PluginDocumentParser::finish() -{ - if (!m_parserStopped) - m_doc->finishedParsing(); -} - -bool PluginDocumentParser::isWaitingForScripts() const -{ - // A plugin document is never waiting for scripts - return false; -} - -PluginDocument::PluginDocument(Frame* frame) - : HTMLDocument(frame) +PluginDocument::PluginDocument(Frame* frame, const KURL& url) + : HTMLDocument(frame, url) { setParseMode(Compat); } diff --git a/WebCore/loader/PluginDocument.h b/WebCore/loader/PluginDocument.h index e3f98a7..53dde65 100644 --- a/WebCore/loader/PluginDocument.h +++ b/WebCore/loader/PluginDocument.h @@ -33,9 +33,9 @@ class Node; class Widget; class PluginDocument : public HTMLDocument { public: - static PassRefPtr<PluginDocument> create(Frame* frame) + static PassRefPtr<PluginDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new PluginDocument(frame)); + return adoptRef(new PluginDocument(frame, url)); } Widget* pluginWidget(); @@ -44,7 +44,7 @@ public: virtual bool isPluginDocument() const { return true; } private: - PluginDocument(Frame*); + PluginDocument(Frame*, const KURL&); virtual DocumentParser* createParser(); }; diff --git a/WebCore/loader/ProgressTracker.cpp b/WebCore/loader/ProgressTracker.cpp index 2e12204..88231c8 100644 --- a/WebCore/loader/ProgressTracker.cpp +++ b/WebCore/loader/ProgressTracker.cpp @@ -29,6 +29,7 @@ #include "DocumentLoader.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderStateMachine.h" #include "FrameLoaderClient.h" #include "Logging.h" #include "ResourceResponse.h" @@ -204,7 +205,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // For documents that use WebCore's layout system, treat first layout as the half-way point. // FIXME: The hasHTMLView function is a sort of roundabout way of asking "do you use WebCore's layout system". bool useClampedMaxProgress = frame->loader()->client()->hasHTMLView() - && !frame->loader()->firstLayoutDone(); + && !frame->loader()->stateMachine()->firstLayoutDone(); double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue; increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes; m_progressValue += increment; diff --git a/WebCore/loader/RedirectScheduler.cpp b/WebCore/loader/RedirectScheduler.cpp index b4c86d4..3cfe61a 100644 --- a/WebCore/loader/RedirectScheduler.cpp +++ b/WebCore/loader/RedirectScheduler.cpp @@ -36,9 +36,11 @@ #include "DocumentLoader.h" #include "Event.h" #include "FormState.h" +#include "FormSubmission.h" #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameLoader.h" +#include "FrameLoaderStateMachine.h" #include "HistoryItem.h" #include "HTMLFormElement.h" #include "HTMLFrameOwnerElement.h" @@ -170,15 +172,12 @@ private: class ScheduledFormSubmission : public ScheduledNavigation { public: - ScheduledFormSubmission(const FrameLoadRequest& frameRequest, bool lockHistory, bool lockBackForwardList, PassRefPtr<Event> event, PassRefPtr<FormState> formState, bool duringLoad) - : ScheduledNavigation(0, lockHistory, lockBackForwardList, duringLoad, true) - , m_frameRequest(frameRequest) - , m_event(event) - , m_formState(formState) + ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad) + : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true) + , m_submission(submission) , m_wasProcessingUserGesture(UserGestureIndicator::processingUserGesture()) { - ASSERT(!frameRequest.isEmpty()); - ASSERT(m_formState); + ASSERT(m_submission->state()); } virtual void fire(Frame* frame) @@ -189,9 +188,11 @@ public: // Now that the timer has fired, we need to repeat the security check which normally is done when // selecting a target, in case conditions have changed. Other code paths avoid this by targeting // without leaving a time window. If we fail the check just silently drop the form submission. - if (!m_formState->sourceFrame()->loader()->shouldAllowNavigation(frame)) + if (!m_submission->state()->sourceFrame()->loader()->shouldAllowNavigation(frame)) return; - frame->loader()->loadFrameRequest(m_frameRequest, lockHistory(), lockBackForwardList(), m_event, m_formState, SendReferrer); + FrameLoadRequest frameRequest; + m_submission->populateFrameLoadRequest(frameRequest); + frame->loader()->loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), SendReferrer); } // FIXME: Implement didStartTimer? It would make sense to report form @@ -200,9 +201,7 @@ public: // be a behavior change. private: - const FrameLoadRequest m_frameRequest; - const RefPtr<Event> m_event; - const RefPtr<FormState> m_formState; + RefPtr<FormSubmission> m_submission; bool m_wasProcessingUserGesture; }; @@ -281,31 +280,29 @@ void RedirectScheduler::scheduleLocationChange(const String& url, const String& // Handle a location change of a page with no document as a special case. // This may happen when a frame changes the location of another frame. - bool duringLoad = !loader->committedFirstRealDocumentLoad(); + bool duringLoad = !loader->stateMachine()->committedFirstRealDocumentLoad(); schedule(new ScheduledLocationChange(url, referrer, lockHistory, lockBackForwardList, wasUserGesture, duringLoad)); } -void RedirectScheduler::scheduleFormSubmission(const FrameLoadRequest& frameRequest, - bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState) +void RedirectScheduler::scheduleFormSubmission(PassRefPtr<FormSubmission> submission) { ASSERT(m_frame->page()); - ASSERT(!frameRequest.isEmpty()); // FIXME: Do we need special handling for form submissions where the URL is the same // as the current one except for the fragment part? See scheduleLocationChange above. // Handle a location change of a page with no document as a special case. // This may happen when a frame changes the location of another frame. - bool duringLoad = !m_frame->loader()->committedFirstRealDocumentLoad(); + bool duringLoad = !m_frame->loader()->stateMachine()->committedFirstRealDocumentLoad(); // If this is a child frame and the form submission was triggered by a script, lock the back/forward list // to match IE and Opera. // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this. - bool lockBackForwardList = mustLockBackForwardList(m_frame) || (formState->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); + bool lockBackForwardList = mustLockBackForwardList(m_frame) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); - schedule(new ScheduledFormSubmission(frameRequest, lockHistory, lockBackForwardList, event, formState, duringLoad)); + schedule(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad)); } void RedirectScheduler::scheduleRefresh(bool wasUserGesture) diff --git a/WebCore/loader/RedirectScheduler.h b/WebCore/loader/RedirectScheduler.h index ac3731c..e9d04dc 100644 --- a/WebCore/loader/RedirectScheduler.h +++ b/WebCore/loader/RedirectScheduler.h @@ -40,6 +40,7 @@ namespace WebCore { class FormState; +class FormSubmission; class Frame; class String; @@ -56,7 +57,7 @@ public: void scheduleRedirect(double delay, const String& url); void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false); - void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>); + void scheduleFormSubmission(PassRefPtr<FormSubmission>); void scheduleRefresh(bool userGesture = false); void scheduleHistoryNavigation(int steps); diff --git a/WebCore/loader/ResourceLoader.cpp b/WebCore/loader/ResourceLoader.cpp index 7a95383..b700fcf 100644 --- a/WebCore/loader/ResourceLoader.cpp +++ b/WebCore/loader/ResourceLoader.cpp @@ -510,8 +510,15 @@ void ResourceLoader::receivedCancellation(const AuthenticationChallenge&) void ResourceLoader::willCacheResponse(ResourceHandle*, CacheStoragePolicy& policy) { + // <rdar://problem/7249553> - There are reports of crashes with this method being called + // with a null m_frame->settings(), which can only happen if the frame doesn't have a page. + // Sadly we have no reproducible cases of this. + // We think that any frame without a page shouldn't have any loads happening in it, yet + // there is at least one code path where that is not true. + ASSERT(m_frame->settings()); + // When in private browsing mode, prevent caching to disk - if (policy == StorageAllowed && m_frame->settings()->privateBrowsingEnabled()) + if (policy == StorageAllowed && m_frame->settings() && m_frame->settings()->privateBrowsingEnabled()) policy = StorageAllowedInMemoryOnly; } diff --git a/WebCore/loader/SinkDocument.cpp b/WebCore/loader/SinkDocument.cpp index d40e567..e149981 100644 --- a/WebCore/loader/SinkDocument.cpp +++ b/WebCore/loader/SinkDocument.cpp @@ -26,40 +26,21 @@ #include "config.h" #include "SinkDocument.h" -#include "DocumentParser.h" +#include "RawDataDocumentParser.h" namespace WebCore { -class SinkDocumentParser : public DocumentParser { -public: - SinkDocumentParser(Document* document) : m_document(document) { } - -private: - virtual void write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); } - virtual void finish(); - virtual bool isWaitingForScripts() const { return false; } - - virtual bool wantsRawData() const { return true; } - virtual bool writeRawData(const char*, int) { return false; } - - Document* m_document; -}; - -void SinkDocumentParser::finish() -{ - if (!m_parserStopped) - m_document->finishedParsing(); -} - -SinkDocument::SinkDocument(Frame* frame) - : HTMLDocument(frame) +SinkDocument::SinkDocument(Frame* frame, const KURL& url) + : HTMLDocument(frame, url) { setParseMode(Compat); } - + DocumentParser* SinkDocument::createParser() { - return new SinkDocumentParser(this); + // The basic RawDataDocumentParser does nothing with the data + // which is sufficient for our purposes here. + return new RawDataDocumentParser(this); } } // namespace WebCore diff --git a/WebCore/loader/SinkDocument.h b/WebCore/loader/SinkDocument.h index 386660c..61930d4 100644 --- a/WebCore/loader/SinkDocument.h +++ b/WebCore/loader/SinkDocument.h @@ -32,13 +32,13 @@ namespace WebCore { class SinkDocument : public HTMLDocument { public: - static PassRefPtr<SinkDocument> create(Frame* frame) + static PassRefPtr<SinkDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new SinkDocument(frame)); + return adoptRef(new SinkDocument(frame, url)); } private: - SinkDocument(Frame*); + SinkDocument(Frame*, const KURL&); virtual DocumentParser* createParser(); }; diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp new file mode 100644 index 0000000..f5a4c18 --- /dev/null +++ b/WebCore/loader/SubframeLoader.cpp @@ -0,0 +1,352 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) Research In Motion Limited 2009. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SubframeLoader.h" + +#include "Frame.h" +#include "FrameLoaderClient.h" +#include "HTMLAppletElement.h" +#include "HTMLFrameElementBase.h" +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +#include "HTMLMediaElement.h" +#endif +#include "HTMLNames.h" +#include "HTMLPlugInElement.h" +#include "MIMETypeRegistry.h" +#include "Node.h" +#include "Page.h" +#include "PluginData.h" +#include "RenderEmbeddedObject.h" +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +#include "RenderVideo.h" +#endif +#include "RenderView.h" +#include "Settings.h" +#include "XSSAuditor.h" + +namespace WebCore { + +using namespace HTMLNames; + +SubframeLoader::SubframeLoader(Frame* frame) + : m_containsPlugins(false) + , m_frame(frame) +{ +} + +static HTMLPlugInElement* toPlugInElement(Node* node) +{ + if (!node) + return 0; + + ASSERT(node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag)); + + return static_cast<HTMLPlugInElement*>(node); +} + +void SubframeLoader::clear() +{ + m_containsPlugins = false; +} + +bool SubframeLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const String& urlString, const AtomicString& frameName, bool lockHistory, bool lockBackForwardList) +{ + // Support for <frame src="javascript:string"> + KURL scriptURL; + KURL url; + if (protocolIsJavaScript(urlString)) { + scriptURL = completeURL(urlString); // completeURL() encodes the URL. + url = blankURL(); + } else + url = completeURL(urlString); + + Frame* frame = ownerElement->contentFrame(); + if (frame) + frame->redirectScheduler()->scheduleLocationChange(url.string(), m_frame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, m_frame->loader()->isProcessingUserGesture()); + else + frame = loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoingReferrer()); + + if (!frame) + return false; + + if (!scriptURL.isEmpty()) + frame->script()->executeIfJavaScriptURL(scriptURL); + + return true; +} + +bool SubframeLoader::requestObject(RenderEmbeddedObject* renderer, const String& url, const AtomicString& frameName, + const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) +{ + if (url.isEmpty() && mimeType.isEmpty()) + return false; + + if (!m_frame->script()->xssAuditor()->canLoadObject(url)) { + // It is unsafe to honor the request for this object. + return false; + } + + KURL completedURL; + if (!url.isEmpty()) + completedURL = completeURL(url); + + bool useFallback; + if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback)) { + Settings* settings = m_frame->settings(); + if ((!allowPlugins(AboutToInstantiatePlugin) + // Application plugins are plugins implemented by the user agent, for example Qt plugins, + // as opposed to third-party code such as flash. The user agent decides whether or not they are + // permitted, rather than WebKit. + && !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType)) + || (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) + return false; + if (m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(SandboxPlugins)) + return false; + return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback); + } + + ASSERT(renderer->node()->hasTagName(objectTag) || renderer->node()->hasTagName(embedTag)); + HTMLPlugInElement* element = static_cast<HTMLPlugInElement*>(renderer->node()); + + // If the plug-in element already contains a subframe, requestFrame will re-use it. Otherwise, + // it will create a new frame and set it as the RenderPart's widget, causing what was previously + // in the widget to be torn down. + return requestFrame(element, completedURL, frameName); +} + + +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +PassRefPtr<Widget> FrameLoader::loadMediaPlayerProxyPlugin(Node* node, const KURL& url, + const Vector<String>& paramNames, const Vector<String>& paramValues) +{ + ASSERT(node->hasTagName(videoTag) || node->hasTagName(audioTag)); + + if (!m_frame->script()->xssAuditor()->canLoadObject(url.string())) + return 0; + + KURL completedURL; + if (!url.isEmpty()) + completedURL = completeURL(url); + + if (!SecurityOrigin::canLoad(completedURL, String(), frame()->document())) { + FrameLoader::reportLocalLoadFailed(m_frame, completedURL.string()); + return 0; + } + + HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(node); + RenderPart* renderer = toRenderPart(node->renderer()); + IntSize size; + + if (renderer) + size = IntSize(renderer->contentWidth(), renderer->contentHeight()); + else if (mediaElement->isVideo()) + size = RenderVideo::defaultSize(); + + m_frame->loader()->checkIfRunInsecureContent(m_frame->document()->securityOrigin(), completedURL); + + RefPtr<Widget> widget = m_frame->loader()->client()->createMediaPlayerProxyPlugin(size, mediaElement, completedURL, + paramNames, paramValues, "application/x-media-element-proxy-plugin"); + + if (widget && renderer) { + renderer->setWidget(widget); + m_containsPlugIns = true; + renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange); + } + + return widget ? widget.release() : 0; +} +#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) + +PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) +{ + String baseURLString; + String codeBaseURLString; + Vector<String> paramNames; + Vector<String> paramValues; + HashMap<String, String>::const_iterator end = args.end(); + for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) { + if (equalIgnoringCase(it->first, "baseurl")) + baseURLString = it->second; + else if (equalIgnoringCase(it->first, "codebase")) + codeBaseURLString = it->second; + paramNames.append(it->first); + paramValues.append(it->second); + } + + if (!codeBaseURLString.isEmpty()) { + KURL codeBaseURL = completeURL(codeBaseURLString); + if (!SecurityOrigin::canLoad(codeBaseURL, String(), element->document())) { + FrameLoader::reportLocalLoadFailed(m_frame, codeBaseURL.string()); + return 0; + } + } + + if (baseURLString.isEmpty()) + baseURLString = m_frame->document()->baseURL().string(); + KURL baseURL = completeURL(baseURLString); + + RefPtr<Widget> widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); + if (!widget) + return 0; + + m_containsPlugins = true; + return widget; +} + +Frame* SubframeLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL& url, const String& name, const String& referrer) +{ + bool allowsScrolling = true; + int marginWidth = -1; + int marginHeight = -1; + if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) { + HTMLFrameElementBase* o = static_cast<HTMLFrameElementBase*>(ownerElement); + allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff; + marginWidth = o->getMarginWidth(); + marginHeight = o->getMarginHeight(); + } + + if (!SecurityOrigin::canLoad(url, referrer, 0)) { + FrameLoader::reportLocalLoadFailed(m_frame, url.string()); + return 0; + } + + bool hideReferrer = SecurityOrigin::shouldHideReferrer(url, referrer); + RefPtr<Frame> frame = m_frame->loader()->client()->createFrame(url, name, ownerElement, hideReferrer ? String() : referrer, allowsScrolling, marginWidth, marginHeight); + + if (!frame) { + m_frame->loader()->checkCallImplicitClose(); + return 0; + } + + // All new frames will have m_isComplete set to true at this point due to synchronously loading + // an empty document in FrameLoader::init(). But many frames will now be starting an + // asynchronous load of url, so we set m_isComplete to false and then check if the load is + // actually completed below. (Note that we set m_isComplete to false even for synchronous + // loads, so that checkCompleted() below won't bail early.) + // FIXME: Can we remove this entirely? m_isComplete normally gets set to false when a load is committed. + frame->loader()->started(); + + RenderObject* renderer = ownerElement->renderer(); + FrameView* view = frame->view(); + if (renderer && renderer->isWidget() && view) + toRenderWidget(renderer)->setWidget(view); + + m_frame->loader()->checkCallImplicitClose(); + + // Some loads are performed synchronously (e.g., about:blank and loads + // cancelled by returning a null ResourceRequest from requestFromDelegate). + // In these cases, the synchronous load would have finished + // before we could connect the signals, so make sure to send the + // completed() signal for the child by hand and mark the load as being + // complete. + // FIXME: In this case the Frame will have finished loading before + // it's being added to the child list. It would be a good idea to + // create the child first, then invoke the loader separately. + if (frame->loader()->state() == FrameStateComplete) + frame->loader()->checkCompleted(); + + return frame.get(); +} + +bool SubframeLoader::allowPlugins(ReasonForCallingAllowPlugins reason) +{ + Settings* settings = m_frame->settings(); + bool allowed = m_frame->loader()->client()->allowPlugins(settings && settings->arePluginsEnabled()); + if (!allowed && reason == AboutToInstantiatePlugin) + m_frame->loader()->client()->didNotAllowPlugins(); + return allowed; +} + + +bool SubframeLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback) +{ + if (m_frame->loader()->client()->shouldUsePluginDocument(mimeType)) { + useFallback = false; + return true; + } + + // Allow other plug-ins to win over QuickTime because if the user has installed a plug-in that + // can handle TIFF (which QuickTime can also handle) they probably intended to override QT. + if (m_frame->page() && (mimeType == "image/tiff" || mimeType == "image/tif" || mimeType == "image/x-tiff")) { + const PluginData* pluginData = m_frame->page()->pluginData(); + String pluginName = pluginData ? pluginData->pluginNameForMimeType(mimeType) : String(); + if (!pluginName.isEmpty() && !pluginName.contains("QuickTime", false)) + return true; + } + + ObjectContentType objectType = m_frame->loader()->client()->objectContentType(url, mimeType); + // If an object's content can't be handled and it has no fallback, let + // it be handled as a plugin to show the broken plugin icon. + useFallback = objectType == ObjectContentNone && hasFallback; + return objectType == ObjectContentNone || objectType == ObjectContentNetscapePlugin || objectType == ObjectContentOtherPlugin; +} + +bool SubframeLoader::loadPlugin(RenderEmbeddedObject* renderer, const KURL& url, const String& mimeType, + const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) +{ + RefPtr<Widget> widget; + + if (renderer && !useFallback) { + HTMLPlugInElement* element = toPlugInElement(renderer->node()); + + if (!SecurityOrigin::canLoad(url, String(), m_frame->document())) { + FrameLoader::reportLocalLoadFailed(m_frame, url.string()); + return false; + } + + m_frame->loader()->checkIfRunInsecureContent(m_frame->document()->securityOrigin(), url); + + widget = m_frame->loader()->client()->createPlugin(IntSize(renderer->contentWidth(), renderer->contentHeight()), + element, url, paramNames, paramValues, mimeType, + m_frame->document()->isPluginDocument() && !m_containsPlugins); + if (widget) { + renderer->setWidget(widget); + m_containsPlugins = true; + +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange); +#endif + } else + renderer->setShowsMissingPluginIndicator(); + } + + return widget; +} + +KURL SubframeLoader::completeURL(const String& url) const +{ + ASSERT(m_frame->document()); + return m_frame->document()->completeURL(url); +} + +} // namespace WebCore diff --git a/WebCore/loader/SubframeLoader.h b/WebCore/loader/SubframeLoader.h new file mode 100644 index 0000000..4bdb787 --- /dev/null +++ b/WebCore/loader/SubframeLoader.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) Research In Motion Limited 2009. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SubframeLoader_h +#define SubframeLoader_h + +#include "FrameLoaderTypes.h" +#include "PlatformString.h" +#include <wtf/Forward.h> +#include <wtf/HashMap.h> +#include <wtf/Noncopyable.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class AtomicString; +class Frame; +class FrameLoaderClient; +class HTMLAppletElement; +class HTMLFrameOwnerElement; +class IntSize; +class KURL; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +class Node; +#endif +class RenderEmbeddedObject; +class Widget; + +// This is a slight misnomer. It handles the higher level logic of loading both subframes and plugins. +class SubframeLoader : public Noncopyable { +public: + SubframeLoader(Frame*); + + void clear(); + + bool requestFrame(HTMLFrameOwnerElement*, const String& url, const AtomicString& frameName, bool lockHistory = true, bool lockBackForwardList = true); + bool requestObject(RenderEmbeddedObject*, const String& url, const AtomicString& frameName, + const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues); + +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + PassRefPtr<Widget> loadMediaPlayerProxyPlugin(Node*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues); +#endif + + PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args); + + bool allowPlugins(ReasonForCallingAllowPlugins); + + bool containsPlugins() const { return m_containsPlugins; } + +private: + Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer); + bool loadPlugin(RenderEmbeddedObject*, const KURL&, const String& mimeType, + const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback); + + bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback); + + bool m_containsPlugins; + Frame* m_frame; + + KURL completeURL(const String&) const; +}; + +} // namespace WebCore + +#endif // SubframeLoader_h diff --git a/WebCore/loader/SubresourceLoader.cpp b/WebCore/loader/SubresourceLoader.cpp index 4bd3c8d..d37bb1c 100644 --- a/WebCore/loader/SubresourceLoader.cpp +++ b/WebCore/loader/SubresourceLoader.cpp @@ -51,7 +51,6 @@ SubresourceLoader::SubresourceLoader(Frame* frame, SubresourceLoaderClient* clie #ifndef NDEBUG subresourceLoaderCounter.increment(); #endif - m_documentLoader->addSubresourceLoader(this); } SubresourceLoader::~SubresourceLoader() @@ -99,6 +98,7 @@ PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, Subresourc fl->addExtraFieldsToSubresourceRequest(newRequest); RefPtr<SubresourceLoader> subloader(adoptRef(new SubresourceLoader(frame, client, sendResourceLoadCallbacks, shouldContentSniff))); + subloader->documentLoader()->addSubresourceLoader(subloader.get()); if (!subloader->load(newRequest)) return 0; diff --git a/WebCore/loader/TextDocument.cpp b/WebCore/loader/TextDocument.cpp index 68335a7..3360aca 100644 --- a/WebCore/loader/TextDocument.cpp +++ b/WebCore/loader/TextDocument.cpp @@ -44,8 +44,10 @@ public: virtual ~TextDocumentParser(); TextDocumentParser(HTMLViewSourceDocument*); +private: virtual void write(const SegmentedString&, bool appendData); virtual void finish(); + virtual bool finishWasCalled(); virtual bool isWaitingForScripts() const; inline void checkBuffer(int len = 10) @@ -59,9 +61,7 @@ public: m_size = newSize; } } - -private: - Document* m_doc; + Element* m_preElement; bool m_skipLF; @@ -71,8 +71,8 @@ private: UChar* m_dest; }; -TextDocumentParser::TextDocumentParser(Document* doc) - : m_doc(doc) +TextDocumentParser::TextDocumentParser(Document* document) + : DocumentParser(document) , m_preElement(0) , m_skipLF(false) { @@ -82,9 +82,8 @@ TextDocumentParser::TextDocumentParser(Document* doc) m_dest = m_buffer; } -TextDocumentParser::TextDocumentParser(HTMLViewSourceDocument* doc) - : DocumentParser(true) - , m_doc(doc) +TextDocumentParser::TextDocumentParser(HTMLViewSourceDocument* document) + : DocumentParser(document, true) , m_preElement(0) , m_skipLF(false) { @@ -132,13 +131,13 @@ void TextDocumentParser::write(const SegmentedString& s, bool) } if (!m_preElement && !inViewSourceMode()) { - RefPtr<Element> rootElement = m_doc->createElement(htmlTag, false); - m_doc->appendChild(rootElement, ec); + RefPtr<Element> rootElement = document()->createElement(htmlTag, false); + document()->appendChild(rootElement, ec); - RefPtr<Element> body = m_doc->createElement(bodyTag, false); + RefPtr<Element> body = document()->createElement(bodyTag, false); rootElement->appendChild(body, ec); - RefPtr<Element> preElement = m_doc->createElement(preTag, false); + RefPtr<Element> preElement = document()->createElement(preTag, false); preElement->setAttribute("style", "word-wrap: break-word; white-space: pre-wrap;", ec); body->appendChild(preElement, ec); @@ -148,14 +147,14 @@ void TextDocumentParser::write(const SegmentedString& s, bool) String string = String(m_buffer, m_dest - m_buffer); if (inViewSourceMode()) { - static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceText(string); + static_cast<HTMLViewSourceDocument*>(document())->addViewSourceText(string); return; } unsigned charsLeft = string.length(); while (charsLeft) { // split large text to nodes of manageable size - RefPtr<Text> text = Text::createWithLengthLimit(m_doc, string, charsLeft); + RefPtr<Text> text = Text::createWithLengthLimit(document(), string, charsLeft); m_preElement->appendChild(text, ec); } } @@ -169,7 +168,14 @@ void TextDocumentParser::finish() m_buffer = 0; m_dest = 0; - m_doc->finishedParsing(); + document()->finishedParsing(); +} + +bool TextDocumentParser::finishWasCalled() +{ + // finish() always calls document()->finishedParsing() so we'll be deleted + // after finish(). + return false; } bool TextDocumentParser::isWaitingForScripts() const @@ -178,8 +184,8 @@ bool TextDocumentParser::isWaitingForScripts() const return false; } -TextDocument::TextDocument(Frame* frame) - : HTMLDocument(frame) +TextDocument::TextDocument(Frame* frame, const KURL& url) + : HTMLDocument(frame, url) { } diff --git a/WebCore/loader/TextDocument.h b/WebCore/loader/TextDocument.h index 02c7af5..8f58b69 100644 --- a/WebCore/loader/TextDocument.h +++ b/WebCore/loader/TextDocument.h @@ -33,13 +33,13 @@ class HTMLViewSourceDocument; class TextDocument : public HTMLDocument { public: - static PassRefPtr<TextDocument> create(Frame* frame) + static PassRefPtr<TextDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new TextDocument(frame)); + return adoptRef(new TextDocument(frame, url)); } private: - TextDocument(Frame*); + TextDocument(Frame*, const KURL&); virtual DocumentParser* createParser(); }; diff --git a/WebCore/loader/appcache/ApplicationCache.cpp b/WebCore/loader/appcache/ApplicationCache.cpp index c0cd3ea..2ad4a4b 100644 --- a/WebCore/loader/appcache/ApplicationCache.cpp +++ b/WebCore/loader/appcache/ApplicationCache.cpp @@ -130,7 +130,7 @@ ApplicationCacheResource* ApplicationCache::resourceForRequest(const ResourceReq { // We only care about HTTP/HTTPS GET requests. if (!requestIsHTTPOrHTTPSGet(request)) - return false; + return 0; KURL url(request.url()); if (url.hasFragmentIdentifier()) diff --git a/WebCore/loader/archive/cf/LegacyWebArchive.cpp b/WebCore/loader/archive/cf/LegacyWebArchive.cpp index 931b159..3a144c2 100644 --- a/WebCore/loader/archive/cf/LegacyWebArchive.cpp +++ b/WebCore/loader/archive/cf/LegacyWebArchive.cpp @@ -198,7 +198,7 @@ PassRefPtr<ArchiveResource> LegacyWebArchive::createResource(CFDictionaryRef dic } CFStringRef mimeType = static_cast<CFStringRef>(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceMIMETypeKey)); - if (mimeType && CFGetTypeID(mimeType) != CFStringGetTypeID()) { + if (!mimeType || CFGetTypeID(mimeType) != CFStringGetTypeID()) { LOG(Archives, "LegacyWebArchive - MIME type is not of type CFString, cannot create invalid resource"); return 0; } diff --git a/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm b/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm index c474bba..6a35753 100644 --- a/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm +++ b/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm @@ -31,7 +31,7 @@ namespace WebCore { -static const NSString *LegacyWebArchiveResourceResponseKey = @"WebResourceResponse"; +static NSString * const LegacyWebArchiveResourceResponseKey = @"WebResourceResponse"; // FIXME: If is is possible to parse in a serialized NSURLResponse manually, without using // NSKeyedUnarchiver, manipulating plists directly, we would prefer to do that instead. diff --git a/WebCore/manual-tests/load-deferrer-script-element.html b/WebCore/manual-tests/load-deferrer-script-element.html new file mode 100644 index 0000000..c0ad773 --- /dev/null +++ b/WebCore/manual-tests/load-deferrer-script-element.html @@ -0,0 +1,44 @@ +<html> +<head> +<script> +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} + +function loadJSFile(){ + var s = document.createElement('script') + s.setAttribute("type", "text/javascript") + s.setAttribute("src", "resources/load-deferrer-script-element.js") + + document.getElementsByTagName("head")[0].appendChild(s); +} + +jsLoaded = false; +runningModal = false; + +// This line will load external script into memory. +loadJSFile(); + +function runModal() +{ + jsLoaded = true; + loadJSFile(); + + runningModal = true; + alert("Scripts should not be running in the background!"); + runningModal = false; +} +</script> +</head> + +<body> + +<p>This tests the bug https://bugs.webkit.org/show_bug.cgi?id=38910. +Click the button, wait 5 seconds and close it. +The test passes if no error messages show up in the page!</p> +<input id="button" type="button" value="click me" onclick="runModal()"/> +<p id="result"></p> + +</body> +</html> diff --git a/WebCore/manual-tests/localstorage-empty-database.html b/WebCore/manual-tests/localstorage-empty-database.html index a164127..d0fcc41 100644 --- a/WebCore/manual-tests/localstorage-empty-database.html +++ b/WebCore/manual-tests/localstorage-empty-database.html @@ -8,6 +8,9 @@ Since no data has been stored, no database file should have been created.</p> <p>If you click <a href="javascript:localStorage.setItem('bar', 'baz');">here</a>, data will be stored, and a database file should be created.</p> -<p>(This is for <a href="https://bugs.webkit.org/show_bug.cgi?id=40301">https://bugs.webkit.org/show_bug.cgi?id=40301</a>.)</p> +<p>If you click <a href="javascript:localStorage.clear();">here</a>, the local storage will be cleared, and the database file should be gone when the browser is closed.</p> + +<p>(This is for <a href="https://bugs.webkit.org/show_bug.cgi?id=40301">https://bugs.webkit.org/show_bug.cgi?id=40301</a> +and <a href="https://bugs.webkit.org/show_bug.cgi?id=40767">https://bugs.webkit.org/show_bug.cgi?id=40767</a>.)</p> </body> </html> diff --git a/WebCore/manual-tests/no-listbox-rendering.html b/WebCore/manual-tests/no-listbox-rendering.html index f4467a6..24336e0 100644 --- a/WebCore/manual-tests/no-listbox-rendering.html +++ b/WebCore/manual-tests/no-listbox-rendering.html @@ -22,6 +22,40 @@ At the right cell you see a description of what should be the state of the eleme <td>combobox in previos cell should have no selected option.</td> </tr> <tr> + <td> + <select multiple> + <optgroup label="1"></optgroup> + <option>11</option> + <option>12</option> + <option>13</option> + <option>14</option> + <optgroup label="2"></optgroup> + <option>21</option> + <option>22</option> + <option>23</option> + <option>24</option> + </select> + </td> + <td>combobox in previos cell should handle optgroup correctly.</td> + </tr> + <tr> + <td> + <select> + <optgroup label="1"></optgroup> + <option>11</option> + <option>12</option> + <option>13</option> + <option>14</option> + <optgroup label="2"></optgroup> + <option>21</option> + <option>22</option> + <option>23</option> + <option>24</option> + </select> + </td> + <td>combobox in previos cell should handle optgroup correctly.</td> + </tr> + <tr> <td><input type="reset"</td> <td>after pressing this button all the combo boxes should go back to the state discribed above.</td> </tr> diff --git a/WebCore/manual-tests/resources/load-deferrer-script-element.js b/WebCore/manual-tests/resources/load-deferrer-script-element.js new file mode 100644 index 0000000..fdecdb4 --- /dev/null +++ b/WebCore/manual-tests/resources/load-deferrer-script-element.js @@ -0,0 +1,5 @@ +if (jsLoaded) { + log("Button was clicked."); + // Use a big timeout value to ensure that error messages do not show up. + setTimeout(function() { if (runningModal) log("Error: This line should not show up!"); }, 3000); +} diff --git a/WebCore/manual-tests/xhr-failure-behind-alert.html b/WebCore/manual-tests/xhr-failure-behind-alert.html new file mode 100644 index 0000000..23b2a83 --- /dev/null +++ b/WebCore/manual-tests/xhr-failure-behind-alert.html @@ -0,0 +1,10 @@ +Connecting to a server that doesn't respond. +Run this from a local file to avoid cross-origin code path. + +<script> +var req = new XMLHttpRequest; +req.open("GET", "http://127.0.0.1:7", true); +req.send(); +req.onerror = function() { document.write("onerror<br>"); } +alert("PASSED if no crash or assertion failure"); +</script> diff --git a/WebCore/mathml/MathMLElement.cpp b/WebCore/mathml/MathMLElement.cpp index b84616f..b93ff9f 100644 --- a/WebCore/mathml/MathMLElement.cpp +++ b/WebCore/mathml/MathMLElement.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,20 +38,14 @@ namespace WebCore { using namespace MathMLNames; MathMLElement::MathMLElement(const QualifiedName& tagName, Document* document) - : StyledElement(tagName, document, CreateStyledElementZeroRefCount) + : StyledElement(tagName, document, CreateStyledElement) { } PassRefPtr<MathMLElement> MathMLElement::create(const QualifiedName& tagName, Document* document) { - return new MathMLElement(tagName, document); + return adoptRef(new MathMLElement(tagName, document)); } - -RenderObject* MathMLElement::createRenderer(RenderArena*, RenderStyle* style) -{ - return RenderObject::createObject(this, style); -} - } diff --git a/WebCore/mathml/MathMLElement.h b/WebCore/mathml/MathMLElement.h index 2fa322f..46cd7fd 100644 --- a/WebCore/mathml/MathMLElement.h +++ b/WebCore/mathml/MathMLElement.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,18 +31,16 @@ #include "StyledElement.h" namespace WebCore { - + class MathMLElement : public StyledElement { public: static PassRefPtr<MathMLElement> create(const QualifiedName& tagName, Document*); - - virtual bool isMathMLElement() const { return true; } - - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - + protected: MathMLElement(const QualifiedName& tagName, Document*); - + +private: + virtual bool isMathMLElement() const { return true; } }; } diff --git a/WebCore/mathml/MathMLInlineContainerElement.cpp b/WebCore/mathml/MathMLInlineContainerElement.cpp index c5fcac9..efc9f8c 100644 --- a/WebCore/mathml/MathMLInlineContainerElement.cpp +++ b/WebCore/mathml/MathMLInlineContainerElement.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +33,6 @@ #include "MathMLNames.h" #include "RenderMathMLBlock.h" #include "RenderMathMLFraction.h" -#include "RenderMathMLMath.h" #include "RenderMathMLRoot.h" #include "RenderMathMLRow.h" #include "RenderMathMLSquareRoot.h" @@ -50,16 +50,14 @@ MathMLInlineContainerElement::MathMLInlineContainerElement(const QualifiedName& PassRefPtr<MathMLInlineContainerElement> MathMLInlineContainerElement::create(const QualifiedName& tagName, Document* document) { - return new MathMLInlineContainerElement(tagName, document); + return adoptRef(new MathMLInlineContainerElement(tagName, document)); } -RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena *arena, RenderStyle* style) +RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena* arena, RenderStyle* style) { - RenderObject* object = 0; + RenderObject* object; if (hasLocalName(MathMLNames::mrowTag)) object = new (arena) RenderMathMLRow(this); - else if (hasLocalName(MathMLNames::mathTag)) - object = new (arena) RenderMathMLMath(this); else if (hasLocalName(MathMLNames::msubTag)) object = new (arena) RenderMathMLSubSup(this); else if (hasLocalName(MathMLNames::msupTag)) @@ -83,9 +81,7 @@ RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena *arena, R object->setStyle(style); return object; } - - + } #endif // ENABLE(MATHML) - diff --git a/WebCore/mathml/MathMLInlineContainerElement.h b/WebCore/mathml/MathMLInlineContainerElement.h index dc78dc4..4e80e36 100644 --- a/WebCore/mathml/MathMLInlineContainerElement.h +++ b/WebCore/mathml/MathMLInlineContainerElement.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,11 +36,11 @@ class MathMLInlineContainerElement : public MathMLElement { public: static PassRefPtr<MathMLInlineContainerElement> create(const QualifiedName& tagName, Document*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - protected: MathMLInlineContainerElement(const QualifiedName& tagName, Document*); +private: + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; } diff --git a/WebCore/mathml/MathMLMathElement.cpp b/WebCore/mathml/MathMLMathElement.cpp index bd3b797..1b6b18d 100644 --- a/WebCore/mathml/MathMLMathElement.cpp +++ b/WebCore/mathml/MathMLMathElement.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,21 +30,25 @@ #include "MathMLMathElement.h" -#include "MathMLNames.h" -#include "RenderObject.h" +#include "RenderMathMLMath.h" namespace WebCore { - -using namespace MathMLNames; -MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document* document) +inline MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document* document) : MathMLInlineContainerElement(tagName, document) { } PassRefPtr<MathMLMathElement> MathMLMathElement::create(const QualifiedName& tagName, Document* document) { - return new MathMLMathElement(tagName, document); + return adoptRef(new MathMLMathElement(tagName, document)); +} + +RenderObject* MathMLMathElement::createRenderer(RenderArena* arena, RenderStyle* style) +{ + RenderMathMLMath* renderer = new (arena) RenderMathMLMath(this); + renderer->setStyle(style); + return renderer; } } diff --git a/WebCore/mathml/MathMLMathElement.h b/WebCore/mathml/MathMLMathElement.h index e784524..d31d548 100644 --- a/WebCore/mathml/MathMLMathElement.h +++ b/WebCore/mathml/MathMLMathElement.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,14 +31,15 @@ #include "MathMLInlineContainerElement.h" namespace WebCore { - + class MathMLMathElement : public MathMLInlineContainerElement { public: static PassRefPtr<MathMLMathElement> create(const QualifiedName& tagName, Document*); - -protected: + +private: MathMLMathElement(const QualifiedName& tagName, Document*); - + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; } diff --git a/WebCore/mathml/MathMLTextElement.cpp b/WebCore/mathml/MathMLTextElement.cpp index 6f6bcbc..4135d6c 100644 --- a/WebCore/mathml/MathMLTextElement.cpp +++ b/WebCore/mathml/MathMLTextElement.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,14 +37,14 @@ namespace WebCore { using namespace MathMLNames; -MathMLTextElement::MathMLTextElement(const QualifiedName& tagName, Document* document) +inline MathMLTextElement::MathMLTextElement(const QualifiedName& tagName, Document* document) : MathMLElement(tagName, document) { } PassRefPtr<MathMLTextElement> MathMLTextElement::create(const QualifiedName& tagName, Document* document) { - return new MathMLTextElement(tagName, document); + return adoptRef(new MathMLTextElement(tagName, document)); } RenderObject* MathMLTextElement::createRenderer(RenderArena* arena, RenderStyle* style) @@ -54,11 +55,9 @@ RenderObject* MathMLTextElement::createRenderer(RenderArena* arena, RenderStyle* return object; } - return RenderObject::createObject(this, style); + return MathMLElement::createRenderer(arena, style); } - } #endif // ENABLE(MATHML) - diff --git a/WebCore/mathml/MathMLTextElement.h b/WebCore/mathml/MathMLTextElement.h index e647bfa..3af93d5 100644 --- a/WebCore/mathml/MathMLTextElement.h +++ b/WebCore/mathml/MathMLTextElement.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,11 +36,10 @@ class MathMLTextElement : public MathMLElement { public: static PassRefPtr<MathMLTextElement> create(const QualifiedName& tagName, Document*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - -protected: +private: MathMLTextElement(const QualifiedName& tagName, Document*); - + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; } diff --git a/WebCore/mathml/RenderMathMLBlock.cpp b/WebCore/mathml/RenderMathMLBlock.cpp index a897ff5..ef94893 100644 --- a/WebCore/mathml/RenderMathMLBlock.cpp +++ b/WebCore/mathml/RenderMathMLBlock.cpp @@ -96,6 +96,12 @@ void RenderMathMLBlock::paint(PaintInfo& info, int tx, int ty) info.context->drawLine(IntPoint(tx, ty + offsetHeight()), IntPoint(tx + offsetWidth(), ty + offsetHeight())); info.context->drawLine(IntPoint(tx, ty), IntPoint(tx, ty + offsetHeight())); + int topStart = paddingTop(); + + info.context->setStrokeColor(Color(0, 255, 0), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty + topStart), IntPoint(tx + offsetWidth(), ty + topStart)); + int baseline = baselinePosition(true); info.context->setStrokeColor(Color(255, 0, 0), sRGBColorSpace); diff --git a/WebCore/mathml/RenderMathMLFraction.cpp b/WebCore/mathml/RenderMathMLFraction.cpp index 3399e55..811c230 100644 --- a/WebCore/mathml/RenderMathMLFraction.cpp +++ b/WebCore/mathml/RenderMathMLFraction.cpp @@ -127,14 +127,6 @@ void RenderMathMLFraction::layout() if (lastChild() && lastChild()->isRenderBlock()) m_lineThickness = m_lineThickness * ceil(gFractionBarWidth * style()->fontSize()); - if (previousSibling() && previousSibling()->isRenderBlock()) { - RenderBlock* sibling = toRenderBlock(previousSibling()); - verticalAlignCompute(sibling); - } else if (nextSibling() && nextSibling()->isRenderBlock()) { - RenderBlock* sibling = toRenderBlock(nextSibling()); - verticalAlignCompute(sibling); - } - RenderBlock::layout(); // The row layout can affect the numerator/denominator width. @@ -183,21 +175,15 @@ void RenderMathMLFraction::paint(PaintInfo& info, int tx, int ty) info.context->restore(); } -void RenderMathMLFraction::verticalAlignCompute(RenderBlock* sibling) -{ - if (sibling->isRenderMathMLBlock()) { - RenderMathMLBlock* op = toRenderMathMLBlock(sibling); - style()->setVerticalAlign(LENGTH); - int verticalShift = static_cast<int>(ceil(gFractionAlignment * op->offsetHeight() + 0.5 * lastChild()->style()->borderTopWidth())); - style()->setVerticalAlignLength(Length(verticalShift, Fixed)); - } -} - int RenderMathMLFraction::baselinePosition(bool firstLine, bool isRootLineBox) const { if (firstChild()->isRenderMathMLBlock()) { RenderMathMLBlock* numerator = toRenderMathMLBlock(firstChild()); - return numerator->offsetHeight(); + // FIXME: the baseline should adjust so the fraction line aligns + // relative certain operators (e.g. aligns with the horizontal + // stroke of the plus). 1/3 of the current font size is just + // a good guess. + return numerator->offsetHeight() + style()->fontSize() / 3; } return RenderBlock::baselinePosition(firstLine, isRootLineBox); } diff --git a/WebCore/mathml/RenderMathMLFraction.h b/WebCore/mathml/RenderMathMLFraction.h index 30162ac..c8c1cb8 100644 --- a/WebCore/mathml/RenderMathMLFraction.h +++ b/WebCore/mathml/RenderMathMLFraction.h @@ -43,7 +43,6 @@ public: protected: virtual void layout(); private: - void verticalAlignCompute(RenderBlock*); int m_lineThickness; }; diff --git a/WebCore/mathml/RenderMathMLOperator.cpp b/WebCore/mathml/RenderMathMLOperator.cpp index 1ab3409..911c5d2 100644 --- a/WebCore/mathml/RenderMathMLOperator.cpp +++ b/WebCore/mathml/RenderMathMLOperator.cpp @@ -56,11 +56,14 @@ bool RenderMathMLOperator::isChildAllowed(RenderObject*, RenderStyle*) const return false; } +static const float gOperatorSpacer = 0.1; +static const float gOperatorExpansion = 1.2; + void RenderMathMLOperator::stretchToHeight(int height) { if (height == m_stretchHeight) return; - m_stretchHeight = height; + m_stretchHeight = static_cast<int>(height * gOperatorExpansion); updateBoxModelInfoFromStyle(); setNeedsLayoutAndPrefWidthsRecalc(); @@ -110,6 +113,7 @@ static const int gMinimumStretchHeight = 24; static const int gGlyphHeight = 10; static const int gMiddleGlyphTopAdjust = -2; static const int gBottomGlyphTopAdjust = -4; +static const float gMinimumRatioForStretch = 0.10; void RenderMathMLOperator::updateFromElement() { @@ -161,15 +165,16 @@ void RenderMathMLOperator::updateFromElement() // We only stretch character if the stretch height is larger than a minimum size (e.g. 24px). bool shouldStretch = isStretchy && m_stretchHeight>gMinimumStretchHeight; + m_isCentered = true; // Either stretch is disabled or we don't have a stretchable character over the minimum height if (stretchDisabled || !shouldStretch) { m_isStacked = false; - RenderBlock* container = new (renderArena()) RenderBlock(node()); + RenderBlock* container = new (renderArena()) RenderMathMLBlock(node()); RefPtr<RenderStyle> newStyle = RenderStyle::create(); newStyle->inheritFrom(style()); - newStyle->setDisplay(BLOCK); + newStyle->setDisplay(INLINE_BLOCK); // Check for a stretchable character that is under the minimum height and use the // font size to adjust the glyph size. @@ -181,9 +186,20 @@ void RenderMathMLOperator::updateFromElement() desc->setComputedSize(m_stretchHeight); newStyle->setFontDescription(*desc); newStyle->font().update(newStyle->font().fontSelector()); + newStyle->setVerticalAlign(BASELINE); + m_isCentered = false; + } else { + int topPad = (m_stretchHeight - currentFontSize) / 2; + + if (topPad / static_cast<float>(m_stretchHeight) > gMinimumRatioForStretch) { + newStyle->setVerticalAlign(TOP); + newStyle->setPaddingTop(Length(topPad, Fixed)); + } else { + m_isCentered = false; + newStyle->setVerticalAlign(BASELINE); + } } - newStyle->setVerticalAlign(BASELINE); container->setStyle(newStyle.release()); addChild(container); @@ -196,7 +212,9 @@ void RenderMathMLOperator::updateFromElement() text = new (renderArena()) RenderText(node(), StringImpl::create(mo->textContent().characters(), mo->textContent().length())); // If we can't figure out the text, leave it blank. if (text) { - text->setStyle(container->style()); + RefPtr<RenderStyle> textStyle = RenderStyle::create(); + textStyle->inheritFrom(container->style()); + text->setStyle(textStyle.release()); container->addChild(text); } } else { @@ -296,7 +314,7 @@ RefPtr<RenderStyle> RenderMathMLOperator::createStackableStyle(int size, int top RenderBlock* RenderMathMLOperator::createGlyph(UChar glyph, int size, int charRelative, int topRelative) { - RenderBlock* container = new (renderArena()) RenderBlock(node()); + RenderBlock* container = new (renderArena()) RenderMathMLBlock(node()); container->setStyle(createStackableStyle(size, topRelative).release()); addChild(container); RenderBlock* parent = container; @@ -320,7 +338,11 @@ RenderBlock* RenderMathMLOperator::createGlyph(UChar glyph, int size, int charRe int RenderMathMLOperator::baselinePosition(bool firstLine, bool isRootLineBox) const { - return !m_isStacked && firstChild() ? firstChild()->baselinePosition(firstLine, isRootLineBox) : offsetHeight(); + if (m_isStacked) + return m_stretchHeight * 2 / 3 - (m_stretchHeight - static_cast<int>(m_stretchHeight / gOperatorExpansion)) / 2; + if (m_isCentered && firstChild()) + return firstChild()->baselinePosition(firstLine, isRootLineBox); + return RenderBlock::baselinePosition(firstLine, isRootLineBox); } } diff --git a/WebCore/mathml/RenderMathMLOperator.h b/WebCore/mathml/RenderMathMLOperator.h index 6566dd7..cc183c3 100644 --- a/WebCore/mathml/RenderMathMLOperator.h +++ b/WebCore/mathml/RenderMathMLOperator.h @@ -50,6 +50,7 @@ protected: private: int m_stretchHeight; bool m_isStacked; + bool m_isCentered; UChar m_operator; }; diff --git a/WebCore/mathml/RenderMathMLRoot.cpp b/WebCore/mathml/RenderMathMLRoot.cpp index 23e3519..c624539 100644 --- a/WebCore/mathml/RenderMathMLRoot.cpp +++ b/WebCore/mathml/RenderMathMLRoot.cpp @@ -97,6 +97,9 @@ void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty) { RenderMathMLBlock::paint(info , tx , ty); + if (info.context->paintingDisabled()) + return; + tx += x(); ty += y(); @@ -145,7 +148,7 @@ void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty) info.context->setStrokeThickness(gRadicalLineThickness * style()->fontSize()); info.context->setStrokeStyle(SolidStroke); - info.context->setStrokeColor(style()->color(), sRGBColorSpace); + info.context->setStrokeColor(style()->visitedDependentColor(CSSPropertyColor), sRGBColorSpace); info.context->setLineJoin(MiterJoin); info.context->setMiterLimit(style()->fontSize()); @@ -204,8 +207,7 @@ void RenderMathMLRoot::layout() int maxHeight = toRenderBoxModelObject(lastChild())->offsetHeight(); RenderObject* current = lastChild()->firstChild(); - - toRenderMathMLBlock(current)->style()->setVerticalAlign(BASELINE); + current->style()->setVerticalAlign(BASELINE); if (!maxHeight) maxHeight = style()->fontSize(); @@ -238,9 +240,11 @@ void RenderMathMLRoot::layout() setNeedsLayoutAndPrefWidthsRecalc(); markContainingBlocksForLayout(); RenderBlock::layout(); - + indexBox->style()->setBottom(Length(radicalHeight + style()->paddingBottom().value(), Fixed)); - + + // Now that we've potentially changed its position, we need layout the index again. + indexBox->setNeedsLayoutAndPrefWidthsRecalc(); indexBox->layout(); } diff --git a/WebCore/mathml/RenderMathMLRow.cpp b/WebCore/mathml/RenderMathMLRow.cpp index 1bb656f..acbfb9d 100644 --- a/WebCore/mathml/RenderMathMLRow.cpp +++ b/WebCore/mathml/RenderMathMLRow.cpp @@ -69,9 +69,6 @@ void RenderMathMLRow::layout() // Calculate the maximum height of the row without the operators. int maxHeight = nonOperatorHeight(); - // Set the maximum height of the row for intermediate layouts. - style()->setHeight(Length(maxHeight, Fixed)); - // Notify contained operators they may need to re-layout their stretched operators. // We need to keep track of the number of children and operators because a row of // operators needs some special handling. @@ -141,16 +138,24 @@ void RenderMathMLRow::layout() maxHeight = box->offsetHeight(); } } - - // Set the maximum height of the row based on the calculations. - style()->setHeight(Length(maxHeight, Fixed)); - // Do the final layout by calling our parent's layout again. + // Mark outself as needing layout and do the final layout of the row. setNeedsLayoutAndPrefWidthsRecalc(); markContainingBlocksForLayout(); RenderBlock::layout(); -} +} +int RenderMathMLRow::baselinePosition(bool firstLine, bool isRootLineBox) const +{ + if (firstChild() && firstChild()->isRenderMathMLBlock()) { + RenderMathMLBlock* block = toRenderMathMLBlock(firstChild()); + if (block->isRenderMathMLOperator()) + return block->baselinePosition(firstLine, isRootLineBox); + } + + return RenderBlock::baselinePosition(firstLine, isRootLineBox); +} + } #endif // ENABLE(MATHML) diff --git a/WebCore/mathml/RenderMathMLRow.h b/WebCore/mathml/RenderMathMLRow.h index a88b212..83c6832 100644 --- a/WebCore/mathml/RenderMathMLRow.h +++ b/WebCore/mathml/RenderMathMLRow.h @@ -37,6 +37,7 @@ public: RenderMathMLRow(Node* container); virtual bool isRenderMathMLRow() const { return true; } virtual int nonOperatorHeight() const; + virtual int baselinePosition(bool , bool) const; protected: virtual void layout(); }; diff --git a/WebCore/mathml/RenderMathMLSquareRoot.cpp b/WebCore/mathml/RenderMathMLSquareRoot.cpp index fc0a16d..6802176 100644 --- a/WebCore/mathml/RenderMathMLSquareRoot.cpp +++ b/WebCore/mathml/RenderMathMLSquareRoot.cpp @@ -69,6 +69,9 @@ void RenderMathMLSquareRoot::paint(PaintInfo& info, int tx, int ty) { RenderMathMLBlock::paint(info, tx, ty); + if (info.context->paintingDisabled()) + return; + tx += x(); ty += y(); @@ -114,7 +117,7 @@ void RenderMathMLSquareRoot::paint(PaintInfo& info, int tx, int ty) info.context->setStrokeThickness(gRadicalLineThickness * style()->fontSize()); info.context->setStrokeStyle(SolidStroke); - info.context->setStrokeColor(style()->color(), sRGBColorSpace); + info.context->setStrokeColor(style()->visitedDependentColor(CSSPropertyColor), sRGBColorSpace); info.context->setLineJoin(MiterJoin); info.context->setMiterLimit(style()->fontSize()); diff --git a/WebCore/mathml/RenderMathMLSubSup.cpp b/WebCore/mathml/RenderMathMLSubSup.cpp index 3124ac9..af25980 100644 --- a/WebCore/mathml/RenderMathMLSubSup.cpp +++ b/WebCore/mathml/RenderMathMLSubSup.cpp @@ -72,7 +72,7 @@ void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild RefPtr<RenderStyle> scriptsStyle = RenderStyle::create(); scriptsStyle->inheritFrom(style()); scriptsStyle->setDisplay(INLINE_BLOCK); - scriptsStyle->setVerticalAlign(MIDDLE); + scriptsStyle->setVerticalAlign(TOP); scriptsStyle->setMarginLeft(Length(gSubsupScriptMargin, Fixed)); scriptsStyle->setTextAlign(LEFT); m_scripts->setStyle(scriptsStyle.release()); @@ -95,7 +95,7 @@ void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild RefPtr<RenderStyle> wrapperStyle = RenderStyle::create(); wrapperStyle->inheritFrom(style()); wrapperStyle->setDisplay(INLINE_BLOCK); - wrapperStyle->setVerticalAlign(MIDDLE); + wrapperStyle->setVerticalAlign(TOP); wrapper->setStyle(wrapperStyle.release()); RenderMathMLBlock::addChild(wrapper, beforeChild); wrapper->addChild(child); @@ -141,21 +141,32 @@ int RenderMathMLSubSup::nonOperatorHeight() const void RenderMathMLSubSup::layout() { + if (firstChild()) { + firstChild()->setNeedsLayoutAndPrefWidthsRecalc(); + firstChild()->markContainingBlocksForLayout(); + } + if (m_scripts) { + m_scripts->setNeedsLayoutAndPrefWidthsRecalc(); + m_scripts->markContainingBlocksForLayout(); + } RenderBlock::layout(); if (m_kind == SubSup) { - int width = 0; - RenderObject* current = firstChild(); - while (current) { - width += getBoxModelObjectWidth(current); - current = current->nextSibling(); + RenderObject* base = firstChild(); + if (base) { + int maxHeight = 0; + RenderObject* current = base->firstChild(); + while (current) { + int height = getBoxModelObjectHeight(current); + if (height > maxHeight) + maxHeight = height; + current = current->nextSibling(); + } + int heightDiff = (m_scripts->offsetHeight() - maxHeight) / 2; + if (heightDiff < 0) + heightDiff = 0; + base->style()->setMarginTop(Length(heightDiff, Fixed)); } - width++; - // 1 + margin of scripts - if (m_scripts) - width += gSubsupScriptMargin; - style()->setWidth(Length(width, Fixed)); - setNeedsLayoutAndPrefWidthsRecalc(); markContainingBlocksForLayout(); RenderBlock::layout(); @@ -181,7 +192,10 @@ int RenderMathMLSubSup::baselinePosition(bool firstLine, bool isRootLineBox) con RenderBoxModelObject* box = toRenderBoxModelObject(base); topAdjust = (m_scripts->offsetHeight() - box->offsetHeight()) / 2; } - return topAdjust + (base ? base->baselinePosition(firstLine, isRootLineBox) : 0) + 4; + // FIXME: The last bit of this calculation should be more exact. Why is the 2-3px scaled for zoom necessary? + // The baseline is top spacing of the base + the baseline of the base + adjusted space for zoom + float zoomFactor = style()->effectiveZoom(); + return topAdjust + base->baselinePosition(firstLine, isRootLineBox) + static_cast<int>((zoomFactor > 1.25 ? 2 : 3) * zoomFactor); } break; case Sup: diff --git a/WebCore/mathml/RenderMathMLUnderOver.cpp b/WebCore/mathml/RenderMathMLUnderOver.cpp index 514b872..ad32d59 100644 --- a/WebCore/mathml/RenderMathMLUnderOver.cpp +++ b/WebCore/mathml/RenderMathMLUnderOver.cpp @@ -234,7 +234,7 @@ void RenderMathMLUnderOver::layout() RenderBlock::layout(); } -int RenderMathMLUnderOver::baselinePosition(bool, bool) const +int RenderMathMLUnderOver::baselinePosition(bool firstLine, bool isRootLineBox) const { int baseline = 0; RenderObject* current = 0; @@ -247,9 +247,12 @@ int RenderMathMLUnderOver::baselinePosition(bool, bool) const if (current) { // actual base RenderObject* base = current->firstChild(); - baseline += base->baselinePosition(true); + baseline += base->baselinePosition(firstLine, isRootLineBox); // added the negative top margin baseline += current->style()->marginTop().value(); + // FIXME: Where is the extra 2-3px adjusted for zoom coming from? + float zoomFactor = style()->effectiveZoom(); + baseline += static_cast<int>((zoomFactor > 1.25 ? 2 : 3) * zoomFactor); } break; case Under: @@ -257,6 +260,9 @@ int RenderMathMLUnderOver::baselinePosition(bool, bool) const if (current) { RenderObject* base = current->firstChild(); baseline += base->baselinePosition(true); + // FIXME: Where is the extra 2-3px adjusted for zoom coming from? + float zoomFactor = style()->effectiveZoom(); + baseline += static_cast<int>((zoomFactor > 1.25 ? 2 : 3) * zoomFactor); } } return baseline; diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp index 5908634..3684245 100644 --- a/WebCore/notifications/Notification.cpp +++ b/WebCore/notifications/Notification.cpp @@ -90,8 +90,6 @@ Notification::~Notification() ASSERT_NOT_REACHED(); cancel(); } - if (m_presenter) - m_presenter->notificationObjectDestroyed(this); } void Notification::show() @@ -140,6 +138,12 @@ EventTargetData* Notification::ensureEventTargetData() return &m_eventTargetData; } +void Notification::contextDestroyed() +{ + ActiveDOMObject::contextDestroyed(); + if (m_presenter) + m_presenter->notificationObjectDestroyed(this); +} void Notification::startLoading() { diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h index 0e66b3d..20a319b 100644 --- a/WebCore/notifications/Notification.h +++ b/WebCore/notifications/Notification.h @@ -44,6 +44,7 @@ #include "NotificationContents.h" #include "RegisteredEventListener.h" #include "SharedBuffer.h" +#include "TextDirection.h" #include "ThreadableLoader.h" #include "ThreadableLoaderClient.h" #include <wtf/OwnPtr.h> @@ -76,6 +77,8 @@ namespace WebCore { String replaceId() const { return m_replaceId; } void setReplaceId(const String& replaceId) { m_replaceId = replaceId; } + TextDirection direction() const { return dir() == "rtl" ? RTL : LTR; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(display); DEFINE_ATTRIBUTE_EVENT_LISTENER(error); DEFINE_ATTRIBUTE_EVENT_LISTENER(close); @@ -87,6 +90,9 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } virtual Notification* toNotification() { return this; } + // ActiveDOMObject interface + virtual void contextDestroyed(); + void stopLoading(); SharedBuffer* iconData() { return m_iconData.get(); } diff --git a/WebCore/notifications/NotificationCenter.h b/WebCore/notifications/NotificationCenter.h index b72e07d..ce20630 100644 --- a/WebCore/notifications/NotificationCenter.h +++ b/WebCore/notifications/NotificationCenter.h @@ -33,6 +33,7 @@ #include "Notification.h" #include "NotificationContents.h" +#include "ScriptExecutionContext.h" #include "WorkerThread.h" #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> @@ -43,8 +44,6 @@ namespace WebCore { - class ScriptExecutionContext; - class NotificationCenter : public RefCounted<NotificationCenter>, public ActiveDOMObject { public: static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); } diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index 413dba1..40b7494 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "DOMWindow.h" +#include "AbstractDatabase.h" #include "Base64.h" #include "BarInfo.h" #include "BeforeUnloadEvent.h" @@ -229,7 +230,7 @@ bool DOMWindow::dispatchAllPendingBeforeUnloadEvents() if (!frame) continue; - if (!frame->shouldClose()) + if (!frame->loader()->shouldClose()) return false; } @@ -756,7 +757,18 @@ void DOMWindow::focus() if (!m_frame) return; - m_frame->focusWindow(); + Page* page = m_frame->page(); + if (!page) + return; + + // If we're a top level window, bring the window to the front. + if (m_frame == page->mainFrame()) + page->chrome()->focus(); + + if (!m_frame) + return; + + m_frame->eventHandler()->focusDocumentView(); } void DOMWindow::blur() @@ -764,7 +776,14 @@ void DOMWindow::blur() if (!m_frame) return; - m_frame->unfocusWindow(); + Page* page = m_frame->page(); + if (!page) + return; + + if (m_frame != page->mainFrame()) + return; + + page->chrome()->unfocus(); } void DOMWindow::close() @@ -782,8 +801,13 @@ void DOMWindow::close() Settings* settings = m_frame->settings(); bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseWindows(); - if (page->openedByDOM() || page->getHistoryLength() <= 1 || allowScriptsToCloseWindows) - m_frame->scheduleClose(); + if (!(page->openedByDOM() || page->getHistoryLength() <= 1 || allowScriptsToCloseWindows)) + return; + + if (!m_frame->loader()->shouldClose()) + return; + + page->chrome()->closeWindowSoon(); } void DOMWindow::print() @@ -1064,36 +1088,34 @@ void DOMWindow::setName(const String& string) m_frame->tree()->setName(string); } -String DOMWindow::status() const +void DOMWindow::setStatus(const String& string) { - if (!m_frame) - return String(); + m_status = string; - return m_frame->jsStatusBarText(); -} + if (!m_frame) + return; -void DOMWindow::setStatus(const String& string) -{ - if (!m_frame) - return; + Page* page = m_frame->page(); + if (!page) + return; - m_frame->setJSStatusBarText(string); + ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state. + page->chrome()->setStatusbarText(m_frame, m_status); } -String DOMWindow::defaultStatus() const +void DOMWindow::setDefaultStatus(const String& string) { - if (!m_frame) - return String(); + m_defaultStatus = string; - return m_frame->jsDefaultStatusBarText(); -} + if (!m_frame) + return; -void DOMWindow::setDefaultStatus(const String& string) -{ - if (!m_frame) - return; + Page* page = m_frame->page(); + if (!page) + return; - m_frame->setJSDefaultStatusBarText(string); + ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state. + page->chrome()->setStatusbarText(m_frame, m_defaultStatus); } DOMWindow* DOMWindow::self() const @@ -1219,7 +1241,7 @@ double DOMWindow::devicePixelRatio() const PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec) { RefPtr<Database> database = 0; - if (m_frame && Database::isAvailable() && m_frame->document()->securityOrigin()->canAccessDatabase()) + if (m_frame && AbstractDatabase::isAvailable() && m_frame->document()->securityOrigin()->canAccessDatabase()) database = Database::openDatabase(m_frame->document(), name, version, displayName, estimatedSize, creationCallback, ec); if (!database && !ec) diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index a1f40a8..4765b31 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -410,8 +410,21 @@ namespace WebCore { #endif EventTargetData m_eventTargetData; + + String m_status; + String m_defaultStatus; }; + inline String DOMWindow::status() const + { + return m_status; + } + + inline String DOMWindow::defaultStatus() const + { + return m_defaultStatus; + } + } // namespace WebCore #endif // DOMWindow_h diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index bf1d55d..5b1000a 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -54,7 +54,7 @@ module window { attribute [Replaceable] BarInfo toolbar; attribute [Replaceable] Navigator navigator; attribute [Replaceable] Navigator clientInformation; - attribute [DoNotCheckDomainSecurity, JSCCustom, V8CustomSetter, V8DisallowShadowing] Location location; + attribute [DoNotCheckDomainSecurity, JSCCustom, V8CustomSetter, V8DisallowShadowing, CPPCustom] Location location; attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; @@ -730,6 +730,10 @@ module window { #endif #endif +#if defined(ENABLE_DATABASE) + attribute SQLExceptionConstructor SQLException; +#endif + attribute [Conditional=TOUCH_EVENTS] TouchEventConstructor TouchEvent; attribute DOMFormDataConstructor FormData; @@ -737,6 +741,8 @@ module window { attribute [Conditional=FILE_READER|FILE_WRITER] FileErrorConstructor FileError; attribute [Conditional=FILE_READER] FileReaderConstructor FileReader; + attribute BlobBuilderConstructor BlobBuilder; + #endif // defined(LANGUAGE_JAVASCRIPT) #if defined(V8_BINDING) && V8_BINDING diff --git a/WebCore/page/EditorClient.h b/WebCore/page/EditorClient.h index cdf0bd8..69f48e7 100644 --- a/WebCore/page/EditorClient.h +++ b/WebCore/page/EditorClient.h @@ -34,11 +34,18 @@ #include <wtf/Vector.h> #if PLATFORM(MAC) +#ifdef __OBJC__ +@class NSArray; +@class NSData; +@class NSString; +@class NSURL; +#else class NSArray; class NSData; class NSString; class NSURL; #endif +#endif namespace WebCore { diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 5fde80e..c28b1a5 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -1014,6 +1014,9 @@ bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity g bool EventHandler::scrollRecursively(ScrollDirection direction, ScrollGranularity granularity, Node* startingNode) { + // The layout needs to be up to date to determine if we can scroll. We may be + // here because of an onLoad event, in which case the final layout hasn't been performed yet. + m_frame->document()->updateLayoutIgnorePendingStylesheets(); bool handled = scrollOverflow(direction, granularity, startingNode); if (!handled) { Frame* frame = m_frame; diff --git a/WebCore/page/EventSource.idl b/WebCore/page/EventSource.idl index be01098..9da7017 100644 --- a/WebCore/page/EventSource.idl +++ b/WebCore/page/EventSource.idl @@ -1,6 +1,6 @@ /* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. + * Copyright (C) 2009 Ericsson AB. All rights reserved. + * Copyright (C) 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,10 @@ module window { interface [ Conditional=EVENTSOURCE, - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + ConstructorParameters=1, + V8CustomConstructor, EventTarget, NoStaticTables ] EventSource { diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp index 804341d..e9f180b 100644 --- a/WebCore/page/FocusController.cpp +++ b/WebCore/page/FocusController.cpp @@ -319,7 +319,7 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa // if |node| element is not in the viewport. if (hasOffscreenRect(node)) { Frame* frame = node->document()->view()->frame(); - scrollInDirection(frame, direction); + scrollInDirection(frame, direction, focusCandidate); return true; } @@ -341,103 +341,152 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa return true; } -// FIXME: Make this method more modular, and simpler to understand and maintain. -static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate& candidate, FocusCandidate& closest) +static void updateFocusCandidateInSameContainer(const FocusCandidate& candidate, FocusCandidate& closest) { - bool sameDocument = candidate.document() == closest.document(); - if (sameDocument) { - if (closest.alignment > candidate.alignment - || (closest.parentAlignment && candidate.alignment > closest.parentAlignment)) - return; - } else if (closest.alignment > candidate.alignment - && (closest.parentAlignment && candidate.alignment > closest.parentAlignment)) + if (closest.isNull()) { + closest = candidate; return; + } - if (candidate.alignment != None - || (closest.parentAlignment >= candidate.alignment - && closest.document() == candidate.document())) { + if (candidate.alignment == closest.alignment) { + if (candidate.distance < closest.distance) + closest = candidate; + return; + } + + if (candidate.alignment > closest.alignment) + closest = candidate; +} - // If we are now in an higher precedent case, lets reset the current closest's - // distance so we force it to be bigger than any result we will get from - // spatialDistance(). - if (closest.alignment < candidate.alignment - && closest.parentAlignment < candidate.alignment) - closest.distance = maxDistance(); +static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate& candidate, FocusCandidate& closest) +{ + // First, check the common case: neither candidate nor closest are + // inside scrollable content, then no need to care about enclosingScrollableBox + // heuristics or parent{Distance,Alignment}, but only distance and alignment. + if (!candidate.inScrollableContainer() && !closest.inScrollableContainer()) { + updateFocusCandidateInSameContainer(candidate, closest); + return; } - // Bail out if candidate's distance is larger than that of the closest candidate. - if (candidate.distance >= closest.distance) + bool sameContainer = candidate.document() == closest.document() && candidate.enclosingScrollableBox == closest.enclosingScrollableBox; + + // Second, if candidate and closest are in the same "container" (i.e. {i}frame or any + // scrollable block element), we can handle them as common case. + if (sameContainer) { + updateFocusCandidateInSameContainer(candidate, closest); return; + } - if (closest.isNull()) { + // Last, we are considering moving to a candidate located in a different enclosing + // scrollable box than closest. + bool isInInnerDocument = !isInRootDocument(focusedNode); + + bool sameContainerAsCandidate = isInInnerDocument ? focusedNode->document() == candidate.document() : + focusedNode->isDescendantOf(candidate.enclosingScrollableBox); + + bool sameContainerAsClosest = isInInnerDocument ? focusedNode->document() == closest.document() : + focusedNode->isDescendantOf(closest.enclosingScrollableBox); + + // sameContainerAsCandidate and sameContainerAsClosest are mutually exclusive. + ASSERT(!(sameContainerAsCandidate && sameContainerAsClosest)); + + if (sameContainerAsCandidate) { closest = candidate; return; } - // If the focused node and the candadate are in the same document and current - // closest candidate is not in an {i}frame that is preferable to get focused ... - if (focusedNode->document() == candidate.document() - && candidate.distance < closest.parentDistance) - closest = candidate; - else if (focusedNode->document() != candidate.document()) { - // If the focusedNode is in an inner document and candidate is in a - // different document, we only consider to change focus if there is not - // another already good focusable candidate in the same document as focusedNode. - if (!((isInRootDocument(candidate.node) && !isInRootDocument(focusedNode)) - && focusedNode->document() == closest.document())) + if (sameContainerAsClosest) { + // Nothing to be done. + return; + } + + // NOTE: !sameContainerAsCandidate && !sameContainerAsClosest + // If distance is shorter, and we are talking about scrollable container, + // lets compare parent distance and alignment before anything. + if (candidate.distance < closest.distance) { + if (candidate.alignment >= closest.parentAlignment + || candidate.parentAlignment == closest.parentAlignment) { + closest = candidate; + return; + } + + } else if (candidate.parentDistance < closest.distance) { + if (candidate.parentAlignment >= closest.alignment) { closest = candidate; + return; + } } } void FocusController::findFocusableNodeInDirection(Node* outer, Node* focusedNode, FocusDirection direction, KeyboardEvent* event, - FocusCandidate& closestFocusCandidate, - const FocusCandidate& candidateParent) + FocusCandidate& closest, const FocusCandidate& candidateParent) { ASSERT(outer); ASSERT(candidateParent.isNull() || candidateParent.node->hasTagName(frameTag) - || candidateParent.node->hasTagName(iframeTag)); + || candidateParent.node->hasTagName(iframeTag) + || isScrollableContainerNode(candidateParent.node)); + + // Walk all the child nodes and update closest if we find a nearer node. + Node* node = outer; + while (node) { - // Walk all the child nodes and update closestFocusCandidate if we find a nearer node. - Node* candidate = outer; - while (candidate) { // Inner documents case. + if (node->isFrameOwnerElement()) { + deepFindFocusableNodeInDirection(node, focusedNode, direction, event, closest); + + // Scrollable block elements (e.g. <div>, etc) case. + } else if (isScrollableContainerNode(node)) { + deepFindFocusableNodeInDirection(node, focusedNode, direction, event, closest); + node = node->traverseNextSibling(); + continue; + + } else if (node != focusedNode && node->isKeyboardFocusable(event)) { + FocusCandidate candidate(node); + + // There are two ways to identify we are in a recursive call from deepFindFocusableNodeInDirection + // (i.e. processing an element in an iframe, frame or a scrollable block element): + + // 1) If candidateParent is not null, and it holds the distance and alignment data of the + // parent container element itself; + // 2) Parent of outer is <frame> or <iframe>; + // 3) Parent is any other scrollable block element. + if (!candidateParent.isNull()) { + candidate.parentAlignment = candidateParent.alignment; + candidate.parentDistance = candidateParent.distance; + candidate.enclosingScrollableBox = candidateParent.node; + + } else if (!isInRootDocument(outer)) { + if (Document* document = static_cast<Document*>(outer->parent())) + candidate.enclosingScrollableBox = static_cast<Node*>(document->ownerElement()); - if (candidate->isFrameOwnerElement()) - deepFindFocusableNodeInDirection(candidate, focusedNode, direction, event, closestFocusCandidate); - else if (candidate != focusedNode && candidate->isKeyboardFocusable(event)) { - FocusCandidate currentFocusCandidate(candidate); + } else if (isScrollableContainerNode(outer->parent())) + candidate.enclosingScrollableBox = outer->parent(); // Get distance and alignment from current candidate. - distanceDataForNode(direction, focusedNode, currentFocusCandidate); + distanceDataForNode(direction, focusedNode, candidate); // Bail out if distance is maximum. - if (currentFocusCandidate.distance == maxDistance()) { - candidate = candidate->traverseNextNode(outer->parent()); + if (candidate.distance == maxDistance()) { + node = node->traverseNextNode(outer->parent()); continue; } - // If candidateParent is not null, it means that we are in a recursive call - // from deepFineFocusableNodeInDirection (i.e. processing an element in an iframe), - // and holds the distance and alignment data of the iframe element itself. - if (!candidateParent.isNull()) { - currentFocusCandidate.parentAlignment = candidateParent.alignment; - currentFocusCandidate.parentDistance = candidateParent.distance; - } - - updateFocusCandidateIfCloser(focusedNode, currentFocusCandidate, closestFocusCandidate); + updateFocusCandidateIfCloser(focusedNode, candidate, closest); } - candidate = candidate->traverseNextNode(outer->parent()); + node = node->traverseNextNode(outer->parent()); } } void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* focusedNode, FocusDirection direction, KeyboardEvent* event, - FocusCandidate& closestFocusCandidate) + FocusCandidate& closest) { - ASSERT(container->hasTagName(frameTag) || container->hasTagName(iframeTag)); + ASSERT(container->hasTagName(frameTag) + || container->hasTagName(iframeTag) + || isScrollableContainerNode(container)); // Track if focusedNode is a descendant of the current container node being processed. bool descendantOfContainer = false; @@ -457,10 +506,15 @@ void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* fo descendantOfContainer = innerDocument == focusedNode->document(); firstChild = innerDocument->firstChild(); + // Scrollable block elements (e.g. <div>, etc) + } else if (isScrollableContainerNode(container)) { + + firstChild = container->firstChild(); + descendantOfContainer = focusedNode->isDescendantOf(container); } if (descendantOfContainer) { - findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate); + findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closest); return; } @@ -474,8 +528,8 @@ void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* fo return; // FIXME: Consider alignment? - if (candidateParent.distance < closestFocusCandidate.distance) - findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate, candidateParent); + if (candidateParent.distance < closest.distance) + findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closest, candidateParent); } static bool relinquishesEditingFocus(Node *node) @@ -540,20 +594,23 @@ bool FocusController::setFocusedNode(Node* node, PassRefPtr<Frame> newFocusedFra // FIXME: Might want to disable this check for caretBrowsing if (oldFocusedNode && oldFocusedNode->rootEditableElement() == oldFocusedNode && !relinquishesEditingFocus(oldFocusedNode)) return false; - + + // Set input method state before changing the focused node, so that the + // input method can still have a chance to finish the ongoing composition + // session. + m_page->editorClient()->setInputMethodState(node ? node->shouldUseInputMethod() : false); + clearSelectionIfNeeded(oldFocusedFrame.get(), newFocusedFrame.get(), node); - + if (!node) { if (oldDocument) oldDocument->setFocusedNode(0); - m_page->editorClient()->setInputMethodState(false); return true; } RefPtr<Document> newDocument = node->document(); if (newDocument && newDocument->focusedNode() == node) { - m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod()); return true; } @@ -565,8 +622,6 @@ bool FocusController::setFocusedNode(Node* node, PassRefPtr<Frame> newFocusedFra if (newDocument) newDocument->setFocusedNode(node); - m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod()); - return true; } diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index fb658d2..75a4598 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -135,7 +135,7 @@ static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement) return ownerElement->document()->frame(); } -Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient) +inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient) : m_page(page) , m_treeNode(this, parentFromOwnerElement(ownerElement)) , m_loader(this, frameLoaderClient) @@ -178,16 +178,17 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* XMLNames::init(); if (!ownerElement) { - page->setMainFrame(this); #if ENABLE(TILED_BACKING_STORE) // Top level frame only for now. setTiledBackingStoreEnabled(page->settings()->tiledBackingStoreEnabled()); #endif } else { page->incrementFrameCount(); + // Make sure we will not end up with two frames referencing the same owner element. - ASSERT((!(ownerElement->m_contentFrame)) || (ownerElement->m_contentFrame->ownerElement() != ownerElement)); - ownerElement->m_contentFrame = this; + Frame*& contentFrameSlot = ownerElement->m_contentFrame; + ASSERT(!contentFrameSlot || contentFrameSlot->ownerElement() != ownerElement); + contentFrameSlot = this; } #ifndef NDEBUG @@ -195,6 +196,14 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* #endif } +PassRefPtr<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client) +{ + RefPtr<Frame> frame = adoptRef(new Frame(page, ownerElement, client)); + if (!ownerElement) + page->setMainFrame(frame); + return frame.release(); +} + Frame::~Frame() { setView(0); @@ -624,22 +633,6 @@ void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, b child->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize); } -void Frame::setJSStatusBarText(const String& text) -{ - ASSERT(m_doc); // Client calls shouldn't be made when the frame is in inconsistent state. - m_kjsStatusBarText = text; - if (m_page) - m_page->chrome()->setStatusbarText(this, m_kjsStatusBarText); -} - -void Frame::setJSDefaultStatusBarText(const String& text) -{ - ASSERT(m_doc); // Client calls shouldn't be made when the frame is in inconsistent state. - m_kjsDefaultStatusBarText = text; - if (m_page) - m_page->chrome()->setStatusbarText(this, m_kjsDefaultStatusBarText); -} - void Frame::setNeedsReapplyStyles() { // When the frame is not showing web content, it doesn't make sense to apply styles. @@ -1436,6 +1429,7 @@ String Frame::documentTypeString() const return String(); } +<<<<<<< HEAD void Frame::focusWindow() { if (!page()) @@ -1474,6 +1468,8 @@ void Frame::scheduleClose() chrome->closeWindowSoon(); } +======= +>>>>>>> webkit.org at r61871 void Frame::respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping) { bool isContinuousSpellCheckingEnabled = editor()->isContinuousSpellCheckingEnabled(); diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h index cb7e977..c2d364f 100644 --- a/WebCore/page/Frame.h +++ b/WebCore/page/Frame.h @@ -76,10 +76,7 @@ namespace WebCore { #endif { public: - static PassRefPtr<Frame> create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client) - { - return adoptRef(new Frame(page, ownerElement, client)); - } + static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*); void setView(PassRefPtr<FrameView>); ~Frame(); @@ -189,19 +186,6 @@ namespace WebCore { private: void lifeSupportTimerFired(Timer<Frame>*); - // === to be moved into Chrome - - public: - void focusWindow(); - void unfocusWindow(); - bool shouldClose(); - void scheduleClose(); - - void setJSStatusBarText(const String&); - void setJSDefaultStatusBarText(const String&); - String jsStatusBarText() const; - String jsDefaultStatusBarText() const; - // === to be moved into Editor public: @@ -336,9 +320,6 @@ namespace WebCore { ScriptController m_script; - String m_kjsStatusBarText; - String m_kjsDefaultStatusBarText; - mutable VisibleSelection m_mark; mutable Editor m_editor; mutable SelectionController m_selectionController; @@ -424,16 +405,6 @@ namespace WebCore { m_mark = s; } - inline String Frame::jsStatusBarText() const - { - return m_kjsStatusBarText; - } - - inline String Frame::jsDefaultStatusBarText() const - { - return m_kjsDefaultStatusBarText; - } - inline bool Frame::needsReapplyStyles() const { return m_needsReapplyStyles; @@ -509,13 +480,6 @@ namespace WebCore { return &m_eventHandler; } - inline bool Frame::shouldClose() - { - // FIXME: Some WebKit clients call Frame::shouldClose() directly. - // We should transition them to calling FrameLoader::shouldClose() then get rid of this method. - return m_loader.shouldClose(); - } - } // namespace WebCore #endif // Frame_h diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index 6fe8d38..500a6dd 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -90,23 +90,25 @@ using namespace HTMLNames; double FrameView::sCurrentPaintTimeStamp = 0.0; +// REPAINT_THROTTLING now chooses default values for throttling parameters. +// Should be removed when applications start using runtime configuration. #if ENABLE(REPAINT_THROTTLING) // Normal delay -static const double deferredRepaintDelay = 0.025; +double FrameView::s_deferredRepaintDelay = 0.025; // Negative value would mean that first few repaints happen without a delay -static const double initialDeferredRepaintDelayDuringLoading = 0; +double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0; // The delay grows on each repaint to this maximum value -static const double maxDeferredRepaintDelayDuringLoading = 2.5; +double FrameView::s_maxDeferredRepaintDelayDuringLoading = 2.5; // On each repaint the delay increses by this amount -static const double deferredRepaintDelayIncrementDuringLoading = 0.5; +double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0.5; #else // FIXME: Repaint throttling could be good to have on all platform. // The balance between CPU use and repaint frequency will need some tuning for desktop. // More hooks may be needed to reset the delay on things like GIF and CSS animations. -static const double deferredRepaintDelay = 0; -static const double initialDeferredRepaintDelayDuringLoading = 0; -static const double maxDeferredRepaintDelayDuringLoading = 0; -static const double deferredRepaintDelayIncrementDuringLoading = 0; +double FrameView::s_deferredRepaintDelay = 0; +double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0; +double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0; +double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0; #endif // The maximum number of updateWidgets iterations that should be done before returning. @@ -222,7 +224,7 @@ void FrameView::reset() m_deferringRepaints = 0; m_repaintCount = 0; m_repaintRects.clear(); - m_deferredRepaintDelay = initialDeferredRepaintDelayDuringLoading; + m_deferredRepaintDelay = s_initialDeferredRepaintDelayDuringLoading; m_deferredRepaintTimer.stop(); m_lastPaintTime = 0; m_paintBehavior = PaintBehaviorNormal; @@ -930,6 +932,8 @@ void FrameView::removeSlowRepaintObject() void FrameView::addFixedObject() { + if (!m_fixedObjectCount && platformWidget()) + setCanBlitOnScroll(false); ++m_fixedObjectCount; } @@ -937,6 +941,64 @@ void FrameView::removeFixedObject() { ASSERT(m_fixedObjectCount > 0); --m_fixedObjectCount; + if (!m_fixedObjectCount) + setCanBlitOnScroll(!useSlowRepaints()); +} + +bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) +{ + const size_t fixedObjectThreshold = 5; + + RenderBlock::PositionedObjectsListHashSet* positionedObjects = 0; + if (RenderView* root = m_frame->contentRenderer()) + positionedObjects = root->positionedObjects(); + + if (!positionedObjects || positionedObjects->isEmpty()) { + hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); + return true; + } + + // Get the rects of the fixed objects visible in the rectToScroll + Vector<IntRect, fixedObjectThreshold> subRectToUpdate; + bool updateInvalidatedSubRect = true; + RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end(); + for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) { + RenderBox* renderBox = *it; + if (renderBox->style()->position() != FixedPosition) + continue; + IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants(); + updateRect = contentsToWindow(updateRect); + + updateRect.intersect(rectToScroll); + if (!updateRect.isEmpty()) { + if (subRectToUpdate.size() >= fixedObjectThreshold) { + updateInvalidatedSubRect = false; + break; + } + subRectToUpdate.append(updateRect); + } + } + + // Scroll the view + if (updateInvalidatedSubRect) { + // 1) scroll + hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); + + // 2) update the area of fixed objects that has been invalidated + size_t fixObjectsCount = subRectToUpdate.size(); + for (size_t i = 0; i < fixObjectsCount; ++i) { + IntRect updateRect = subRectToUpdate[i]; + IntRect scrolledRect = updateRect; + scrolledRect.move(scrollDelta); + updateRect.unite(scrolledRect); + updateRect.intersect(rectToScroll); + hostWindow()->invalidateContentsAndWindow(updateRect, false); + } + return true; + } + + // the number of fixed objects exceed the threshold, we cannot use the fast path + return false; } void FrameView::setIsOverlapped(bool isOverlapped) @@ -1240,13 +1302,13 @@ void FrameView::updateDeferredRepaintDelay() { Document* document = m_frame->document(); if (!document || (!document->parsing() && !document->docLoader()->requestCount())) { - m_deferredRepaintDelay = deferredRepaintDelay; + m_deferredRepaintDelay = s_deferredRepaintDelay; return; } - if (m_deferredRepaintDelay < maxDeferredRepaintDelayDuringLoading) { - m_deferredRepaintDelay += deferredRepaintDelayIncrementDuringLoading; - if (m_deferredRepaintDelay > maxDeferredRepaintDelayDuringLoading) - m_deferredRepaintDelay = maxDeferredRepaintDelayDuringLoading; + if (m_deferredRepaintDelay < s_maxDeferredRepaintDelayDuringLoading) { + m_deferredRepaintDelay += s_deferredRepaintDelayIncrementDuringLoading; + if (m_deferredRepaintDelay > s_maxDeferredRepaintDelayDuringLoading) + m_deferredRepaintDelay = s_maxDeferredRepaintDelayDuringLoading; } } @@ -2251,4 +2313,29 @@ void FrameView::setZoomFactor(float percent, ZoomMode mode) layout(); } + +// Normal delay +void FrameView::setRepaintThrottlingDeferredRepaintDelay(double p) +{ + s_deferredRepaintDelay = p; +} + +// Negative value would mean that first few repaints happen without a delay +void FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p) +{ + s_initialDeferredRepaintDelayDuringLoading = p; +} + +// The delay grows on each repaint to this maximum value +void FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p) +{ + s_maxDeferredRepaintDelayDuringLoading = p; +} + +// On each repaint the delay increases by this amount +void FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p) +{ + s_deferredRepaintDelayIncrementDuringLoading = p; +} + } // namespace WebCore diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index 69cc67a..b047db0 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -46,7 +46,7 @@ class RenderLayer; class RenderObject; class RenderEmbeddedObject; class RenderScrollbarPart; -class ScheduledEvent; +struct ScheduledEvent; class String; template <typename T> class Timer; @@ -222,6 +222,18 @@ public: float pageZoomFactor() const { return shouldApplyPageZoom() ? m_zoomFactor : 1.0f; } float textZoomFactor() const { return shouldApplyTextZoom() ? m_zoomFactor : 1.0f; } + // Normal delay + static void setRepaintThrottlingDeferredRepaintDelay(double p); + // Negative value would mean that first few repaints happen without a delay + static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p); + // The delay grows on each repaint to this maximum value + static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p); + // On each repaint the delay increses by this amount + static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p); + +protected: + virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); + private: FrameView(Frame*); @@ -354,6 +366,11 @@ private: RenderScrollbarPart* m_scrollCorner; float m_zoomFactor; + + static double s_deferredRepaintDelay; + static double s_initialDeferredRepaintDelayDuringLoading; + static double s_maxDeferredRepaintDelayDuringLoading; + static double s_deferredRepaintDelayIncrementDuringLoading; }; #if ENABLE(INSPECTOR) diff --git a/WebCore/page/OriginAccessEntry.h b/WebCore/page/OriginAccessEntry.h index 7c8d556..67e39fe 100644 --- a/WebCore/page/OriginAccessEntry.h +++ b/WebCore/page/OriginAccessEntry.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CrossOriginAccess_h -#define CrossOriginAccess_h +#ifndef OriginAccessEntry_h +#define OriginAccessEntry_h #include "PlatformString.h" @@ -71,4 +71,4 @@ inline bool operator!=(const OriginAccessEntry& a, const OriginAccessEntry& b) } // namespace WebCore -#endif // CrossOriginAccess_h +#endif // OriginAccessEntry_h diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index 446f9f0..d5074aa 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -404,7 +404,7 @@ void Page::refreshPlugins(bool reload) continue; for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->loader()->containsPlugins()) + if (frame->loader()->subframeLoader()->containsPlugins()) framesNeedingReload.append(frame); } } @@ -415,7 +415,7 @@ void Page::refreshPlugins(bool reload) PluginData* Page::pluginData() const { - if (!mainFrame()->loader()->allowPlugins(NotAboutToInstantiatePlugin)) + if (!mainFrame()->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) return 0; if (!m_pluginData) m_pluginData = PluginData::create(this); diff --git a/WebCore/page/PageGroupLoadDeferrer.cpp b/WebCore/page/PageGroupLoadDeferrer.cpp index 122658b..ced8f36 100644 --- a/WebCore/page/PageGroupLoadDeferrer.cpp +++ b/WebCore/page/PageGroupLoadDeferrer.cpp @@ -43,8 +43,10 @@ PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf) // This code is not logically part of load deferring, but we do not want JS code executed beneath modal // windows or sheets, which is exactly when PageGroupLoadDeferrer is used. - for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) + for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) { frame->document()->suspendActiveDOMObjects(); + frame->document()->suspendExecuteScriptSoonTimer(); + } } } @@ -60,8 +62,10 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer() if (Page* page = m_deferredFrames[i]->page()) { page->setDefersLoading(false); - for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { frame->document()->resumeActiveDOMObjects(); + frame->document()->resumeExecuteScriptSoonTimer(); + } } } } diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index bc4b31a..4ab7367 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -199,6 +199,42 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi return -1; } +String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pageNumber) +{ + Document* document = frame->document(); + document->updateLayout(); + RefPtr<RenderStyle> style = document->styleForPage(pageNumber); + + // Implement formatters for properties we care about. + if (!strcmp(propertyName, "margin-left")) + return String::format("%d", style->marginLeft().rawValue()); + if (!strcmp(propertyName, "line-height")) + return String::format("%d", style->lineHeight().rawValue()); + if (!strcmp(propertyName, "font-size")) + return String::format("%d", style->fontDescription().computedPixelSize()); + if (!strcmp(propertyName, "font-family")) + return String::format("%s", style->fontDescription().family().family().string().utf8().data()); + + return String::format("pageProperty() unimplemented for: %s", propertyName); +} + +bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber) +{ + return frame->document()->isPageBoxVisible(pageNumber); +} + +String PrintContext::pageAreaRectInPixels(Frame* frame, int pageNumber) +{ + IntRect pageArea = frame->document()->pageAreaRectInPixels(pageNumber); + return String::format("(%d,%d,%d,%d)", pageArea.x(), pageArea.y(), pageArea.width(), pageArea.height()); +} + +String PrintContext::preferredPageSizeInPixels(Frame* frame, int pageNumber) +{ + IntSize pageSize = frame->document()->preferredPageSizeInPixels(pageNumber); + return String::format("(%d,%d)", pageSize.width(), pageSize.height()); +} + int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) { frame->document()->updateLayout(); diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h index 1891144..81a9b76 100644 --- a/WebCore/page/PrintContext.h +++ b/WebCore/page/PrintContext.h @@ -31,6 +31,7 @@ class FloatRect; class FloatSize; class GraphicsContext; class IntRect; +class String; class PrintContext { public: @@ -54,6 +55,10 @@ public: // Used by layout tests. static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); + static String pageProperty(Frame* frame, const char* propertyName, int pageNumber); + static bool isPageBoxVisible(Frame* frame, int pageNumber); + static String pageAreaRectInPixels(Frame* frame, int pageNumber); + static String preferredPageSizeInPixels(Frame* frame, int pageNumber); static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels); protected: diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index b20f2e5..503b938 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -144,7 +144,7 @@ Settings::Settings(Page* page) , m_webGLEnabled(false) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) - , m_html5ParserEnabled(false) + , m_html5ParserEnabled(true) , m_paginateDuringLayoutEnabled(false) #ifdef ANDROID_PLUGINS , m_pluginsOnDemand(false) diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp index 0239c39..58b70e4 100644 --- a/WebCore/page/SpatialNavigation.cpp +++ b/WebCore/page/SpatialNavigation.cpp @@ -125,8 +125,11 @@ static IntRect renderRectRelativeToRootDocument(RenderObject* render) // Handle nested frames. for (Frame* frame = render->document()->frame(); frame; frame = frame->tree()->parent()) { - if (HTMLFrameOwnerElement* ownerElement = frame->ownerElement()) - rect.move(ownerElement->offsetLeft(), ownerElement->offsetTop()); + if (Element* element = static_cast<Element*>(frame->ownerElement())) { + do { + rect.move(element->offsetLeft(), element->offsetTop()); + } while ((element = element->offsetParent())); + } } return rect; @@ -445,7 +448,7 @@ bool hasOffscreenRect(Node* node) // In a bottom-up way, this method tries to scroll |frame| in a given direction // |direction|, going up in the frame tree hierarchy in case it does not succeed. -bool scrollInDirection(Frame* frame, FocusDirection direction) +bool scrollInDirection(Frame* frame, FocusDirection direction, const FocusCandidate& candidate) { if (!frame) return false; @@ -469,6 +472,9 @@ bool scrollInDirection(Frame* frame, FocusDirection direction) return false; } + if (!candidate.isNull() && isScrollableContainerNode(candidate.enclosingScrollableBox)) + return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine, candidate.enclosingScrollableBox); + return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine); } @@ -527,4 +533,17 @@ static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect) return canBeScrolled; } +bool isScrollableContainerNode(Node* node) +{ + if (!node) + return false; + + if (RenderObject* renderer = node->renderer()) { + return (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea() + && node->hasChildNodes() && !node->isDocumentNode()); + } + + return false; +} + } // namespace WebCore diff --git a/WebCore/page/SpatialNavigation.h b/WebCore/page/SpatialNavigation.h index d38fb09..78419a7 100644 --- a/WebCore/page/SpatialNavigation.h +++ b/WebCore/page/SpatialNavigation.h @@ -97,6 +97,7 @@ enum RectsAlignment { struct FocusCandidate { FocusCandidate() : node(0) + , enclosingScrollableBox(0) , distance(maxDistance()) , parentDistance(maxDistance()) , alignment(None) @@ -106,6 +107,7 @@ struct FocusCandidate { FocusCandidate(Node* n) : node(n) + , enclosingScrollableBox(0) , distance(maxDistance()) , parentDistance(maxDistance()) , alignment(None) @@ -114,9 +116,11 @@ struct FocusCandidate { } bool isNull() const { return !node; } + bool inScrollableContainer() const { return node && enclosingScrollableBox; } Document* document() const { return node ? node->document() : 0; } Node* node; + Node* enclosingScrollableBox; long long distance; long long parentDistance; RectsAlignment alignment; @@ -124,10 +128,11 @@ struct FocusCandidate { }; void distanceDataForNode(FocusDirection direction, Node* start, FocusCandidate& candidate); -bool scrollInDirection(Frame*, FocusDirection); +bool scrollInDirection(Frame*, FocusDirection, const FocusCandidate& candidate = FocusCandidate()); void scrollIntoView(Element*); bool hasOffscreenRect(Node*); bool isInRootDocument(Node*); +bool isScrollableContainerNode(Node*); } // namspace WebCore diff --git a/WebCore/page/WebKitPoint.idl b/WebCore/page/WebKitPoint.idl index fd617b2..4e6021f 100644 --- a/WebCore/page/WebKitPoint.idl +++ b/WebCore/page/WebKitPoint.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,7 +25,12 @@ module window { - interface [CustomConstructor] WebKitPoint { + interface [ + CanBeConstructed, + CustomConstructFunction, + ConstructorParameters=2, + V8CustomConstructor + ] WebKitPoint { attribute float x; attribute float y; }; diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp index b5aba79..33a0951 100644 --- a/WebCore/page/XSSAuditor.cpp +++ b/WebCore/page/XSSAuditor.cpp @@ -35,7 +35,7 @@ #include "DOMWindow.h" #include "Frame.h" #include "KURL.h" -#include "PreloadScanner.h" +#include "LegacyPreloadScanner.h" #include "ResourceResponseBase.h" #include "ScriptSourceCode.h" #include "Settings.h" @@ -277,7 +277,7 @@ String XSSAuditor::decodeHTMLEntities(const String& string, bool leaveUndecodabl if (leaveUndecodableEntitiesUntouched) sourceShadow = source; bool notEnoughCharacters = false; - unsigned entity = PreloadScanner::consumeEntity(source, notEnoughCharacters); + unsigned entity = LegacyPreloadScanner::consumeEntity(source, notEnoughCharacters); // We ignore notEnoughCharacters because we might as well use this loop // to copy the remaining characters into |result|. diff --git a/WebCore/page/XSSAuditor.h b/WebCore/page/XSSAuditor.h index 7afbf07..20e0a53 100644 --- a/WebCore/page/XSSAuditor.h +++ b/WebCore/page/XSSAuditor.h @@ -66,8 +66,8 @@ namespace WebCore { // * ScriptController::executeIfJavaScriptURL - used to evaluate JavaScript URLs. // * ScriptEventListener::createAttributeEventListener - used to create JavaScript event handlers. // * HTMLBaseElement::process - used to set the document base URL. - // * HTMLDocumentParser::parseTag - used to load external JavaScript scripts. - // * FrameLoader::requestObject - used to load <object>/<embed> elements. + // * LegacyHTMLDocumentParser::parseTag - used to load external JavaScript scripts. + // * SubframeLoader::requestObject - used to load <object>/<embed> elements. // class XSSAuditor : public Noncopyable { public: @@ -95,7 +95,7 @@ namespace WebCore { // Determines whether object should be loaded based on the content of // any user-submitted data. // - // This method is called by FrameLoader::requestObject. + // This method is called by SubframeLoader::requestObject. bool canLoadObject(const String& url) const; // Determines whether the base URL should be changed based on the content diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp index aa6a4c1..7195d1f 100644 --- a/WebCore/page/animation/AnimationBase.cpp +++ b/WebCore/page/animation/AnimationBase.cpp @@ -191,6 +191,22 @@ static inline EVisibility blendFunc(const AnimationBase* anim, EVisibility from, return result > 0. ? VISIBLE : (to != VISIBLE ? to : from); } +static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& from, const LengthBox& to, double progress) +{ + // Length types have to match to animate + if (from.top().type() != to.top().type() + || from.right().type() != to.right().type() + || from.bottom().type() != to.bottom().type() + || from.left().type() != to.left().type()) + return to; + + LengthBox result(blendFunc(anim, from.top(), to.top(), progress), + blendFunc(anim, from.right(), to.right(), progress), + blendFunc(anim, from.bottom(), to.bottom(), progress), + blendFunc(anim, from.left(), to.left(), progress)); + return result; +} + class PropertyWrapperBase; static void addShorthandProperties(); @@ -634,6 +650,8 @@ void AnimationBase::ensurePropertyMap() gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius)); gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility)); gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoom)); + + gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip)); #if USE(ACCELERATED_COMPOSITING) gPropertyWrappers->append(new PropertyWrapperAcceleratedOpacity()); @@ -652,7 +670,6 @@ void AnimationBase::ensurePropertyMap() gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyBorderBottomColor, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor)); gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyOutlineColor, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor)); - // These are for shadows gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow)); gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, &RenderStyle::textShadow, &RenderStyle::setTextShadow)); diff --git a/WebCore/page/animation/AnimationBase.h b/WebCore/page/animation/AnimationBase.h index ac55a2b..91ef8cf 100644 --- a/WebCore/page/animation/AnimationBase.h +++ b/WebCore/page/animation/AnimationBase.h @@ -42,7 +42,7 @@ class Element; class Node; class RenderObject; class RenderStyle; -class TimingFunction; +struct TimingFunction; class AnimationBase : public RefCounted<AnimationBase> { friend class CompositeAnimation; diff --git a/WebCore/bindings/js/JSSharedWorkerConstructor.h b/WebCore/page/brew/ChromeClientBrew.h index 87baa38..d1fac2d 100644 --- a/WebCore/bindings/js/JSSharedWorkerConstructor.h +++ b/WebCore/page/brew/ChromeClientBrew.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (c) 2010, Company 100, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,29 +28,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSSharedWorkerConstructor_h -#define JSSharedWorkerConstructor_h +#ifndef ChromeClientBrew_h +#define ChromeClientBrew_h -#if ENABLE(SHARED_WORKERS) - -#include "JSDOMBinding.h" +#include "ChromeClient.h" +#include <wtf/Forward.h> namespace WebCore { +class IntRect; +class PopupMenuClient; - class JSSharedWorkerConstructor : public DOMConstructorObject { - public: - JSSharedWorkerConstructor(JSC::ExecState*, JSDOMGlobalObject*); - - static const JSC::ClassInfo s_info; - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - }; +// Contains Brew-specific extensions to the ChromeClient. Only put +// things here that don't make sense for other ports. +class ChromeClientBrew : public ChromeClient { +public: + virtual void createSelectPopup(PopupMenuClient*, int selected, const IntRect& rect) = 0; + virtual bool destroySelectPopup() = 0; +}; } // namespace WebCore -#endif // ENABLE(SHARED_WORKERS) - -#endif // JSSharedWorkerConstructor_h +#endif diff --git a/WebCore/page/mac/WebCoreViewFactory.h b/WebCore/page/mac/WebCoreViewFactory.h index db70b6d..2ca0d17 100644 --- a/WebCore/page/mac/WebCoreViewFactory.h +++ b/WebCore/page/mac/WebCoreViewFactory.h @@ -28,9 +28,6 @@ @protocol WebCoreViewFactory -- (NSArray *)pluginsInfo; // array of id <WebCorePluginInfo> -- (void)refreshPlugins; - - (NSString *)inputElementAltText; - (NSString *)resetButtonDefaultLabel; - (NSString *)searchableIndexIntroduction; @@ -171,13 +168,3 @@ @interface WebCoreViewFactory (SubclassResponsibility) <WebCoreViewFactory> @end - -@protocol WebCorePluginInfo <NSObject> -- (NSString *)name; -- (NSString *)filename; -- (NSString *)pluginDescription; -- (NSEnumerator *)MIMETypeEnumerator; -- (NSString *)descriptionForMIMEType:(NSString *)MIMEType; -- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType; -@end - diff --git a/WebCore/page/win/FrameWin.h b/WebCore/page/win/FrameWin.h index 4c274b7..cbfe33d 100644 --- a/WebCore/page/win/FrameWin.h +++ b/WebCore/page/win/FrameWin.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FrameWin_H -#define FrameWin_H +#ifndef FrameWin_h +#define FrameWin_h #include <wtf/Vector.h> diff --git a/WebCore/platform/BlobItem.cpp b/WebCore/platform/BlobItem.cpp index 949e7f8..f98e466 100644 --- a/WebCore/platform/BlobItem.cpp +++ b/WebCore/platform/BlobItem.cpp @@ -90,9 +90,12 @@ unsigned long long FileBlobItem::size() const PassRefPtr<BlobItem> FileBlobItem::slice(long long start, long long length) { ASSERT(start >= 0 && length >= 0); - ASSERT(static_cast<unsigned long long>(start) < size()); - if (!start && size() <= static_cast<unsigned long long>(length)) + long long fileSize = size(); + ASSERT(start < fileSize); + if (!start && fileSize <= length) return this; + if (start + length > fileSize) + length = fileSize - start; const FileRangeBlobItem* fileRangeItem = toFileRangeBlobItem(); double modificationTime = fileRangeItem ? fileRangeItem->snapshotModificationTime() : getFileSnapshotModificationTime(path()); return FileRangeBlobItem::create(path(), start, length, modificationTime); @@ -129,6 +132,14 @@ CString StringBlobItem::convertToCString(const String& text, LineEnding ending, if (ending == EndingTransparent) return result; + if (ending == EndingNative) { +#if OS(WINDOWS) + ending = EndingCRLF; +#else + ending = EndingLF; +#endif + } + const char* endingChars = (ending == EndingCRLF) ? "\r\n" : ((ending == EndingCR) ? "\r" : "\n"); int endingLength = (ending == EndingCRLF) ? 2 : 1; @@ -141,6 +152,7 @@ CString StringBlobItem::convertToCString(const String& text, LineEnding ending, if (c == '\r') { // Safe to look ahead because of trailing '\0'. if (*p == '\n' && ending != EndingCRLF) { + p++; calculatedLength += (endingLength - 2); ++needFix; } else if (ending != EndingCR) { @@ -163,6 +175,7 @@ CString StringBlobItem::convertToCString(const String& text, LineEnding ending, while (char c = *p++) { if (c == '\r') { if (*p == '\n' && ending != EndingCRLF) { + p++; memcpy(q, endingChars, endingLength); q += endingLength; } else if (*p != '\n' && ending != EndingCR) { @@ -204,7 +217,7 @@ PassRefPtr<BlobItem> DataRangeBlobItem::create(PassRefPtr<DataBlobItem> item, lo DataRangeBlobItem::DataRangeBlobItem(PassRefPtr<DataBlobItem> item, long long start, long long length) : m_length(length) { - const DataRangeBlobItem* rangeItem = m_item->toDataRangeBlobItem(); + const DataRangeBlobItem* rangeItem = item->toDataRangeBlobItem(); if (rangeItem) { m_item = rangeItem->m_item; m_start = start + rangeItem->m_start; diff --git a/WebCore/platform/BlobItem.h b/WebCore/platform/BlobItem.h index f2ee56b..1d34c59 100644 --- a/WebCore/platform/BlobItem.h +++ b/WebCore/platform/BlobItem.h @@ -44,6 +44,7 @@ namespace WebCore { // String ending types. enum LineEnding { EndingTransparent = 0, + EndingNative, EndingLF, EndingCR, EndingCRLF, diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h index f270c31..42aaaef 100644 --- a/WebCore/platform/FileSystem.h +++ b/WebCore/platform/FileSystem.h @@ -59,6 +59,10 @@ typedef struct HINSTANCE__* HINSTANCE; typedef HINSTANCE HMODULE; #endif +#if PLATFORM(BREWMP) +typedef struct _IFile IFile; +#endif + namespace WTF { class CString; } @@ -117,6 +121,11 @@ typedef HANDLE PlatformFileHandle; // FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to // avoid using Windows headers in headers. We'd rather move this into the .cpp. const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1); +#elif PLATFORM(BREWMP) +typedef IFile* PlatformFileHandle; +const PlatformFileHandle invalidPlatformFileHandle = 0; +typedef void* PlatformModule; +typedef unsigned PlatformModuleVersion; #else typedef int PlatformFileHandle; const PlatformFileHandle invalidPlatformFileHandle = -1; diff --git a/WebCore/platform/LengthBox.h b/WebCore/platform/LengthBox.h index 7d7698d..cf56389 100644 --- a/WebCore/platform/LengthBox.h +++ b/WebCore/platform/LengthBox.h @@ -45,6 +45,14 @@ struct LengthBox { , m_bottom(Length(v, Fixed)) { } + + LengthBox(Length t, Length r, Length b, Length l) + : m_left(l) + , m_right(r) + , m_top(t) + , m_bottom(b) + { + } LengthBox(int t, int r, int b, int l) : m_left(Length(l, Fixed)) diff --git a/WebCore/platform/MIMETypeRegistry.cpp b/WebCore/platform/MIMETypeRegistry.cpp index 2f3bf92..d6ff588 100644 --- a/WebCore/platform/MIMETypeRegistry.cpp +++ b/WebCore/platform/MIMETypeRegistry.cpp @@ -54,8 +54,9 @@ static HashSet<String>* supportedImageMIMETypesForEncoding; static HashSet<String>* supportedJavaScriptMIMETypes; static HashSet<String>* supportedNonImageMIMETypes; static HashSet<String>* supportedMediaMIMETypes; -static HashMap<String, String, CaseFoldingHash>* mediaMIMETypeForExtensionMap; +typedef HashMap<String, Vector<String>*, CaseFoldingHash> MediaMIMETypeMap; + static void initializeSupportedImageMIMETypes() { #if PLATFORM(CG) @@ -249,7 +250,7 @@ static void initializeSupportedNonImageMimeTypes() #endif } -static void initializeMediaTypeMaps() +static MediaMIMETypeMap& mediaMIMETypeMap() { struct TypeExtensionPair { const char* type; @@ -257,11 +258,7 @@ static void initializeMediaTypeMaps() }; // A table of common media MIME types and file extenstions used when a platform's - // specific MIME type lookup doens't have a match for a media file extension. While some - // file extensions are claimed by multiple MIME types, this table only includes one - // for each because it is currently only used by getMediaMIMETypeForExtension. If we - // ever add a MIME type -> file extension mapping, the alternate MIME types will need - // to be added. + // specific MIME type lookup doesn't have a match for a media file extension. static const TypeExtensionPair pairs[] = { // Ogg @@ -292,8 +289,13 @@ static void initializeMediaTypeMaps() { "video/mpeg", "mpv" }, // MPEG playlist - { "audio/x-mpegurl", "m3url" }, + { "application/vnd.apple.mpegurl", "m3u8" }, + { "application/mpegurl", "m3u8" }, { "application/x-mpegurl", "m3u8" }, + { "audio/mpegurl", "m3url" }, + { "audio/x-mpegurl", "m3url" }, + { "audio/mpegurl", "m3u" }, + { "audio/x-mpegurl", "m3u" }, // MPEG-4 { "video/x-m4v", "m4v" }, @@ -303,6 +305,8 @@ static void initializeMediaTypeMaps() // MP3 { "audio/mp3", "mp3" }, + { "audio/x-mp3", "mp3" }, + { "audio/x-mpeg", "mp3" }, // MPEG-2 { "video/x-mpeg2", "mp2" }, @@ -327,23 +331,46 @@ static void initializeMediaTypeMaps() { "audio/x-gsm", "gsm" } }; - mediaMIMETypeForExtensionMap = new HashMap<String, String, CaseFoldingHash>; + DEFINE_STATIC_LOCAL(MediaMIMETypeMap, mediaMIMETypeForExtensionMap, ()); + + if (!mediaMIMETypeForExtensionMap.isEmpty()) + return mediaMIMETypeForExtensionMap; + const unsigned numPairs = sizeof(pairs) / sizeof(pairs[0]); - for (unsigned ndx = 0; ndx < numPairs; ++ndx) - mediaMIMETypeForExtensionMap->set(pairs[ndx].extension, pairs[ndx].type); + for (unsigned ndx = 0; ndx < numPairs; ++ndx) { + + if (mediaMIMETypeForExtensionMap.contains(pairs[ndx].extension)) + mediaMIMETypeForExtensionMap.get(pairs[ndx].extension)->append(pairs[ndx].type); + else { + Vector<String>* synonyms = new Vector<String>; + + // If there is a system specific type for this extension, add it as the first type so + // getMediaMIMETypeForExtension will always return it. + String systemType = MIMETypeRegistry::getMIMETypeForExtension(pairs[ndx].type); + if (!systemType.isEmpty() && pairs[ndx].type != systemType) + synonyms->append(systemType); + synonyms->append(pairs[ndx].type); + mediaMIMETypeForExtensionMap.add(pairs[ndx].extension, synonyms); + } + } + + return mediaMIMETypeForExtensionMap; } String MIMETypeRegistry::getMediaMIMETypeForExtension(const String& ext) { - // Check with system specific implementation first. - String mimeType = getMIMETypeForExtension(ext); - if (!mimeType.isEmpty()) - return mimeType; - - // No match, look in the static mapping. - if (!mediaMIMETypeForExtensionMap) - initializeMediaTypeMaps(); - return mediaMIMETypeForExtensionMap->get(ext); + if (mediaMIMETypeMap().contains(ext)) + return (*mediaMIMETypeMap().get(ext))[0]; + + return String(); +} + +Vector<String> MIMETypeRegistry::getMediaMIMETypesForExtension(const String& ext) +{ + if (mediaMIMETypeMap().contains(ext)) + return *mediaMIMETypeMap().get(ext); + + return Vector<String>(); } static void initializeSupportedMediaMIMETypes() diff --git a/WebCore/platform/MIMETypeRegistry.h b/WebCore/platform/MIMETypeRegistry.h index 27c2c3a..f71b478 100644 --- a/WebCore/platform/MIMETypeRegistry.h +++ b/WebCore/platform/MIMETypeRegistry.h @@ -35,10 +35,11 @@ namespace WebCore { class MIMETypeRegistry { public: - static String getMIMETypeForExtension(const String& ext); + static String getMIMETypeForExtension(const String& extension); static Vector<String> getExtensionsForMIMEType(const String& type); static String getPreferredExtensionForMIMEType(const String& type); - static String getMediaMIMETypeForExtension(const String& ext); + static String getMediaMIMETypeForExtension(const String& extension); + static Vector<String> getMediaMIMETypesForExtension(const String& extension); static String getMIMETypeForPath(const String& path); diff --git a/WebCore/platform/Pasteboard.h b/WebCore/platform/Pasteboard.h index c3476a9..7ee8e81 100644 --- a/WebCore/platform/Pasteboard.h +++ b/WebCore/platform/Pasteboard.h @@ -43,10 +43,16 @@ // knowledge of the frame and editor or moved into the editing directory. #if PLATFORM(MAC) +#ifdef __OBJC__ +@class NSFileWrapper; +@class NSPasteboard; +@class NSArray; +#else class NSFileWrapper; class NSPasteboard; class NSArray; #endif +#endif #if PLATFORM(WIN) #include <windows.h> diff --git a/WebCore/platform/PlatformKeyboardEvent.h b/WebCore/platform/PlatformKeyboardEvent.h index ddb1680..824587e 100644 --- a/WebCore/platform/PlatformKeyboardEvent.h +++ b/WebCore/platform/PlatformKeyboardEvent.h @@ -63,7 +63,8 @@ class BMessage; #endif #if PLATFORM(EFL) -#include <Evas.h> +typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down; +typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; #endif #if PLATFORM(BREWMP) diff --git a/WebCore/platform/PlatformMouseEvent.h b/WebCore/platform/PlatformMouseEvent.h index be25973..725945a 100644 --- a/WebCore/platform/PlatformMouseEvent.h +++ b/WebCore/platform/PlatformMouseEvent.h @@ -34,7 +34,9 @@ typedef struct _GdkEventMotion GdkEventMotion; #endif #if PLATFORM(EFL) -#include <Evas.h> +typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down; +typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up; +typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move; #endif #if PLATFORM(QT) @@ -126,7 +128,7 @@ namespace WebCore { #endif #if PLATFORM(EFL) - void setClickCount(Evas_Button_Flags); + void setClickCount(unsigned int); PlatformMouseEvent(const Evas_Event_Mouse_Down*, IntPoint); PlatformMouseEvent(const Evas_Event_Mouse_Up*, IntPoint); PlatformMouseEvent(const Evas_Event_Mouse_Move*, IntPoint); diff --git a/WebCore/platform/PlatformStrategies.cpp b/WebCore/platform/PlatformStrategies.cpp new file mode 100644 index 0000000..e0baa70 --- /dev/null +++ b/WebCore/platform/PlatformStrategies.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if USE(PLATFORM_STRATEGIES) + +#include "PlatformStrategies.h" + +namespace WebCore { + +static PlatformStrategies* s_platformStrategies; + +PlatformStrategies* platformStrategies() +{ + ASSERT(s_platformStrategies); + + return s_platformStrategies; +} + +void setPlatformStrategies(PlatformStrategies* platformStrategies) +{ + if (!s_platformStrategies) { + s_platformStrategies = platformStrategies; + return; + } + + // FIXME: This happens when mixing different platform strategies, and we should probably + // throw an exception here in release builds. + ASSERT(platformStrategies != s_platformStrategies); +} + +} // namespace WebCore + +#endif // USE(PLATFORM_STRATEGIES) diff --git a/WebCore/platform/PlatformStrategies.h b/WebCore/platform/PlatformStrategies.h new file mode 100644 index 0000000..22da3ac --- /dev/null +++ b/WebCore/platform/PlatformStrategies.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PlatformStrategies_h +#define PlatformStrategies_h + +#if USE(PLATFORM_STRATEGIES) + +namespace WebCore { + +class PluginStrategy; + +class PlatformStrategies { +public: + PluginStrategy* pluginStrategy() + { + if (!m_pluginStrategy) + m_pluginStrategy = createPluginStrategy(); + + return m_pluginStrategy; + } + +protected: + PlatformStrategies() + : m_pluginStrategy(0) + { + } + virtual ~PlatformStrategies() { } + +private: + virtual PluginStrategy* createPluginStrategy() = 0; + + PluginStrategy* m_pluginStrategy; +}; + +PlatformStrategies* platformStrategies(); +void setPlatformStrategies(PlatformStrategies*); + +} // namespace WebCore + +#endif // USE(PLATFORM_STRATEGIES) + +#endif // PlatformStrategies_h diff --git a/WebCore/platform/PlatformWheelEvent.h b/WebCore/platform/PlatformWheelEvent.h index 6651334..6747392 100644 --- a/WebCore/platform/PlatformWheelEvent.h +++ b/WebCore/platform/PlatformWheelEvent.h @@ -33,7 +33,7 @@ typedef struct _GdkEventScroll GdkEventScroll; #endif #if PLATFORM(EFL) -#include <Evas.h> +typedef struct _Evas_Event_Mouse_Wheel Evas_Event_Mouse_Wheel; #endif #if PLATFORM(QT) diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h index f25a63b..d9d2740 100644 --- a/WebCore/platform/PopupMenu.h +++ b/WebCore/platform/PopupMenu.h @@ -182,7 +182,7 @@ private: static void menuUnmapped(GtkWidget*, PopupMenu*); static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenu*); static void menuRemoveItem(GtkWidget*, PopupMenu*); -#elif PLATFORM(EFL) +#elif PLATFORM(EFL) || PLATFORM(BREWMP) FrameView* m_view; #elif PLATFORM(WX) wxMenu* m_menu; diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp index 87d58c7..615ae5d 100644 --- a/WebCore/platform/ScrollView.cpp +++ b/WebCore/platform/ScrollView.cpp @@ -543,7 +543,8 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) if (canBlitOnScroll()) { // The main frame can just blit the WebView window // FIXME: Find a way to scroll subframes with this faster path - hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect); + if (!scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect)) + hostWindow()->invalidateContentsForSlowScroll(updateRect, false); } else { // We need to go ahead and repaint the entire backing store. Do it now before moving the // windowed plugins. @@ -557,6 +558,12 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) hostWindow()->invalidateWindow(IntRect(), true); } +bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) +{ + hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); + return true; +} + IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const { IntPoint viewPoint = convertFromContainingWindow(windowPoint); diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h index 8bda7af..6853969 100644 --- a/WebCore/platform/ScrollView.h +++ b/WebCore/platform/ScrollView.h @@ -265,6 +265,9 @@ protected: virtual void updateScrollCorner(); virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); + // Scroll the content by blitting the pixels + virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); + private: RefPtr<Scrollbar> m_horizontalScrollbar; RefPtr<Scrollbar> m_verticalScrollbar; diff --git a/WebCore/platform/ThemeTypes.h b/WebCore/platform/ThemeTypes.h index 7314fba..271bd83 100644 --- a/WebCore/platform/ThemeTypes.h +++ b/WebCore/platform/ThemeTypes.h @@ -47,7 +47,7 @@ typedef unsigned ControlStates; // Must follow CSSValueKeywords.in order enum ControlPart { NoControlPart, CheckboxPart, RadioPart, PushButtonPart, SquareButtonPart, ButtonPart, - ButtonBevelPart, DefaultButtonPart, InnerSpinButtonPart, ListButtonPart, ListboxPart, ListItemPart, + ButtonBevelPart, DefaultButtonPart, InnerSpinButtonPart, InputSpeechButtonPart, ListButtonPart, ListboxPart, ListItemPart, MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart, MediaSeekBackButtonPart, MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart, MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart, diff --git a/WebCore/platform/ThreadTimers.h b/WebCore/platform/ThreadTimers.h index 01b4c71..ab42598 100644 --- a/WebCore/platform/ThreadTimers.h +++ b/WebCore/platform/ThreadTimers.h @@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ThreadTimer_h -#define ThreadTimer_h +#ifndef ThreadTimers_h +#define ThreadTimers_h #include <wtf/Noncopyable.h> #include <wtf/HashSet.h> diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h index 795dac3..d6ff597 100644 --- a/WebCore/platform/Widget.h +++ b/WebCore/platform/Widget.h @@ -78,8 +78,9 @@ typedef BView* PlatformWidget; #endif #if PLATFORM(EFL) -#include <Ecore_Evas.h> -#include <Evas.h> +typedef struct _Evas_Object Evas_Object; +typedef struct _Evas Evas; +typedef struct _Ecore_Evas Ecore_Evas; typedef Evas_Object* PlatformWidget; #endif diff --git a/WebCore/platform/brew/DragDataBrew.cpp b/WebCore/platform/brew/DragDataBrew.cpp index 20f93b8..eec8bc4 100644 --- a/WebCore/platform/brew/DragDataBrew.cpp +++ b/WebCore/platform/brew/DragDataBrew.cpp @@ -68,17 +68,16 @@ bool DragData::containsCompatibleContent() const return false; } -bool DragData::containsURL() const +bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return false; } -String DragData::asURL(String*) const +String DragData::asURL(FilenameConversionPolicy filenamePolicy, String*) const { return String(); } - PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const { return 0; diff --git a/WebCore/platform/brew/FileSystemBrew.cpp b/WebCore/platform/brew/FileSystemBrew.cpp new file mode 100644 index 0000000..88aa05b --- /dev/null +++ b/WebCore/platform/brew/FileSystemBrew.cpp @@ -0,0 +1,259 @@ +/* + * Copyright (C) 2010 Company 100, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FileSystem.h" + +#include "NotImplemented.h" +#include "PlatformString.h" +#include "StringBuilder.h" + +#include <AEEAppGen.h> +#include <AEEFile.h> +#include <AEEStdLib.h> + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RandomNumber.h> +#include <wtf/brew/ShellBrew.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +bool getFileSize(const String& path, long long& result) +{ + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + FileInfo info; + + if (IFILEMGR_GetInfo(fileMgr.get(), path.utf8().data(), &info) == SUCCESS) { + result = info.dwSize; + return true; + } + + return false; +} + +bool getFileModificationTime(const String& path, time_t& result) +{ + // There is no way to get file modification time in BREW. IFILEMGR_GetInfoEx() returns + // only file creation time. + return false; +} + +bool fileExists(const String& path) +{ + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + + return (IFILEMGR_Test(fileMgr.get(), path.utf8().data()) == SUCCESS); +} + +bool deleteFile(const String& path) +{ + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + + return (IFILEMGR_Remove(fileMgr.get(), path.utf8().data()) == SUCCESS); +} + +bool deleteEmptyDirectory(const String& path) +{ + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + + return (IFILEMGR_RmDir(fileMgr.get(), path.utf8().data()) == SUCCESS); +} + +String pathByAppendingComponent(const String& path, const String& component) +{ + if (component.isEmpty()) + return path; + + Vector<UChar, 1024> buffer; + + buffer.append(path.characters(), path.length()); + + if (buffer.last() != L'/' && component[0] != L'/') + buffer.append(L'/'); + + buffer.append(component.characters(), component.length()); + + return String(buffer.data(), buffer.size()); +} + +CString fileSystemRepresentation(const String& path) +{ + return path.utf8(); +} + +static String canonicalPath(const String& path) +{ + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + + // Get the buffer size required to resolve the path. + int canonPathLen; + IFILEMGR_ResolvePath(fileMgr.get(), path.utf8().data(), 0, &canonPathLen); + + // Resolve the path to the canonical path. + Vector<char> canonPathBuffer(canonPathLen); + IFILEMGR_ResolvePath(fileMgr.get(), path.utf8().data(), canonPathBuffer.data(), &canonPathLen); + + String canonPath(canonPathBuffer.data()); + + // Remove the trailing '/'. + int lastDivPos = canonPath.reverseFind('/'); + int endPos = canonPath.length(); + if (lastDivPos == endPos - 1) + canonPath = canonPath.substring(0, canonPath.length() - 1); + + return canonPath; +} + +static bool makeAllDirectories(PassOwnPtr<IFileMgr> fileMgr, const String& path) +{ + if (path == canonicalPath(AEEFS_HOME_DIR)) + return true; + + int lastDivPos = path.reverseFind('/'); + int endPos = path.length(); + if (lastDivPos == path.length() - 1) { + endPos -= 1; + lastDivPos = path.reverseFind('/', lastDivPos); + } + + if (lastDivPos > 0) { + if (!makeAllDirectories(fileMgr.release(), path.substring(0, lastDivPos))) + return false; + } + + String folder(path.substring(0, endPos)); + + // IFILEMGR_MkDir return SUCCESS when the file is successfully created or if file already exists. + // So we need to check fileinfo.attrib. + IFILEMGR_MkDir(fileMgr.get(), folder.utf8().data()); + + FileInfo fileInfo; + if (IFILEMGR_GetInfo(fileMgr.get(), folder.utf8().data(), &fileInfo) != SUCCESS) + return false; + + return fileInfo.attrib & _FA_DIR; +} + +bool makeAllDirectories(const String& path) +{ + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + + return makeAllDirectories(fileMgr.release(), canonicalPath(path)); +} + +String homeDirectoryPath() +{ + return String(AEEFS_HOME_DIR); +} + +String pathGetFileName(const String& path) +{ + return path.substring(path.reverseFind('/') + 1); +} + +String directoryName(const String& path) +{ + String fileName = pathGetFileName(path); + String dirName = String(path); + dirName.truncate(dirName.length() - pathGetFileName(path).length()); + return dirName; +} + +CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) +{ + // BREW does not have a system-wide temporary directory, + // use "fs:/~/tmp" as our temporary directory. + String tempPath("fs:/~/tmp"); + + OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + + // Create the temporary directory if it does not exist. + IFILEMGR_MkDir(fileMgr.get(), tempPath.utf8().data()); + + // Loop until we find a temporary filename that does not exist. + int number = static_cast<int>(randomNumber() * 10000); + CString filename; + do { + StringBuilder builder; + builder.append(tempPath); + builder.append('/'); + builder.append(prefix); + builder.append(String::number(number)); + filename = builder.toString().utf8(); + number++; + } while (IFILEMGR_Test(fileMgr.get(), filename.data()) == SUCCESS); + + IFile* tempFile = IFILEMGR_OpenFile(fileMgr.get(), filename.data(), _OFM_CREATE); + if (tempFile) { + handle = tempFile; + return filename; + } + + return CString(); +} + +void closeFile(PlatformFileHandle& handle) +{ + if (isHandleValid(handle)) { + IFILE_Release(handle); + handle = invalidPlatformFileHandle; + } +} + +int writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + if (!isHandleValid(handle)) + return -1; + + int bytesWritten = IFILE_Write(handle, data, length); + if (!bytesWritten) + return -1; + return bytesWritten; +} + +bool unloadModule(PlatformModule module) +{ + notImplemented(); + + return false; +} + +Vector<String> listDirectory(const String& path, const String& filter) +{ + Vector<String> entries; + + // OK to not implement listDirectory, because it's only used for plug-ins and + // Brew MP does not support the plug-in at the moment. + notImplemented(); + + return entries; +} + +} diff --git a/WebCore/platform/brew/PopupMenuBrew.cpp b/WebCore/platform/brew/PopupMenuBrew.cpp new file mode 100644 index 0000000..89f3fa1 --- /dev/null +++ b/WebCore/platform/brew/PopupMenuBrew.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2009-2010 ProFUSION embedded systems + * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 Company 100, Inc. + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" +#include "PopupMenu.h" + +#include "Chrome.h" +#include "ChromeClientBrew.h" +#include "FrameView.h" +#include "NotImplemented.h" + +namespace WebCore { + +PopupMenu::PopupMenu(PopupMenuClient* menuList) + : m_popupClient(menuList) + , m_view(0) +{ +} + +PopupMenu::~PopupMenu() +{ +} + +void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +{ + ASSERT(m_popupClient); + ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(view->frame()->page()->chrome()->client()); + ASSERT(chromeClient); + + m_view = view; + chromeClient->createSelectPopup(m_popupClient, index, rect); +} + +void PopupMenu::hide() +{ + ASSERT(m_view); + ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(m_view->frame()->page()->chrome()->client()); + ASSERT(chromeClient); + + chromeClient->destroySelectPopup(); +} + +void PopupMenu::updateFromElement() +{ + client()->setTextFromItem(client()->selectedIndex()); +} + +bool PopupMenu::itemWritingDirectionIsNatural() +{ + return true; +} + +} // namespace WebCore diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h index f1dc95b..3e9406d 100644 --- a/WebCore/platform/chromium/ChromiumBridge.h +++ b/WebCore/platform/chromium/ChromiumBridge.h @@ -44,6 +44,16 @@ typedef struct NPObject NPObject; typedef struct _NPP NPP_t; typedef NPP_t* NPP; +#if OS(DARWIN) +typedef struct CGFont* CGFontRef; +typedef uintptr_t ATSFontContainerRef; +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif +#endif // OS(DARWIN) + #if OS(WINDOWS) typedef struct HFONT__* HFONT; #endif @@ -127,6 +137,9 @@ namespace WebCore { static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result); static String getFontFamilyForCharacters(const UChar*, size_t numCharacters); #endif +#if OS(DARWIN) + static bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); +#endif // Forms -------------------------------------------------------------- static void notifyFormStateChanged(const Document*); diff --git a/WebCore/platform/chromium/ChromiumDataObject.cpp b/WebCore/platform/chromium/ChromiumDataObject.cpp index 5c67c65..8352669 100644 --- a/WebCore/platform/chromium/ChromiumDataObject.cpp +++ b/WebCore/platform/chromium/ChromiumDataObject.cpp @@ -67,7 +67,8 @@ bool ChromiumDataObject::hasData() const } ChromiumDataObject::ChromiumDataObject(const ChromiumDataObject& other) - : urlTitle(other.urlTitle) + : RefCounted<ChromiumDataObject>() + , urlTitle(other.urlTitle) , downloadMetadata(other.downloadMetadata) , fileExtension(other.fileExtension) , filenames(other.filenames) diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp index 750ff30..29f9620 100644 --- a/WebCore/platform/chromium/ClipboardChromium.cpp +++ b/WebCore/platform/chromium/ClipboardChromium.cpp @@ -512,8 +512,7 @@ void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame) if (!m_dataObject) return; - m_dataObject->textHtml = createMarkup(selectedRange, 0, - AnnotateForInterchange); + m_dataObject->textHtml = createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs); m_dataObject->htmlBaseUrl = frame->document()->url(); String str = frame->selectedText(); diff --git a/WebCore/platform/chromium/KeyboardCodes.h b/WebCore/platform/chromium/KeyboardCodes.h index ee4024a..a58ba35 100644 --- a/WebCore/platform/chromium/KeyboardCodes.h +++ b/WebCore/platform/chromium/KeyboardCodes.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef KeyboardCodesWin_h -#define KeyboardCodesWin_h +#ifndef KeyboardCodes_h +#define KeyboardCodes_h #if OS(WINDOWS) #include <windows.h> diff --git a/WebCore/platform/chromium/PasteboardChromium.cpp b/WebCore/platform/chromium/PasteboardChromium.cpp index 0455482..58373b1 100644 --- a/WebCore/platform/chromium/PasteboardChromium.cpp +++ b/WebCore/platform/chromium/PasteboardChromium.cpp @@ -81,7 +81,7 @@ void Pasteboard::setSelectionMode(bool selectionMode) void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { - String html = createMarkup(selectedRange, 0, AnnotateForInterchange); + String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs); ExceptionCode ec = 0; KURL url = selectedRange->startContainer(ec)->document()->url(); String plainText = frame->selectedText(); diff --git a/WebCore/platform/chromium/ThemeChromiumMac.mm b/WebCore/platform/chromium/ThemeChromiumMac.mm index 15a8382..5769e38 100644 --- a/WebCore/platform/chromium/ThemeChromiumMac.mm +++ b/WebCore/platform/chromium/ThemeChromiumMac.mm @@ -271,7 +271,8 @@ static void updateStates(NSCell* cell, ControlStates states) // Window Inactive state NSControlTint oldTint = [cell controlTint]; bool windowInactive = (states & WindowInactiveState); - NSControlTint tint = windowInactive ? NSClearControlTint : [NSColor currentControlTint]; + NSControlTint tint = windowInactive ? static_cast<NSControlTint>(NSClearControlTint) + : [NSColor currentControlTint]; if (tint != oldTint) [cell setControlTint:tint]; } diff --git a/WebCore/platform/efl/FileChooserEfl.cpp b/WebCore/platform/efl/FileChooserEfl.cpp index 866caae..c77fa9e 100644 --- a/WebCore/platform/efl/FileChooserEfl.cpp +++ b/WebCore/platform/efl/FileChooserEfl.cpp @@ -31,6 +31,7 @@ #include "FileChooser.h" #include "LocalizedStrings.h" +#include "StringTruncator.h" namespace WebCore { @@ -39,8 +40,15 @@ String FileChooser::basenameForWidth(const Font& font, int width) const if (width <= 0) return String(); + String string; if (m_filenames.isEmpty()) - return fileButtonNoFileSelectedLabel(); + string = fileButtonNoFileSelectedLabel(); + else if (m_filenames.size() == 1) + string = m_filenames[0]; + else + return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font, false); + + return StringTruncator::centerTruncate(string, static_cast<float>(width), font, false); } } diff --git a/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp b/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp index f2f03a4..70e317e 100644 --- a/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp +++ b/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp @@ -37,6 +37,7 @@ #include "TextEncoding.h" #include "WindowsKeyboardCodes.h" +#include <Evas.h> #include <stdio.h> #include <wtf/HashMap.h> #include <wtf/text/CString.h> diff --git a/WebCore/platform/efl/PlatformMouseEventEfl.cpp b/WebCore/platform/efl/PlatformMouseEventEfl.cpp index a03614c..53de522 100644 --- a/WebCore/platform/efl/PlatformMouseEventEfl.cpp +++ b/WebCore/platform/efl/PlatformMouseEventEfl.cpp @@ -37,7 +37,7 @@ namespace WebCore { -void PlatformMouseEvent::setClickCount(Evas_Button_Flags flags) +void PlatformMouseEvent::setClickCount(unsigned int flags) { if (flags & EVAS_BUTTON_TRIPLE_CLICK) m_clickCount = 3; diff --git a/WebCore/platform/efl/PlatformWheelEventEfl.cpp b/WebCore/platform/efl/PlatformWheelEventEfl.cpp index 08bda5e..704db38 100644 --- a/WebCore/platform/efl/PlatformWheelEventEfl.cpp +++ b/WebCore/platform/efl/PlatformWheelEventEfl.cpp @@ -33,6 +33,8 @@ #include "Scrollbar.h" +#include <Evas.h> + namespace WebCore { enum { diff --git a/WebCore/platform/efl/RenderThemeEfl.cpp b/WebCore/platform/efl/RenderThemeEfl.cpp index 2773b0d..6ed7599 100644 --- a/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/WebCore/platform/efl/RenderThemeEfl.cpp @@ -36,6 +36,7 @@ #include "RenderObject.h" #include <wtf/text/CString.h> +#include <Ecore_Evas.h> #include <Edje.h> namespace WebCore { diff --git a/WebCore/platform/efl/RenderThemeEfl.h b/WebCore/platform/efl/RenderThemeEfl.h index 3ebd29d..22e0608 100644 --- a/WebCore/platform/efl/RenderThemeEfl.h +++ b/WebCore/platform/efl/RenderThemeEfl.h @@ -32,10 +32,11 @@ #include "RenderTheme.h" -#include <Ecore_Evas.h> -#include <Evas.h> #include <cairo.h> +typedef struct _Ecore_Evas Ecore_Evas; +typedef struct _Evas_Object Evas_Object; + namespace WebCore { enum FormType { // KEEP IN SYNC WITH edjeGroupFromFormType() diff --git a/WebCore/platform/efl/ScrollbarEfl.cpp b/WebCore/platform/efl/ScrollbarEfl.cpp index 5b8002d..1030ebd 100644 --- a/WebCore/platform/efl/ScrollbarEfl.cpp +++ b/WebCore/platform/efl/ScrollbarEfl.cpp @@ -35,6 +35,7 @@ #include <Ecore.h> #include <Edje.h> +#include <Evas.h> #include <string> #include <wtf/text/CString.h> diff --git a/WebCore/platform/efl/ScrollbarEfl.h b/WebCore/platform/efl/ScrollbarEfl.h index cd85888..35375a6 100644 --- a/WebCore/platform/efl/ScrollbarEfl.h +++ b/WebCore/platform/efl/ScrollbarEfl.h @@ -30,7 +30,6 @@ #define ScrollbarEfl_h #include "Scrollbar.h" -#include <Evas.h> #include <wtf/PassRefPtr.h> namespace WebCore { diff --git a/WebCore/platform/efl/WidgetEfl.cpp b/WebCore/platform/efl/WidgetEfl.cpp index 9e335f7..725e56f 100644 --- a/WebCore/platform/efl/WidgetEfl.cpp +++ b/WebCore/platform/efl/WidgetEfl.cpp @@ -41,6 +41,7 @@ #include "Page.h" #include <Ecore.h> +#include <Ecore_Evas.h> #include <Edje.h> #include <Evas.h> diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h index e5591ec..2cf30d3 100644 --- a/WebCore/platform/graphics/BitmapImage.h +++ b/WebCore/platform/graphics/BitmapImage.h @@ -57,7 +57,7 @@ namespace WebCore { // invoking our constructor or destructor. This allows us to have a vector even for a struct // that's not copyable. namespace WTF { - template<> class VectorTraits<WebCore::FrameData> : public SimpleClassVectorTraits {}; + template<> struct VectorTraits<WebCore::FrameData> : public SimpleClassVectorTraits {}; } namespace WebCore { diff --git a/WebCore/platform/graphics/FloatRect.h b/WebCore/platform/graphics/FloatRect.h index 4c3a382..b265121 100644 --- a/WebCore/platform/graphics/FloatRect.h +++ b/WebCore/platform/graphics/FloatRect.h @@ -29,10 +29,6 @@ #include "FloatPoint.h" -#if PLATFORM(EFL) -#include <Evas.h> -#endif - #if PLATFORM(CG) typedef struct CGRect CGRect; #endif @@ -149,11 +145,6 @@ public: operator QRectF() const; #endif -#if PLATFORM(EFL) - explicit FloatRect(const Eina_Rectangle&); - operator Eina_Rectangle() const; -#endif - #if PLATFORM(WX) && USE(WXGC) FloatRect(const wxRect2DDouble&); operator wxRect2DDouble() const; diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp index 6414147..0351f7b 100644 --- a/WebCore/platform/graphics/Font.cpp +++ b/WebCore/platform/graphics/Font.cpp @@ -191,7 +191,7 @@ float Font::floatWidth(const TextRun& run, int extraCharsAvailable, int& charsCo return floatWidthForComplexText(run); } -FloatRect Font::selectionRectForText(const TextRun& run, const IntPoint& point, int h, int from, int to) const +FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) @@ -206,7 +206,7 @@ FloatRect Font::selectionRectForText(const TextRun& run, const IntPoint& point, return selectionRectForComplexText(run, point, h, from, to); } -int Font::offsetForPosition(const TextRun& run, int x, bool includePartialGlyphs) const +int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const { #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h index 2b36cca..ecfde98 100644 --- a/WebCore/platform/graphics/Font.h +++ b/WebCore/platform/graphics/Font.h @@ -50,7 +50,6 @@ class FontSelector; class GlyphBuffer; class GlyphPageTreeNode; class GraphicsContext; -class IntPoint; class SVGFontElement; struct GlyphData; @@ -99,8 +98,8 @@ public: float floatWidth(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* glyphOverflow = 0) const; float floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; - int offsetForPosition(const TextRun&, int position, bool includePartialGlyphs) const; - FloatRect selectionRectForText(const TextRun&, const IntPoint&, int h, int from = 0, int to = -1) const; + int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const; + FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const; bool isSmallCaps() const { return m_fontDescription.smallCaps(); } @@ -158,24 +157,24 @@ private: void drawTextUsingSVGFont(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; float floatWidthUsingSVGFont(const TextRun&) const; float floatWidthUsingSVGFont(const TextRun&, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; - FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const IntPoint&, int h, int from, int to) const; - int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const; + FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const FloatPoint&, int h, int from, int to) const; + int offsetForPositionForTextUsingSVGFont(const TextRun&, float position, bool includePartialGlyphs) const; #endif void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const; float floatWidthForSimpleText(const TextRun&, GlyphBuffer*, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; - int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const; - FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const; + int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const; + FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to) const; static bool canReturnFallbackFontsForComplexText(); CodePath codePath(const TextRun&) const; void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; - int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const; - FloatRect selectionRectForComplexText(const TextRun&, const IntPoint&, int h, int from, int to) const; + int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const; + FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const; friend struct WidthIterator; diff --git a/WebCore/platform/graphics/FontCache.h b/WebCore/platform/graphics/FontCache.h index dd5928d..1a3ba69 100644 --- a/WebCore/platform/graphics/FontCache.h +++ b/WebCore/platform/graphics/FontCache.h @@ -72,6 +72,7 @@ public: #endif static void comInitialize(); static void comUninitialize(); + static IMultiLanguage* getMultiLanguageInterface(); #elif PLATFORM(WIN) IMLangFontLink2* getFontLinkInterface(); #endif diff --git a/WebCore/platform/graphics/FontFastPath.cpp b/WebCore/platform/graphics/FontFastPath.cpp index b863e83..82f970f 100644 --- a/WebCore/platform/graphics/FontFastPath.cpp +++ b/WebCore/platform/graphics/FontFastPath.cpp @@ -29,7 +29,6 @@ #include "FontFallbackList.h" #include "GlyphBuffer.h" #include "GlyphPageTreeNode.h" -#include "IntPoint.h" #include "SimpleFontData.h" #include "WidthIterator.h" @@ -257,7 +256,7 @@ float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer return it.m_runWidthSoFar; } -FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& point, int h, int from, int to) const +FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { WidthIterator it(this, run); it.advance(from); @@ -265,19 +264,19 @@ FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& p it.advance(to); float afterWidth = it.m_runWidthSoFar; - // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning + // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning. if (run.rtl()) { it.advance(run.length()); float totalWidth = it.m_runWidthSoFar; return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h); - } else { - return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h); } + + return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h); } -int Font::offsetForPositionForSimpleText(const TextRun& run, int x, bool includePartialGlyphs) const +int Font::offsetForPositionForSimpleText(const TextRun& run, float x, bool includePartialGlyphs) const { - float delta = (float)x; + float delta = x; WidthIterator it(this, run); GlyphBuffer localGlyphBuffer; diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp index 629d100..bee3ef6 100644 --- a/WebCore/platform/graphics/GraphicsContext.cpp +++ b/WebCore/platform/graphics/GraphicsContext.cpp @@ -129,7 +129,7 @@ void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace) setPlatformStrokeColor(color, colorSpace); } -void GraphicsContext::setShadow(const IntSize& size, float blur, const Color& color, ColorSpace colorSpace) +void GraphicsContext::setShadow(const FloatSize& size, float blur, const Color& color, ColorSpace colorSpace) { m_common->state.shadowSize = size; m_common->state.shadowBlur = blur; @@ -145,7 +145,7 @@ void GraphicsContext::clearShadow() clearPlatformShadow(); } -bool GraphicsContext::getShadow(IntSize& size, float& blur, Color& color) const +bool GraphicsContext::getShadow(FloatSize& size, float& blur, Color& color) const { size = m_common->state.shadowSize; blur = m_common->state.shadowBlur; diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index b857546..8bcfc06 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -47,9 +47,7 @@ class SurfaceOpenVG; } typedef class WebCore::SurfaceOpenVG PlatformGraphicsContext; #elif PLATFORM(QT) -QT_BEGIN_NAMESPACE -class QPainter; -QT_END_NAMESPACE +#include <QPainter> typedef QPainter PlatformGraphicsContext; #elif PLATFORM(WX) class wxGCDC; @@ -298,8 +296,8 @@ namespace WebCore { void beginTransparencyLayer(float opacity); void endTransparencyLayer(); - void setShadow(const IntSize&, float blur, const Color&, ColorSpace); - bool getShadow(IntSize&, float&, Color&) const; + void setShadow(const FloatSize&, float blur, const Color&, ColorSpace); + bool getShadow(FloatSize&, float&, Color&) const; void clearShadow(); void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&); @@ -314,7 +312,7 @@ namespace WebCore { #if PLATFORM(CAIRO) float getAlpha(); void createPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, const FloatRect& shadowRect, float kernelSize); - static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, float shadowBlur); + static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const FloatSize& shadowSize, float shadowBlur); #endif void setCompositeOperation(CompositeOperator); @@ -413,6 +411,7 @@ namespace WebCore { bool inTransparencyLayer() const; PlatformPath* currentPath(); QPen pen(); + static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op); #endif #if PLATFORM(GTK) @@ -444,7 +443,7 @@ namespace WebCore { void setPlatformShouldAntialias(bool b); - void setPlatformShadow(const IntSize&, float blur, const Color&, ColorSpace); + void setPlatformShadow(const FloatSize&, float blur, const Color&, ColorSpace); void clearPlatformShadow(); static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&); diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp index a5ca8c7..dc70734 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.cpp +++ b/WebCore/platform/graphics/GraphicsContext3D.cpp @@ -35,31 +35,75 @@ namespace WebCore { +bool GraphicsContext3D::computeFormatAndTypeParameters(unsigned int format, + unsigned int type, + unsigned long* componentsPerPixel, + unsigned long* bytesPerComponent) +{ + switch (format) { + case GraphicsContext3D::ALPHA: + *componentsPerPixel = 1; + break; + case GraphicsContext3D::LUMINANCE: + *componentsPerPixel = 1; + break; + case GraphicsContext3D::LUMINANCE_ALPHA: + *componentsPerPixel = 2; + break; + case GraphicsContext3D::RGB: + *componentsPerPixel = 3; + break; + case GraphicsContext3D::RGBA: + *componentsPerPixel = 4; + break; + default: + return false; + } + switch (type) { + case GraphicsContext3D::UNSIGNED_BYTE: + *bytesPerComponent = sizeof(unsigned char); + break; + case GraphicsContext3D::UNSIGNED_SHORT_5_6_5: + case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4: + case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: + *componentsPerPixel = 1; + *bytesPerComponent = sizeof(unsigned short); + break; + default: + return false; + } + return true; +} + bool GraphicsContext3D::extractImageData(Image* image, + unsigned int format, + unsigned int type, bool flipY, bool premultiplyAlpha, - Vector<uint8_t>& imageData, - unsigned int* format, - unsigned int* internalFormat) + Vector<uint8_t>& data) { if (!image) return false; - AlphaOp alphaOp = kAlphaDoNothing; - bool hasAlphaChannel = true; - if (!getImageData(image, imageData, premultiplyAlpha, - &hasAlphaChannel, &alphaOp, format)) + if (!getImageData(image, format, type, premultiplyAlpha, data)) return false; - processImageData(imageData.data(), - image->width(), - image->height(), - flipY, - alphaOp); - // For GLES2 tex functions, internalformat has to match format. - *internalFormat = *format; + if (flipY) { + unsigned long componentsPerPixel, bytesPerComponent; + if (!computeFormatAndTypeParameters(format, type, + &componentsPerPixel, + &bytesPerComponent)) + return false; + // The image data is tightly packed, and we upload it as such. + unsigned int unpackAlignment = 1; + flipVertically(data.data(), image->width(), image->height(), + componentsPerPixel * bytesPerComponent, + unpackAlignment); + } return true; } bool GraphicsContext3D::extractImageData(ImageData* imageData, + unsigned int format, + unsigned int type, bool flipY, bool premultiplyAlpha, Vector<uint8_t>& data) @@ -70,83 +114,480 @@ bool GraphicsContext3D::extractImageData(ImageData* imageData, int height = imageData->height(); int dataBytes = width * height * 4; data.resize(dataBytes); - uint8_t* dst = data.data(); - uint8_t* src = imageData->data()->data()->data(); - memcpy(dst, src, dataBytes); - processImageData(dst, - width, - height, - flipY, - premultiplyAlpha ? kAlphaDoPremultiply : kAlphaDoNothing); + if (!packPixels(imageData->data()->data()->data(), + kSourceFormatRGBA8, + width, + height, + format, + type, + premultiplyAlpha ? kAlphaDoPremultiply : kAlphaDoNothing, + data.data())) + return false; + if (flipY) { + unsigned long componentsPerPixel, bytesPerComponent; + if (!computeFormatAndTypeParameters(format, type, + &componentsPerPixel, + &bytesPerComponent)) + return false; + // The image data is tightly packed, and we upload it as such. + unsigned int unpackAlignment = 1; + flipVertically(data.data(), width, height, + componentsPerPixel * bytesPerComponent, + unpackAlignment); + } return true; } -void GraphicsContext3D::processImageData(uint8_t* imageData, - unsigned width, - unsigned height, - bool flipVertically, - AlphaOp alphaOp) +void GraphicsContext3D::flipVertically(void* imageData, + unsigned int width, + unsigned int height, + unsigned int bytesPerPixel, + unsigned int unpackAlignment) { - switch (alphaOp) { - case kAlphaDoPremultiply: - premultiplyAlpha(imageData, width * height); - break; - case kAlphaDoUnmultiply: - unmultiplyAlpha(imageData, width * height); - break; - default: - break; + if (!width || !height) + return; + unsigned int validRowBytes = width * bytesPerPixel; + unsigned int totalRowBytes = validRowBytes; + unsigned int remainder = validRowBytes % unpackAlignment; + if (remainder) + totalRowBytes += remainder; + uint8_t* tempRow = new uint8_t[validRowBytes]; + uint8_t* data = static_cast<uint8_t*>(imageData); + for (unsigned i = 0; i < height / 2; i++) { + uint8_t* lowRow = data + (totalRowBytes * i); + uint8_t* highRow = data + (totalRowBytes * (height - i - 1)); + memcpy(tempRow, lowRow, validRowBytes); + memcpy(lowRow, highRow, validRowBytes); + memcpy(highRow, tempRow, validRowBytes); } + delete[] tempRow; +} - if (flipVertically && width && height) { - int rowBytes = width * 4; - uint8_t* tempRow = new uint8_t[rowBytes]; - for (unsigned i = 0; i < height / 2; i++) { - uint8_t* lowRow = imageData + (rowBytes * i); - uint8_t* highRow = imageData + (rowBytes * (height - i - 1)); - memcpy(tempRow, lowRow, rowBytes); - memcpy(lowRow, highRow, rowBytes); - memcpy(highRow, tempRow, rowBytes); - } - delete[] tempRow; +// These functions can not be static, or gcc will not allow them to be +// used as template parameters. Use an anonymous namespace to prevent +// the need to declare prototypes for them. +namespace { + +//---------------------------------------------------------------------- +// Pixel unpacking routines. + +void unpackRGB8ToRGBA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[0]; + destination[1] = source[1]; + destination[2] = source[2]; + destination[3] = 0xFF; +} + +void unpackBGRA8ToRGBA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[2]; + destination[1] = source[1]; + destination[2] = source[0]; + destination[3] = source[3]; +} + +//---------------------------------------------------------------------- +// Pixel packing routines. +// + +void packRGBA8ToA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[3]; +} + +void packRGBA8ToR8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[0]; +} + +void packRGBA8ToR8Premultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + destination[0] = sourceR; +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToR8Unmultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + destination[0] = sourceR; +} + +void packRGBA8ToRA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[0]; + destination[1] = source[3]; +} + +void packRGBA8ToRA8Premultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + destination[0] = sourceR; + destination[1] = source[3]; +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToRA8Unmultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + destination[0] = sourceR; + destination[1] = source[3]; +} + +void packRGBA8ToRGB8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[0]; + destination[1] = source[1]; + destination[2] = source[2]; +} + +void packRGBA8ToRGB8Premultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + destination[0] = sourceR; + destination[1] = sourceG; + destination[2] = sourceB; +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToRGB8Unmultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + destination[0] = sourceR; + destination[1] = sourceG; + destination[2] = sourceB; +} + +// This is only used when the source format is different than kSourceFormatRGBA8. +void packRGBA8ToRGBA8(const uint8_t* source, uint8_t* destination) +{ + destination[0] = source[0]; + destination[1] = source[1]; + destination[2] = source[2]; + destination[3] = source[3]; +} + +void packRGBA8ToRGBA8Premultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + destination[0] = sourceR; + destination[1] = sourceG; + destination[2] = sourceB; +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToRGBA8Unmultiply(const uint8_t* source, uint8_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + destination[0] = sourceR; + destination[1] = sourceG; + destination[2] = sourceB; + destination[3] = source[3]; +} + +void packRGBA8ToUnsignedShort4444(const uint8_t* source, uint16_t* destination) +{ + *destination = (((source[0] & 0xF0) << 8) + | ((source[1] & 0xF0) << 4) + | (source[2] & 0xF0) + | (source[3] >> 4)); +} + +void packRGBA8ToUnsignedShort4444Premultiply(const uint8_t* source, uint16_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + *destination = (((sourceR & 0xF0) << 8) + | ((sourceG & 0xF0) << 4) + | (sourceB & 0xF0) + | (source[3] >> 4)); +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToUnsignedShort4444Unmultiply(const uint8_t* source, uint16_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + *destination = (((sourceR & 0xF0) << 8) + | ((sourceG & 0xF0) << 4) + | (sourceB & 0xF0) + | (source[3] >> 4)); +} + +void packRGBA8ToUnsignedShort5551(const uint8_t* source, uint16_t* destination) +{ + *destination = (((source[0] & 0xF8) << 8) + | ((source[1] & 0xF8) << 3) + | ((source[2] & 0xF8) >> 2) + | (source[3] >> 7)); +} + +void packRGBA8ToUnsignedShort5551Premultiply(const uint8_t* source, uint16_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + *destination = (((sourceR & 0xF8) << 8) + | ((sourceG & 0xF8) << 3) + | ((sourceB & 0xF8) >> 2) + | (source[3] >> 7)); +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToUnsignedShort5551Unmultiply(const uint8_t* source, uint16_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + *destination = (((sourceR & 0xF8) << 8) + | ((sourceG & 0xF8) << 3) + | ((sourceB & 0xF8) >> 2) + | (source[3] >> 7)); +} + +void packRGBA8ToUnsignedShort565(const uint8_t* source, uint16_t* destination) +{ + *destination = (((source[0] & 0xF8) << 8) + | ((source[1] & 0xFC) << 3) + | ((source[2] & 0xF8) >> 3)); +} + +void packRGBA8ToUnsignedShort565Premultiply(const uint8_t* source, uint16_t* destination) +{ + float scaleFactor = source[3] / 255.0f; + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + *destination = (((sourceR & 0xF8) << 8) + | ((sourceG & 0xFC) << 3) + | ((sourceB & 0xF8) >> 3)); +} + +// FIXME: this routine is lossy and must be removed. +void packRGBA8ToUnsignedShort565Unmultiply(const uint8_t* source, uint16_t* destination) +{ + float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f); + uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); + uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor); + uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor); + *destination = (((sourceR & 0xF8) << 8) + | ((sourceG & 0xFC) << 3) + | ((sourceB & 0xF8) >> 3)); +} + +} // anonymous namespace + +// This is used whenever unpacking is necessary; i.e., the source data +// is not in RGBA8 format. +template<typename SourceType, typename DestType, + void unpackingFunc(const SourceType*, uint8_t*), + void packingFunc(const uint8_t*, DestType*)> +static void doUnpackingAndPacking(const SourceType* sourceData, + unsigned int numElements, + unsigned int sourceElementsPerPixel, + DestType* destinationData, + unsigned int destinationElementsPerPixel) +{ + const SourceType* endPointer = sourceData + numElements; + uint8_t temporaryRGBAData[4]; + while (sourceData < endPointer) { + unpackingFunc(sourceData, temporaryRGBAData); + packingFunc(temporaryRGBAData, destinationData); + sourceData += sourceElementsPerPixel; + destinationData += destinationElementsPerPixel; } } -// Premultiply alpha into color channels. -void GraphicsContext3D::premultiplyAlpha(unsigned char* rgbaData, int numPixels) +// This handles all conversions with a faster path for RGBA8 source data. +template<typename SourceType, typename DestType, void packingFunc(const SourceType*, DestType*)> +static void doPacking(const SourceType* sourceData, + GraphicsContext3D::SourceDataFormat sourceDataFormat, + unsigned int numElements, + unsigned int sourceElementsPerPixel, + DestType* destinationData, + unsigned int destinationElementsPerPixel) { - for (int j = 0; j < numPixels; j++) { - float r = rgbaData[4*j+0] / 255.0f; - float g = rgbaData[4*j+1] / 255.0f; - float b = rgbaData[4*j+2] / 255.0f; - float a = rgbaData[4*j+3] / 255.0f; - rgbaData[4*j+0] = (unsigned char) (r * a * 255.0f); - rgbaData[4*j+1] = (unsigned char) (g * a * 255.0f); - rgbaData[4*j+2] = (unsigned char) (b * a * 255.0f); + switch (sourceDataFormat) { + case GraphicsContext3D::kSourceFormatRGBA8: { + const SourceType* endPointer = sourceData + numElements; + while (sourceData < endPointer) { + packingFunc(sourceData, destinationData); + sourceData += sourceElementsPerPixel; + destinationData += destinationElementsPerPixel; + } + break; + } + case GraphicsContext3D::kSourceFormatRGB8: { + doUnpackingAndPacking<SourceType, DestType, unpackRGB8ToRGBA8, packingFunc>(sourceData, numElements, sourceElementsPerPixel, destinationData, destinationElementsPerPixel); + break; + } + case GraphicsContext3D::kSourceFormatBGRA8: { + doUnpackingAndPacking<SourceType, DestType, unpackBGRA8ToRGBA8, packingFunc>(sourceData, numElements, sourceElementsPerPixel, destinationData, destinationElementsPerPixel); + break; + } } } -// Remove premultiplied alpha from color channels. -// FIXME: this is lossy. Must retrieve original values from HTMLImageElement. -void GraphicsContext3D::unmultiplyAlpha(unsigned char* rgbaData, int numPixels) -{ - for (int j = 0; j < numPixels; j++) { - float r = rgbaData[4*j+0] / 255.0f; - float g = rgbaData[4*j+1] / 255.0f; - float b = rgbaData[4*j+2] / 255.0f; - float a = rgbaData[4*j+3] / 255.0f; - if (a > 0.0f) { - r /= a; - g /= a; - b /= a; - r = (r > 1.0f) ? 1.0f : r; - g = (g > 1.0f) ? 1.0f : g; - b = (b > 1.0f) ? 1.0f : b; - rgbaData[4*j+0] = (unsigned char) (r * 255.0f); - rgbaData[4*j+1] = (unsigned char) (g * 255.0f); - rgbaData[4*j+2] = (unsigned char) (b * 255.0f); +bool GraphicsContext3D::packPixels(const uint8_t* sourceData, + GraphicsContext3D::SourceDataFormat sourceDataFormat, + unsigned int width, + unsigned int height, + unsigned int destinationFormat, + unsigned int destinationType, + AlphaOp alphaOp, + void* destinationData) +{ + unsigned int sourceElementsPerPixel = 4; + unsigned int numElements = width * height * sourceElementsPerPixel; + switch (destinationType) { + case UNSIGNED_BYTE: { + uint8_t* destination = static_cast<uint8_t*>(destinationData); + if (sourceDataFormat == kSourceFormatRGBA8 && destinationFormat == RGBA && alphaOp == kAlphaDoNothing) { + // No conversion necessary. + memcpy(destinationData, sourceData, numElements); + break; + } + switch (destinationFormat) { + case RGB: + switch (alphaOp) { + case kAlphaDoNothing: + doPacking<uint8_t, uint8_t, packRGBA8ToRGB8>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 3); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToRGB8Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 3); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToRGB8Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 3); + break; + } + break; + case RGBA: + switch (alphaOp) { + case kAlphaDoNothing: + ASSERT(sourceDataFormat != kSourceFormatRGBA8); // Handled above with fast case. + doPacking<uint8_t, uint8_t, packRGBA8ToRGBA8>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 4); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToRGBA8Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 4); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToRGBA8Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 4); + break; + default: + ASSERT_NOT_REACHED(); + } + break; + case ALPHA: + // From the desktop OpenGL conversion rules (OpenGL 2.1 + // specification, Table 3.15), the alpha channel is chosen + // from the RGBA data. + doPacking<uint8_t, uint8_t, packRGBA8ToA8>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case LUMINANCE: + // From the desktop OpenGL conversion rules (OpenGL 2.1 + // specification, Table 3.15), the red channel is chosen + // from the RGBA data. + switch (alphaOp) { + case kAlphaDoNothing: + doPacking<uint8_t, uint8_t, packRGBA8ToR8>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToR8Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToR8Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + } + break; + case LUMINANCE_ALPHA: + // From the desktop OpenGL conversion rules (OpenGL 2.1 + // specification, Table 3.15), the red and alpha channels + // are chosen from the RGBA data. + switch (alphaOp) { + case kAlphaDoNothing: + doPacking<uint8_t, uint8_t, packRGBA8ToRA8>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 2); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToRA8Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 2); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint8_t, packRGBA8ToRA8Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 2); + break; + } + break; + } + break; + } + case UNSIGNED_SHORT_4_4_4_4: { + uint16_t* destination = static_cast<uint16_t*>(destinationData); + switch (alphaOp) { + case kAlphaDoNothing: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort4444>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort4444Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort4444Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; } + break; } + case UNSIGNED_SHORT_5_5_5_1: { + uint16_t* destination = static_cast<uint16_t*>(destinationData); + switch (alphaOp) { + case kAlphaDoNothing: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort5551>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort5551Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort5551Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + } + break; + } + case UNSIGNED_SHORT_5_6_5: { + uint16_t* destination = static_cast<uint16_t*>(destinationData); + switch (alphaOp) { + case kAlphaDoNothing: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort565>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoPremultiply: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort565Premultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + case kAlphaDoUnmultiply: + doPacking<uint8_t, uint16_t, packRGBA8ToUnsignedShort565Unmultiply>(sourceData, sourceDataFormat, numElements, sourceElementsPerPixel, destination, 1); + break; + } + break; + } + } + return true; } } // namespace WebCore diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h index 8d5c286..981459f 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.h +++ b/WebCore/platform/graphics/GraphicsContext3D.h @@ -26,6 +26,7 @@ #ifndef GraphicsContext3D_h #define GraphicsContext3D_h +#include "GraphicsLayer.h" #include "PlatformString.h" #include <wtf/ListHashSet.h> @@ -39,11 +40,20 @@ #if PLATFORM(MAC) #include <OpenGL/OpenGL.h> +#include <wtf/RetainPtr.h> -typedef void* PlatformGraphicsContext3D; +typedef CGLContextObj PlatformGraphicsContext3D; const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0; typedef GLuint Platform3DObject; const Platform3DObject NullPlatform3DObject = 0; + +#ifdef __OBJC__ +@class CALayer; +@class WebGLLayer; +#else +typedef void* CALayer; +typedef void* WebGLLayer; +#endif #elif PLATFORM(QT) class QPainter; class QRect; @@ -421,15 +431,27 @@ namespace WebCore { #if PLATFORM(MAC) PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; } Platform3DObject platformTexture() const { return m_texture; } + CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); } #elif PLATFORM(CHROMIUM) PlatformGraphicsContext3D platformGraphicsContext3D() const; Platform3DObject platformTexture() const; +#if USE(ACCELERATED_COMPOSITING) + // FIXME: Stubbed out for now. Must be implemented to get WebGL working with + // accelerated compositing. + PlatformLayer* platformLayer() const { return 0; } +#endif #elif PLATFORM(QT) PlatformGraphicsContext3D platformGraphicsContext3D(); Platform3DObject platformTexture() const; +#if USE(ACCELERATED_COMPOSITING) + PlatformLayer* platformLayer() const { return 0; } +#endif #else PlatformGraphicsContext3D platformGraphicsContext3D() const { return NullPlatformGraphicsContext3D; } Platform3DObject platformTexture() const { return NullPlatform3DObject; } +#if USE(ACCELERATED_COMPOSITING) + PlatformLayer* platformLayer() const { return 0; } +#endif #endif void makeContextCurrent(); @@ -442,49 +464,59 @@ namespace WebCore { // like GL_FLOAT, GL_INT, etc. int sizeInBytes(int type); + bool isGLES2Compliant() const; + //---------------------------------------------------------------------- - // Helpers for texture uploading. + // Helpers for texture uploading and pixel readback. // - // Extracts the contents of the given Image into the passed - // Vector, obeying the flipY and premultiplyAlpha flags. - // Returns the applicable OpenGL format and internalFormat for - // the subsequent glTexImage2D or glTexSubImage2D call. - // Returns true upon success. + // Computes the components per pixel and bytes per component + // for the given format and type combination. Returns false if + // either was an invalid enum. + bool computeFormatAndTypeParameters(unsigned int format, + unsigned int type, + unsigned long* componentsPerPixel, + unsigned long* bytesPerComponent); + + // Extracts the contents of the given Image into the passed Vector, + // packing the pixel data according to the given format and type, + // and obeying the flipY and premultiplyAlpha flags. Returns true + // upon success. bool extractImageData(Image* image, + unsigned int format, + unsigned int type, bool flipY, bool premultiplyAlpha, - Vector<uint8_t>& imageData, - unsigned int* format, - unsigned int* internalFormat); + Vector<uint8_t>& data); - // Extracts the contents of the given ImageData into the passed - // Vector, obeying the flipY and premultiplyAlpha flags. - // Returns true upon success. + // Extracts the contents of the given ImageData into the passed Vector, + // packing the pixel data according to the given format and type, + // and obeying the flipY and premultiplyAlpha flags. Returns true + // upon success. bool extractImageData(ImageData*, + unsigned int format, + unsigned int type, bool flipY, bool premultiplyAlpha, Vector<uint8_t>& data); - // Processes the given image data in preparation for uploading - // via texImage2D or texSubImage2D. The input data must be in - // 4-component format with the alpha channel last (i.e., RGBA - // or BGRA), tightly packed, with no space between rows. - - enum AlphaOp { - kAlphaDoNothing = 0, - kAlphaDoPremultiply = 1, - kAlphaDoUnmultiply = 2 + // Flips the given image data vertically, in-place. + void flipVertically(void* imageData, + unsigned int width, + unsigned int height, + unsigned int bytesPerPixel, + unsigned int unpackAlignment); + + // Attempt to enumerate all possible native image formats to + // reduce the amount of temporary allocations during texture + // uploading. This enum must be public because it is accessed + // by non-member functions. + enum SourceDataFormat { + kSourceFormatRGBA8, + kSourceFormatRGB8, + kSourceFormatBGRA8 }; - void processImageData(uint8_t* imageData, - unsigned width, - unsigned height, - bool flipVertically, - AlphaOp alphaOp); - - bool isGLES2Compliant() const; - //---------------------------------------------------------------------- // Entry points for WebGL. // @@ -693,33 +725,49 @@ namespace WebCore { private: GraphicsContext3D(Attributes attrs, HostWindow* hostWindow); - // Helpers for texture uploading. - void premultiplyAlpha(unsigned char* rgbaData, int numPixels); - void unmultiplyAlpha(uint8_t* imageData, int numPixels); - // Each platform must provide an implementation of this method. // - // Gets the data for the given Image into outputVector, - // without doing any processing of the data (vertical flip or - // otherwise). - // - // premultiplyAlpha indicates whether the user will eventually - // want the alpha channel multiplied into the color channels. - // - // The out parameter hasAlphaChannel indicates whether the - // image actually had an alpha channel. + // Gets the data for the given Image into outputVector in the + // format specified by the (OpenGL-style) format and type + // arguments. Despite the fact that the outputVector contains + // uint8_t, if the format and type specify packed pixels, then + // it will essentially contain uint16_t after the extraction + // process. // - // The out parameter neededAlphaOp should be passed to a - // subsequent call of processImageData. + // If premultiplyAlpha is true, the alpha channel, if any, + // will be multiplied into the color channels during the + // extraction process. This premultiplication occurs before + // any packing of pixel data. // - // The out parameter format should be passed to subsequent - // invocations of texImage2D and texSubImage2D. + // No vertical flip of the image data is performed by this + // method. bool getImageData(Image* image, - Vector<uint8_t>& outputVector, + unsigned int format, + unsigned int type, bool premultiplyAlpha, - bool* hasAlphaChannel, - AlphaOp* neededAlphaOp, - unsigned int* format); + Vector<uint8_t>& outputVector); + + // Possible alpha operations that may need to occur during + // pixel packing. FIXME: kAlphaDoUnmultiply is lossy and must + // be removed. + enum AlphaOp { + kAlphaDoNothing = 0, + kAlphaDoPremultiply = 1, + kAlphaDoUnmultiply = 2 + }; + + // Helper for getImageData which implements packing of pixel + // data into the specified OpenGL destination format and type. + // Source data must be in RGBA format with no gaps between + // rows. Destination data will have no gaps between rows. + bool packPixels(const uint8_t* sourceData, + SourceDataFormat sourceDataFormat, + unsigned int width, + unsigned int height, + unsigned int destinationFormat, + unsigned int destinationType, + AlphaOp alphaOp, + void* destinationData); #if PLATFORM(MAC) // Take into account the user's requested context creation attributes, @@ -736,6 +784,7 @@ namespace WebCore { Vector<Vector<float> > m_vertexArray; CGLContextObj m_contextObj; + RetainPtr<WebGLLayer> m_webGLLayer; GLuint m_texture; GLuint m_fbo; GLuint m_depthStencilBuffer; diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h index baa3392..6bf465b 100644 --- a/WebCore/platform/graphics/GraphicsContextPrivate.h +++ b/WebCore/platform/graphics/GraphicsContextPrivate.h @@ -72,7 +72,7 @@ namespace WebCore { bool paintingDisabled; - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; diff --git a/WebCore/platform/graphics/GraphicsLayer.h b/WebCore/platform/graphics/GraphicsLayer.h index 340b911..4338d89 100644 --- a/WebCore/platform/graphics/GraphicsLayer.h +++ b/WebCore/platform/graphics/GraphicsLayer.h @@ -33,9 +33,6 @@ #include "FloatPoint.h" #include "FloatPoint3D.h" #include "FloatSize.h" -#if ENABLE(3D_CANVAS) -#include "GraphicsContext3D.h" -#endif #include "GraphicsLayerClient.h" #include "IntRect.h" #include "TransformationMatrix.h" @@ -281,6 +278,8 @@ public: virtual void setNeedsDisplay() = 0; // mark the given rect (in layer coords) as needing dispay. Never goes deep. virtual void setNeedsDisplayInRect(const FloatRect&) = 0; + + virtual void setContentsNeedsDisplay() { }; // Set that the position/size of the contents (image or video). IntRect contentsRect() const { return m_contentsRect; } @@ -302,8 +301,7 @@ public: virtual void setContentsBackgroundColor(const Color&) { } #if ENABLE(3D_CANVAS) - virtual void setContentsToGraphicsContext3D(const GraphicsContext3D*) { } - virtual void setGraphicsContext3DNeedsDisplay() { } + virtual void setContentsToWebGL(PlatformLayer*) { } #endif // Callback from the underlying graphics system to draw layer contents. void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip); diff --git a/WebCore/platform/graphics/Icon.h b/WebCore/platform/graphics/Icon.h index 59c732f..3390679 100644 --- a/WebCore/platform/graphics/Icon.h +++ b/WebCore/platform/graphics/Icon.h @@ -40,7 +40,7 @@ typedef struct HICON__* HICON; #elif PLATFORM(GTK) typedef struct _GdkPixbuf GdkPixbuf; #elif PLATFORM(EFL) -#include <Evas.h> +typedef struct _Evas_Object Evas_Object; #elif PLATFORM(CHROMIUM) #include "PlatformIcon.h" #endif diff --git a/WebCore/platform/graphics/IntRect.h b/WebCore/platform/graphics/IntRect.h index 5c5eae1..ad90dd9 100644 --- a/WebCore/platform/graphics/IntRect.h +++ b/WebCore/platform/graphics/IntRect.h @@ -51,8 +51,6 @@ QT_END_NAMESPACE typedef struct _GdkRectangle GdkRectangle; #elif PLATFORM(HAIKU) class BRect; -#elif PLATFORM(EFL) -#include <Evas.h> #endif #if PLATFORM(WX) @@ -155,9 +153,6 @@ public: #elif PLATFORM(HAIKU) explicit IntRect(const BRect&); operator BRect() const; -#elif PLATFORM(EFL) - explicit IntRect(const Eina_Rectangle&); - operator Eina_Rectangle() const; #endif #if PLATFORM(CG) diff --git a/WebCore/platform/graphics/TextRun.h b/WebCore/platform/graphics/TextRun.h index 03d7b9f..b5cd42a 100644 --- a/WebCore/platform/graphics/TextRun.h +++ b/WebCore/platform/graphics/TextRun.h @@ -39,6 +39,7 @@ public: , m_len(len) , m_xpos(xpos) , m_padding(padding) + , m_glyphScale(1.0f) , m_allowTabs(allowTabs) , m_rtl(rtl) , m_directionalOverride(directionalOverride) @@ -58,6 +59,7 @@ public: , m_len(s.length()) , m_xpos(xpos) , m_padding(padding) + , m_glyphScale(1.0f) , m_allowTabs(allowTabs) , m_rtl(rtl) , m_directionalOverride(directionalOverride) @@ -79,6 +81,9 @@ public: void setText(const UChar* c, int len) { m_characters = c; m_len = len; } + float glyphScale() const { return m_glyphScale; } + void setGlyphScale(float scale) { m_glyphScale = scale; } + bool allowTabs() const { return m_allowTabs; } int xPos() const { return m_xpos; } int padding() const { return m_padding; } @@ -88,6 +93,7 @@ public: bool applyRunRounding() const { return m_applyRunRounding; } bool applyWordRounding() const { return m_applyWordRounding; } bool spacingDisabled() const { return m_disableSpacing; } + bool applyGlyphScaling() const { return m_glyphScale != 1.0f; } void disableSpacing() { m_disableSpacing = true; } void disableRoundingHacks() { m_applyRunRounding = m_applyWordRounding = false; } @@ -108,6 +114,7 @@ private: int m_xpos; int m_padding; + float m_glyphScale; bool m_allowTabs; bool m_rtl; bool m_directionalOverride; diff --git a/WebCore/platform/graphics/WidthIterator.cpp b/WebCore/platform/graphics/WidthIterator.cpp index 996ce40..0814d48 100644 --- a/WebCore/platform/graphics/WidthIterator.cpp +++ b/WebCore/platform/graphics/WidthIterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Holger Hans Peter Freyther * * This library is free software; you can redistribute it and/or @@ -60,15 +60,16 @@ WidthIterator::WidthIterator(const Font* font, const TextRun& run, HashSet<const if (!m_padding) m_padPerSpace = 0; else { - float numSpaces = 0; - for (int i = 0; i < run.length(); i++) + int numSpaces = 0; + for (int i = 0; i < run.length(); i++) { if (Font::treatAsSpace(m_run[i])) numSpaces++; + } - if (numSpaces == 0) + if (!numSpaces) m_padPerSpace = 0; else - m_padPerSpace = ceilf(m_run.padding() / numSpaces); + m_padPerSpace = m_padding / numSpaces; } } @@ -133,6 +134,11 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) width = tabWidth - fmodf(m_run.xPos() + runWidthSoFar, tabWidth); } else { width = fontData->widthForGlyph(glyph); + + // SVG uses glyphScale(), when textLength is used to stretch/squeeze text. + if (m_run.applyGlyphScaling()) + width *= m_run.glyphScale(); + // We special case spaces in two ways when applying word rounding. // First, we round spaces to an adjusted width in all fonts. // Second, in fixed-pitch fonts we ensure that all characters that @@ -170,8 +176,9 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) width += m_padding; m_padding = 0; } else { - width += m_padPerSpace; + float previousPadding = m_padding; m_padding -= m_padPerSpace; + width += roundf(previousPadding) - roundf(m_padding); } } diff --git a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp index fceeea1..cb54549 100644 --- a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp +++ b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp @@ -88,7 +88,8 @@ static bool isWellKnownFontName(const AtomicString family) // Fonts that are used by layout tests included. The fact that // they are used in Layout Tests indicate web compatibility issues // if we do not handle them correctly. - if (equalIgnoringCase(family, "sans-serif") || equalIgnoringCase(family, "serif") + if (equalIgnoringCase(family, "sans-serif") || equalIgnoringCase(family, "sans") + || equalIgnoringCase(family, "serif") || equalIgnoringCase(family, "mono") || equalIgnoringCase(family, "monospace") || equalIgnoringCase(family, "cursive") || equalIgnoringCase(family, "fantasy") || equalIgnoringCase(family, "Times") || equalIgnoringCase(family, "Courier") || equalIgnoringCase(family, "Helvetica") @@ -118,9 +119,6 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(fcfamily))) return 0; - FcConfigSubstitute(0, pattern.get(), FcMatchPattern); - FcDefaultSubstitute(pattern.get()); - GOwnPtr<FcObjectSet> objectSet(FcObjectSetCreate()); if (!FcObjectSetAdd(objectSet.get(), FC_FAMILY)) return 0; diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp index 2a2d4a7..93051cb 100644 --- a/WebCore/platform/graphics/cairo/FontCairo.cpp +++ b/WebCore/platform/graphics/cairo/FontCairo.cpp @@ -70,7 +70,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons } // Text shadow, inspired by FontMac - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur = 0; Color shadowColor; bool hasShadow = context->textDrawingMode() == cTextFill && diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 083497f..50564c5 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -143,7 +143,7 @@ static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr)); } -void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, float shadowBlur) +void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const FloatSize& shadowSize, float shadowBlur) { #if ENABLE(FILTERS) // calculate the kernel size according to the HTML5 canvas shadow specification @@ -161,7 +161,7 @@ void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPrivate* gcp, bool fillShadow, bool strokeShadow) { #if ENABLE(FILTERS) - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (!context->getShadow(shadowSize, shadowBlur, shadowColor)) @@ -559,7 +559,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) static void drawBorderlessRectShadow(GraphicsContext* context, const FloatRect& rect, const Color& rectColor) { #if ENABLE(FILTERS) - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; @@ -841,7 +841,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer notImplemented(); } -void GraphicsContext::setPlatformShadow(IntSize const& size, float, Color const&, ColorSpace) +void GraphicsContext::setPlatformShadow(FloatSize const& size, float, Color const&, ColorSpace) { // Cairo doesn't support shadows natively, they are drawn manually in the draw* // functions @@ -849,7 +849,7 @@ void GraphicsContext::setPlatformShadow(IntSize const& size, float, Color const& if (m_common->state.shadowsIgnoreTransforms) { // Meaning that this graphics context is associated with a CanvasRenderingContext // We flip the height since CG and HTML5 Canvas have opposite Y axis - m_common->state.shadowSize = IntSize(size.width(), -size.height()); + m_common->state.shadowSize = FloatSize(size.width(), -size.height()); } } diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp index 92394b3..64fbedf 100644 --- a/WebCore/platform/graphics/cairo/ImageCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp @@ -134,7 +134,7 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo // Draw the shadow #if ENABLE(FILTERS) - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp index c6a8f83..5c03a86 100644 --- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp @@ -39,11 +39,10 @@ namespace WebCore { bool GraphicsContext3D::getImageData(Image* image, - Vector<uint8_t>& outputVector, + unsigned int format, + unsigned int type, bool premultiplyAlpha, - bool* hasAlphaChannel, - AlphaOp* neededAlphaOp, - unsigned int* format) + Vector<uint8_t>& outputVector) { if (!image) return false; @@ -52,16 +51,10 @@ bool GraphicsContext3D::getImageData(Image* image, return false; int width = CGImageGetWidth(cgImage); int height = CGImageGetHeight(cgImage); - int rowBytes = width * 4; - CGImageAlphaInfo info = CGImageGetAlphaInfo(cgImage); - *hasAlphaChannel = (info != kCGImageAlphaNone - && info != kCGImageAlphaNoneSkipLast - && info != kCGImageAlphaNoneSkipFirst); - if (!premultiplyAlpha && *hasAlphaChannel) - // FIXME: must fetch the image data before the premultiplication step - *neededAlphaOp = kAlphaDoUnmultiply; - *format = RGBA; - outputVector.resize(height * rowBytes); + // FIXME: we should get rid of this temporary copy where possible. + int tempRowBytes = width * 4; + Vector<uint8_t> tempVector; + tempVector.resize(height * tempRowBytes); // Try to reuse the color space from the image to preserve its colors. // Some images use a color space (such as indexed) unsupported by the bitmap context. CGColorSpaceRef colorSpace = CGImageGetColorSpace(cgImage); @@ -79,20 +72,36 @@ bool GraphicsContext3D::getImageData(Image* image, releaseColorSpace = true; break; } - CGContextRef tmpContext = CGBitmapContextCreate(outputVector.data(), - width, height, 8, rowBytes, - colorSpace, - kCGImageAlphaPremultipliedLast); + CGContextRef tempContext = CGBitmapContextCreate(tempVector.data(), + width, height, 8, tempRowBytes, + colorSpace, + // FIXME: change this! + kCGImageAlphaPremultipliedLast); if (releaseColorSpace) CGColorSpaceRelease(colorSpace); - if (!tmpContext) + if (!tempContext) return false; - CGContextSetBlendMode(tmpContext, kCGBlendModeCopy); - CGContextDrawImage(tmpContext, + CGContextSetBlendMode(tempContext, kCGBlendModeCopy); + CGContextDrawImage(tempContext, CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)), cgImage); - CGContextRelease(tmpContext); - return true; + CGContextRelease(tempContext); + // Pack the pixel data into the output vector. + unsigned long componentsPerPixel, bytesPerComponent; + if (!computeFormatAndTypeParameters(format, type, &componentsPerPixel, &bytesPerComponent)) + return false; + int rowBytes = width * componentsPerPixel * bytesPerComponent; + outputVector.resize(height * rowBytes); + CGImageAlphaInfo info = CGImageGetAlphaInfo(cgImage); + bool hasAlphaChannel = (info != kCGImageAlphaNone + && info != kCGImageAlphaNoneSkipLast + && info != kCGImageAlphaNoneSkipFirst); + AlphaOp neededAlphaOp = kAlphaDoNothing; + if (!premultiplyAlpha && hasAlphaChannel) + // FIXME: must fetch the image data before the premultiplication step. + neededAlphaOp = kAlphaDoUnmultiply; + return packPixels(tempVector.data(), kSourceFormatRGBA8, width, height, + format, type, neededAlphaOp, outputVector.data()); } diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index c69f222..5a903dc 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -764,7 +764,7 @@ void GraphicsContext::endTransparencyLayer() m_data->m_userToDeviceTransformKnownToBeIdentity = false; } -void GraphicsContext::setPlatformShadow(const IntSize& offset, float blur, const Color& color, ColorSpace colorSpace) +void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace) { if (paintingDisabled()) return; diff --git a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp index 48cf9d2..5b8bad3 100644 --- a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp @@ -273,7 +273,7 @@ bool TransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs, // If there is a non-blur shadow and both the fill color and shadow color // are opaque, handle without skia. - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (m_graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -434,7 +434,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, } FloatRect Font::selectionRectForComplexText(const TextRun& run, - const IntPoint& point, + const FloatPoint& point, int h, int from, int to) const @@ -445,10 +445,10 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, // If the text is RTL, left will actually be after right. if (left < right) - return FloatRect(left, static_cast<float>(point.y()), + return FloatRect(left, point.y(), right - left, static_cast<float>(h)); - return FloatRect(right, static_cast<float>(point.y()), + return FloatRect(right, point.y(), left - right, static_cast<float>(h)); } @@ -483,7 +483,7 @@ void Font::drawComplexText(GraphicsContext* graphicsContext, // If there is a non-blur shadow and both the fill color and shadow color // are opaque, handle without skia. - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor) && windowsCanHandleDrawTextShadow(graphicsContext)) { @@ -509,9 +509,13 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return static_cast<float>(state.width()); } -int Font::offsetForPositionForComplexText(const TextRun& run, int x, +int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const { + // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers + // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem. + int x = static_cast<int>(xFloat); + // Mac code ignores includePartialGlyphs, and they don't know what it's // supposed to do, so we just ignore it as well. UniscribeHelperTextRun state(run, *this); diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp index 700b3ed..a2098a4 100644 --- a/WebCore/platform/graphics/chromium/FontLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontLinux.cpp @@ -171,10 +171,9 @@ public: memset(&m_item, 0, sizeof(m_item)); // We cannot know, ahead of time, how many glyphs a given script run // will produce. We take a guess that script runs will not produce more - // than twice as many glyphs as there are code points and fallback if - // we find that we are wrong. - m_maxGlyphs = m_run.length() * 2; - createGlyphArrays(); + // than twice as many glyphs as there are code points plus a bit of + // padding and fallback if we find that we are wrong. + createGlyphArrays((m_run.length() + 2) * 2); m_item.log_clusters = new unsigned short[m_run.length()]; @@ -258,10 +257,9 @@ public: } setupFontForScriptRun(); - - if (!shapeGlyphs()) - return false; + shapeGlyphs(); setGlyphXPositions(rtl()); + return true; } @@ -409,46 +407,34 @@ private: delete[] m_xPositions; } - bool createGlyphArrays() - { - m_item.glyphs = new HB_Glyph[m_maxGlyphs]; - m_item.attributes = new HB_GlyphAttributes[m_maxGlyphs]; - m_item.advances = new HB_Fixed[m_maxGlyphs]; - m_item.offsets = new HB_FixedPoint[m_maxGlyphs]; - // HB_FixedPoint is a struct, so we must use memset to clear it. - memset(m_item.offsets, 0, m_maxGlyphs * sizeof(HB_FixedPoint)); - m_glyphs16 = new uint16_t[m_maxGlyphs]; - m_xPositions = new SkScalar[m_maxGlyphs]; - - return m_item.glyphs - && m_item.attributes - && m_item.advances - && m_item.offsets - && m_glyphs16 - && m_xPositions; - } - - bool expandGlyphArrays() + void createGlyphArrays(int size) { - deleteGlyphArrays(); - m_maxGlyphs <<= 1; - return createGlyphArrays(); + m_item.glyphs = new HB_Glyph[size]; + memset(m_item.glyphs, 0, size * sizeof(HB_Glyph)); + m_item.attributes = new HB_GlyphAttributes[size]; + memset(m_item.attributes, 0, size * sizeof(HB_GlyphAttributes)); + m_item.advances = new HB_Fixed[size]; + memset(m_item.advances, 0, size * sizeof(HB_Fixed)); + m_item.offsets = new HB_FixedPoint[size]; + memset(m_item.offsets, 0, size * sizeof(HB_FixedPoint)); + + m_glyphs16 = new uint16_t[size]; + m_xPositions = new SkScalar[size]; + + m_item.num_glyphs = size; } - bool shapeGlyphs() + void shapeGlyphs() { for (;;) { - m_item.num_glyphs = m_maxGlyphs; - HB_ShapeItem(&m_item); - if (m_item.num_glyphs < m_maxGlyphs) + if (HB_ShapeItem(&m_item)) break; // We overflowed our arrays. Resize and retry. - if (!expandGlyphArrays()) - return false; + // HB_ShapeItem fills in m_item.num_glyphs with the needed size. + deleteGlyphArrays(); + createGlyphArrays(m_item.num_glyphs); } - - return true; } void setGlyphXPositions(bool isRTL) @@ -478,7 +464,6 @@ private: unsigned m_offsetX; // Offset in pixels to the start of the next script run. unsigned m_pixelWidth; // Width (in px) of the current script run. unsigned m_numCodePoints; // Code points in current script run. - unsigned m_maxGlyphs; // Current size of all the Harfbuzz arrays. OwnPtr<TextRun> m_normalizedRun; OwnArrayPtr<UChar> m_normalizedBuffer; // A buffer for normalized run. @@ -564,9 +549,13 @@ static int glyphIndexForXPositionInScriptRun(const TextRunWalker& walker, int x) } // Return the code point index for the given |x| offset into the text run. -int Font::offsetForPositionForComplexText(const TextRun& run, int x, +int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const { + // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers + // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem. + int x = static_cast<int>(xFloat); + // (Mac code ignores includePartialGlyphs, and they don't know what it's // supposed to do, so we just ignore it as well.) TextRunWalker walker(run, 0, this); @@ -641,7 +630,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int x, // Return the rectangle for selecting the given range of code-points in the TextRun. FloatRect Font::selectionRectForComplexText(const TextRun& run, - const IntPoint& point, int height, + const FloatPoint& point, int height, int from, int to) const { int fromX = -1, toX = -1, fromAdvance = -1, toAdvance = -1; diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h index 25c9cf8..40e7bcf 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h +++ b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h @@ -29,8 +29,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FontPlatformDataWin_h -#define FontPlatformDataWin_h +#ifndef FontPlatformDataChromiumWin_h +#define FontPlatformDataChromiumWin_h #include "config.h" @@ -131,4 +131,4 @@ private: } // WebCore -#endif // FontPlatformDataWin_h +#endif // FontPlatformDataChromiumWin_h diff --git a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.h b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.h index 6a964c4..b637ede 100644 --- a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.h +++ b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.h @@ -33,8 +33,8 @@ // FIXME: Move all methods to the files that have their callsites and remove this file. // *Utils files are not very WebKit-ty. -#ifndef FontUtilsWin_h -#define FontUtilsWin_h +#ifndef FontUtilsChromiumWin_h +#define FontUtilsChromiumWin_h #include <usp10.h> #include <wchar.h> @@ -93,4 +93,4 @@ int getStyleFromLogfont(const LOGFONT*); } // namespace WebCore -#endif // FontUtilsWin_h +#endif // FontUtilsChromiumWin_h diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp index 23aeefa..b26565c 100644 --- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp @@ -48,9 +48,11 @@ #include "FloatConversion.h" #include "FloatRect.h" #include "Image.h" +#include "ImageLayerChromium.h" #include "LayerChromium.h" #include "PlatformString.h" #include "SystemTime.h" +#include "TransformLayerChromium.h" #include <wtf/CurrentTime.h> #include <wtf/StringExtras.h> #include <wtf/text/CString.h> @@ -94,7 +96,7 @@ GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client) , m_contentsLayerPurpose(NoContentsLayer) , m_contentsLayerHasBackgroundColor(false) { - m_layer = LayerChromium::create(LayerChromium::Layer, this); + m_layer = LayerChromium::create(this); updateDebugIndicators(); } @@ -307,18 +309,25 @@ void GraphicsLayerChromium::setContentsToImage(Image* image) { bool childrenChanged = false; if (image) { - m_pendingContentsImage = image->nativeImageForCurrentFrame(); - m_contentsLayerPurpose = ContentsLayerForImage; - if (!m_contentsLayer) + NativeImagePtr nativeImage = image->nativeImageForCurrentFrame(); + if (!m_contentsLayer.get() || m_contentsLayerPurpose != ContentsLayerForImage) { + RefPtr<ImageLayerChromium> imageLayer = ImageLayerChromium::create(this); + setupContentsLayer(imageLayer.get()); + m_contentsLayer = imageLayer; + m_contentsLayerPurpose = ContentsLayerForImage; childrenChanged = true; + } + ImageLayerChromium* imageLayer = static_cast<ImageLayerChromium*>(m_contentsLayer.get()); + imageLayer->setContents(nativeImage); + updateContentsRect(); } else { - m_pendingContentsImage = 0; - m_contentsLayerPurpose = NoContentsLayer; - if (m_contentsLayer) + if (m_contentsLayer) { childrenChanged = true; - } - updateContentsImage(); + // The old contents layer will be removed via updateSublayerList. + m_contentsLayer = 0; + } + } if (childrenChanged) updateSublayerList(); @@ -476,7 +485,7 @@ void GraphicsLayerChromium::updateLayerPreserves3D() { if (m_preserves3D && !m_transformLayer) { // Create the transform layer. - m_transformLayer = LayerChromium::create(LayerChromium::TransformLayer, this); + m_transformLayer = TransformLayerChromium::create(this); // Copy the position from this layer. updateLayerPosition(); @@ -540,26 +549,6 @@ void GraphicsLayerChromium::updateLayerBackgroundColor() clearLayerBackgroundColor(*m_contentsLayer); } -void GraphicsLayerChromium::updateContentsImage() -{ - if (m_pendingContentsImage) { - if (!m_contentsLayer.get()) { - RefPtr<LayerChromium> imageLayer = LayerChromium::create(LayerChromium::Layer, this); - - setupContentsLayer(imageLayer.get()); - m_contentsLayer = imageLayer; - // m_contentsLayer will be parented by updateSublayerList. - } - m_contentsLayer->setContents(m_pendingContentsImage); - m_pendingContentsImage = 0; - - updateContentsRect(); - } else { - // No image. m_contentsLayer will be removed via updateSublayerList. - m_contentsLayer = 0; - } -} - void GraphicsLayerChromium::updateContentsVideo() { // FIXME: Implement diff --git a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h index bc86799..0c84c80 100644 --- a/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h +++ b/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h @@ -135,13 +135,12 @@ private: enum ContentsLayerPurpose { NoContentsLayer = 0, ContentsLayerForImage, - ContentsLayerForVideo + ContentsLayerForVideo, + ContentsLayerForWebGL }; ContentsLayerPurpose m_contentsLayerPurpose; bool m_contentsLayerHasBackgroundColor : 1; - - NativeImagePtr m_pendingContentsImage; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp new file mode 100644 index 0000000..7905601 --- /dev/null +++ b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "ImageLayerChromium.h" + +#if PLATFORM(SKIA) +#include "NativeImageSkia.h" +#include "PlatformContextSkia.h" +#endif + +namespace WebCore { + +PassRefPtr<ImageLayerChromium> ImageLayerChromium::create(GraphicsLayerChromium* owner) +{ + return adoptRef(new ImageLayerChromium(owner)); +} + +ImageLayerChromium::ImageLayerChromium(GraphicsLayerChromium* owner) + : LayerChromium(owner) + , m_contents(0) +{ +} + +void ImageLayerChromium::setContents(NativeImagePtr contents) +{ + // Check if the image has changed. + if (m_contents == contents) + return; + m_contents = contents; + setNeedsDisplay(); +} + +void ImageLayerChromium::updateTextureContents(unsigned textureId) +{ + void* pixels = 0; + IntRect dirtyRect(m_dirtyRect); + IntSize requiredTextureSize; + IntSize bitmapSize; + +#if PLATFORM(SKIA) + // The layer contains an Image. + NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(m_contents); + const SkBitmap* skiaBitmap = skiaImage; + requiredTextureSize = IntSize(skiaBitmap->width(), skiaBitmap->height()); + ASSERT(skiaBitmap); + + SkAutoLockPixels lock(*skiaBitmap); + SkBitmap::Config skiaConfig = skiaBitmap->config(); + // FIXME: do we need to support more image configurations? + if (skiaConfig == SkBitmap::kARGB_8888_Config) { + pixels = skiaBitmap->getPixels(); + bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height()); + } +#else +#error "Need to implement for your platform." +#endif + if (pixels) + updateTextureRect(pixels, bitmapSize, requiredTextureSize, dirtyRect, textureId); +} + +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/platform/graphics/chromium/ImageLayerChromium.h b/WebCore/platform/graphics/chromium/ImageLayerChromium.h new file mode 100644 index 0000000..9355b2d --- /dev/null +++ b/WebCore/platform/graphics/chromium/ImageLayerChromium.h @@ -0,0 +1,57 @@ +/* + * 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. + */ + + +#ifndef ImageLayerChromium_h +#define ImageLayerChromium_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerChromium.h" + +namespace WebCore { + +// A Layer that contains only an Image element. +class ImageLayerChromium : public LayerChromium { +public: + static PassRefPtr<ImageLayerChromium> create(GraphicsLayerChromium* owner = 0); + virtual bool drawsContent() { return m_contents; } + virtual void updateTextureContents(unsigned textureId); + void setContents(NativeImagePtr); + +private: + ImageLayerChromium(GraphicsLayerChromium* owner); + NativeImagePtr m_contents; +}; + +} +#endif // USE(ACCELERATED_COMPOSITING) + +#endif diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp index 5e71e49..e3209a7 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -44,20 +44,20 @@ #include <GLES2/gl2.h> - namespace WebCore { using namespace std; -PassRefPtr<LayerChromium> LayerChromium::create(LayerType type, GraphicsLayerChromium* owner) +unsigned LayerChromium::m_shaderProgramId = 0; + +PassRefPtr<LayerChromium> LayerChromium::create(GraphicsLayerChromium* owner) { - return adoptRef(new LayerChromium(type, owner)); + return adoptRef(new LayerChromium(owner)); } -LayerChromium::LayerChromium(LayerType type, GraphicsLayerChromium* owner) +LayerChromium::LayerChromium(GraphicsLayerChromium* owner) : m_needsDisplayOnBoundsChange(false) , m_owner(owner) - , m_layerType(type) , m_superlayer(0) , m_layerRenderer(0) , m_borderWidth(0) @@ -71,13 +71,11 @@ LayerChromium::LayerChromium(LayerType type, GraphicsLayerChromium* owner) , m_edgeAntialiasingMask(0) , m_hidden(false) , m_masksToBounds(false) - , m_contentsGravity(Bottom) , m_opacity(1.0) , m_opaque(true) , m_zPosition(0.0) , m_geometryFlipped(false) , m_contentsDirty(false) - , m_contents(0) { } @@ -103,90 +101,94 @@ void LayerChromium::setLayerRenderer(LayerRendererChromium* renderer) m_layerRenderer = renderer; } -void LayerChromium::updateTextureContents(unsigned int textureId) +void LayerChromium::updateTextureContents(unsigned textureId) { RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client()); + if (!backing || backing->paintingGoesToWindow()) + return; + + ASSERT(drawsContent()); + + void* pixels = 0; + IntRect dirtyRect(m_dirtyRect); + IntSize requiredTextureSize; + IntSize bitmapSize; - if (backing && !backing->paintingGoesToWindow()) { - void* pixels = 0; - IntRect dirtyRect(m_dirtyRect); - IntSize requiredTextureSize; - IntSize bitmapSize; #if PLATFORM(SKIA) - const SkBitmap* skiaBitmap = 0; - OwnPtr<skia::PlatformCanvas> canvas; - OwnPtr<PlatformContextSkia> skiaContext; - OwnPtr<GraphicsContext> graphicsContext; - if (drawsContent()) { // Layer contents must be drawn into a canvas. - // Clip the dirtyRect to the size of the layer to avoid drawing outside - // the bounds of the backing texture. - dirtyRect.intersect(IntRect(IntPoint(0, 0), m_bounds)); - - canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false)); - skiaContext.set(new PlatformContextSkia(canvas.get())); - - // This is needed to get text to show up correctly. Without it, - // GDI renders with zero alpha and the text becomes invisible. - // Unfortunately, setting this to true disables cleartype. - // FIXME: Does this take us down a very slow text rendering path? - skiaContext->setDrawingToImageBuffer(true); - - graphicsContext.set(new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(skiaContext.get()))); - - // Bring the canvas into the coordinate system of the paint rect. - canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y())); - - m_owner->paintGraphicsLayerContents(*graphicsContext, dirtyRect); - const SkBitmap& bitmap = canvas->getDevice()->accessBitmap(false); - skiaBitmap = &bitmap; - requiredTextureSize = m_bounds; - } else { // Layer is a container. - // The layer contains an Image. - NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(contents()); - skiaBitmap = skiaImage; - requiredTextureSize = IntSize(skiaBitmap->width(), skiaBitmap->height()); - } - - ASSERT(skiaBitmap); - SkAutoLockPixels lock(*skiaBitmap); - SkBitmap::Config skiaConfig = skiaBitmap->config(); - // FIXME: do we need to support more image configurations? - if (skiaConfig == SkBitmap::kARGB_8888_Config) { - pixels = skiaBitmap->getPixels(); - bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height()); - } + const SkBitmap* skiaBitmap = 0; + OwnPtr<skia::PlatformCanvas> canvas; + OwnPtr<PlatformContextSkia> skiaContext; + OwnPtr<GraphicsContext> graphicsContext; + + requiredTextureSize = m_bounds; + IntRect boundsRect(IntPoint(0, 0), m_bounds); + + // If the texture needs to be reallocated then we must redraw the entire + // contents of the layer. + if (requiredTextureSize != m_allocatedTextureSize) + dirtyRect = boundsRect; + else { + // Clip the dirtyRect to the size of the layer to avoid drawing outside + // the bounds of the backing texture. + dirtyRect.intersect(boundsRect); + } + + canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false)); + skiaContext.set(new PlatformContextSkia(canvas.get())); + + // This is needed to get text to show up correctly. Without it, + // GDI renders with zero alpha and the text becomes invisible. + // Unfortunately, setting this to true disables cleartype. + // FIXME: Does this take us down a very slow text rendering path? + skiaContext->setDrawingToImageBuffer(true); + + graphicsContext.set(new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(skiaContext.get()))); + + // Bring the canvas into the coordinate system of the paint rect. + canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y())); + + m_owner->paintGraphicsLayerContents(*graphicsContext, dirtyRect); + const SkBitmap& bitmap = canvas->getDevice()->accessBitmap(false); + skiaBitmap = &bitmap; + ASSERT(skiaBitmap); + + SkAutoLockPixels lock(*skiaBitmap); + SkBitmap::Config skiaConfig = skiaBitmap->config(); + // FIXME: do we need to support more image configurations? + if (skiaConfig == SkBitmap::kARGB_8888_Config) { + pixels = skiaBitmap->getPixels(); + bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height()); + } #else #error "Need to implement for your platform." #endif - if (pixels) { - glBindTexture(GL_TEXTURE_2D, textureId); - // If the texture id or size changed since last time then we need to tell GL - // to re-allocate a texture. - if (m_allocatedTextureId != textureId || requiredTextureSize != m_allocatedTextureSize) { - ASSERT(bitmapSize == requiredTextureSize); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); - - m_allocatedTextureId = textureId; - m_allocatedTextureSize = requiredTextureSize; - } else { - ASSERT(dirtyRect.width() <= m_allocatedTextureSize.width() && dirtyRect.height() <= m_allocatedTextureSize.height()); - ASSERT(dirtyRect.width() == bitmapSize.width() && dirtyRect.height() == bitmapSize.height()); - glTexSubImage2D(GL_TEXTURE_2D, 0, dirtyRect.x(), dirtyRect.y(), dirtyRect.width(), dirtyRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels); - } - } - } - m_contentsDirty = false; - m_dirtyRect.setSize(FloatSize()); + if (pixels) + updateTextureRect(pixels, bitmapSize, requiredTextureSize, dirtyRect, textureId); } -void LayerChromium::setContents(NativeImagePtr contents) +void LayerChromium::updateTextureRect(void* pixels, const IntSize& bitmapSize, const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId) { - // Check if the image has changed. - if (m_contents == contents) + if (!pixels) return; - m_contents = contents; - setNeedsDisplay(); + + glBindTexture(GL_TEXTURE_2D, textureId); + // If the texture id or size changed since last time then we need to tell GL + // to re-allocate a texture. + if (m_allocatedTextureId != textureId || requiredTextureSize != m_allocatedTextureSize) { + ASSERT(bitmapSize == requiredTextureSize); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + + m_allocatedTextureId = textureId; + m_allocatedTextureSize = requiredTextureSize; + } else { + ASSERT(updateRect.width() <= m_allocatedTextureSize.width() && updateRect.height() <= m_allocatedTextureSize.height()); + ASSERT(updateRect.width() == bitmapSize.width() && updateRect.height() == bitmapSize.height()); + glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels); + } + + m_dirtyRect.setSize(FloatSize()); + m_contentsDirty = false; } void LayerChromium::setNeedsCommit() @@ -331,5 +333,4 @@ void LayerChromium::setNeedsDisplay() } } - #endif // USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h index 7af7e9b..f19baea 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/WebCore/platform/graphics/chromium/LayerChromium.h @@ -52,21 +52,18 @@ class PlatformCanvas; namespace WebCore { +class GraphicsContext3D; class LayerRendererChromium; +// Base class for composited layers. The implementation covers layers that require +// a GraphicsContext to render their contents. Special layer types are derived from +// this class. class LayerChromium : public RefCounted<LayerChromium> { public: - enum LayerType { Layer, TransformLayer }; - enum FilterType { Linear, Nearest, Trilinear, Lanczos }; - enum ContentsGravityType { Center, Top, Bottom, Left, Right, TopLeft, TopRight, - BottomLeft, BottomRight, Resize, ResizeAspect, ResizeAspectFill }; - - static PassRefPtr<LayerChromium> create(LayerType, GraphicsLayerChromium* owner = 0); + static PassRefPtr<LayerChromium> create(GraphicsLayerChromium* owner = 0); ~LayerChromium(); - void display(PlatformGraphicsContext*); - void addSublayer(PassRefPtr<LayerChromium>); void insertSublayer(PassRefPtr<LayerChromium>, size_t index); void replaceSublayer(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer); @@ -93,9 +90,6 @@ public: void setClearsContext(bool clears) { m_clearsContext = clears; setNeedsCommit(); } bool clearsContext() const { return m_clearsContext; } - void setContentsGravity(ContentsGravityType gravityType) { m_contentsGravity = gravityType; setNeedsCommit(); } - ContentsGravityType contentsGravity() const { return m_contentsGravity; } - void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; setNeedsCommit(); } bool doubleSided() const { return m_doubleSided; } @@ -152,27 +146,42 @@ public: void setGeometryFlipped(bool flipped) { m_geometryFlipped = flipped; setNeedsCommit(); } bool geometryFlipped() const { return m_geometryFlipped; } - void updateTextureContents(unsigned int textureId); + virtual void updateTextureContents(unsigned textureId); bool contentsDirty() { return m_contentsDirty; } - void setContents(NativeImagePtr contents); - NativeImagePtr contents() const { return m_contents; } - void setDrawTransform(const TransformationMatrix& transform) { m_drawTransform = transform; } const TransformationMatrix& drawTransform() const { return m_drawTransform; } void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } float drawOpacity() const { return m_drawOpacity; } - bool drawsContent() { return m_owner && m_owner->drawsContent(); } + virtual bool drawsContent() { return m_owner && m_owner->drawsContent(); } + + // Return true if the layer has its own GL texture and false if the texture + // needs to be allocated by the compositor. + virtual bool ownsTexture() { return false; } + + // Returns the id of the GL texture that stores the contents of this layer. + // Derived layer classes that own their own textures should overwrite this method. + virtual unsigned textureId() { return m_allocatedTextureId; } bool preserves3D() { return m_owner && m_owner->preserves3D(); } void setLayerRenderer(LayerRendererChromium*); -private: - LayerChromium(LayerType, GraphicsLayerChromium* owner); + static void setShaderProgramId(unsigned shaderProgramId) { m_shaderProgramId = shaderProgramId; } + virtual unsigned shaderProgramId() { return m_shaderProgramId; } + +protected: + GraphicsLayerChromium* m_owner; + LayerChromium(GraphicsLayerChromium* owner); + void updateTextureRect(void* pixels, const IntSize& bitmapSize, const IntSize& requiredTextureSize, const IntRect& dirtyRect, unsigned textureId); + IntSize m_bounds; + FloatRect m_dirtyRect; + bool m_contentsDirty; + +private: void setNeedsCommit(); void setSuperlayer(LayerChromium* superlayer) { m_superlayer = superlayer; } @@ -193,17 +202,11 @@ private: Vector<RefPtr<LayerChromium> > m_sublayers; LayerChromium* m_superlayer; - GraphicsLayerChromium* m_owner; - - LayerType m_layerType; - - IntSize m_bounds; IntSize m_backingStoreSize; FloatPoint m_position; FloatPoint m_anchorPoint; Color m_backgroundColor; Color m_borderColor; - FloatRect m_dirtyRect; LayerRendererChromium* m_layerRenderer; @@ -221,9 +224,13 @@ private: float m_drawOpacity; - unsigned int m_allocatedTextureId; + unsigned m_allocatedTextureId; IntSize m_allocatedTextureSize; + // The shader program used by all layers of this type is the same. + // This static can be shadowed by derived classes to use a special shader. + static unsigned m_shaderProgramId; + bool m_clearsContext; bool m_doubleSided; bool m_hidden; @@ -232,15 +239,10 @@ private: bool m_geometryFlipped; bool m_needsDisplayOnBoundsChange; - bool m_contentsDirty; - - ContentsGravityType m_contentsGravity; - NativeImagePtr m_contents; String m_name; }; } - #endif // USE(ACCELERATED_COMPOSITING) #endif diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 73311be..dc587dd 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -38,6 +38,8 @@ #include "LayerChromium.h" #include "NotImplemented.h" #include "Page.h" +#include "TransformLayerChromium.h" +#include "WebGLLayerChromium.h" #if PLATFORM(SKIA) #include "NativeImageSkia.h" #include "PlatformContextSkia.h" @@ -104,6 +106,22 @@ static GLuint loadShaderProgram(const char* vertexShaderSource, const char* frag return programObject; } +bool LayerRendererChromium::createLayerShader(ShaderProgramType type, const char* vertexShaderSource, const char* fragmentShaderSource) +{ + unsigned programId = loadShaderProgram(vertexShaderSource, fragmentShaderSource); + ASSERT(programId); + + ShaderProgram* program = &m_shaderPrograms[type]; + + program->m_shaderProgramId = programId; + program->m_samplerLocation = glGetUniformLocation(programId, "s_texture"); + program->m_matrixLocation = glGetUniformLocation(programId, "matrix"); + program->m_alphaLocation = glGetUniformLocation(programId, "alpha"); + + return programId; +} + + static void toGLMatrix(float* flattened, const TransformationMatrix& m) { flattened[0] = m.m11(); @@ -164,6 +182,14 @@ static inline bool compareLayerZ(const LayerChromium* a, const LayerChromium* b) return transformA.m43() < transformB.m43(); } +ShaderProgram::ShaderProgram() + : m_shaderProgramId(0) + , m_samplerLocation(-1) + , m_matrixLocation(-1) + , m_alphaLocation(-1) +{ +} + PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(Page* page) { return new LayerRendererChromium(page); @@ -172,15 +198,13 @@ PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(Page* page) LayerRendererChromium::LayerRendererChromium(Page* page) : m_rootLayer(0) , m_needsDisplay(false) - , m_layerProgramObject(0) - , m_borderProgramObject(0) - , m_scrollProgramObject(0) , m_positionLocation(0) , m_texCoordLocation(1) , m_page(page) , m_rootLayerTextureWidth(0) , m_rootLayerTextureHeight(0) , m_scrollPosition(IntPoint(-1, -1)) + , m_currentShaderProgramType(NumShaderProgramTypes) { m_quadVboIds[Vertices] = m_quadVboIds[LayerElements] = 0; m_hardwareCompositing = (initGL() && initializeSharedGLObjects()); @@ -191,9 +215,11 @@ LayerRendererChromium::~LayerRendererChromium() if (m_hardwareCompositing) { makeContextCurrent(); glDeleteBuffers(3, m_quadVboIds); - glDeleteProgram(m_layerProgramObject); - glDeleteProgram(m_scrollProgramObject); - glDeleteProgram(m_borderProgramObject); + + for (int i = 0; i < NumShaderProgramTypes; i++) { + if (m_shaderPrograms[i].m_shaderProgramId) + glDeleteProgram(m_shaderPrograms[i].m_shaderProgramId); + } } // Free up all GL textures. @@ -224,7 +250,21 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size) m_rootLayerCanvasSize = size; } -void LayerRendererChromium::drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity, bool scrolling) +void LayerRendererChromium::useShaderProgram(ShaderProgramType programType) +{ + if (programType != m_currentShaderProgramType) { + ShaderProgram* program = &m_shaderPrograms[programType]; + glUseProgram(program->m_shaderProgramId); + m_currentShaderProgramType = programType; + + // Set the uniform locations matching the program. + m_samplerLocation = program->m_samplerLocation; + m_matrixLocation = program->m_matrixLocation; + m_alphaLocation = program->m_alphaLocation; + } +} + +void LayerRendererChromium::drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity) { static GLfloat glMatrix[16]; @@ -238,10 +278,9 @@ void LayerRendererChromium::drawTexturedQuad(const TransformationMatrix& matrix, toGLMatrix(&glMatrix[0], renderMatrix); - int matrixLocation = (scrolling ? m_scrollMatrixLocation : m_matrixLocation); - glUniformMatrix4fv(matrixLocation, 1, false, &glMatrix[0]); + glUniformMatrix4fv(m_matrixLocation, 1, false, &glMatrix[0]); - if (!scrolling) + if (m_alphaLocation != -1) glUniform1f(m_alphaLocation, opacity); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0); @@ -265,8 +304,8 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect& glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId); - unsigned int visibleRectWidth = visibleRect.width(); - unsigned int visibleRectHeight = visibleRect.height(); + unsigned visibleRectWidth = visibleRect.width(); + unsigned visibleRectHeight = visibleRect.height(); if (visibleRectWidth != m_rootLayerTextureWidth || visibleRectHeight != m_rootLayerTextureHeight) { m_rootLayerTextureWidth = visibleRect.width(); m_rootLayerTextureHeight = visibleRect.height(); @@ -310,10 +349,10 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect& scrolledLayerMatrix.scale3d(1, -1, 1); // Switch shaders to avoid RGB swizzling. - glUseProgram(m_scrollProgramObject); - glUniform1i(m_scrollSamplerLocation, 0); + useShaderProgram(ScrollLayerProgram); + glUniform1i(m_shaderPrograms[ScrollLayerProgram].m_samplerLocation, 0); - drawTexturedQuad(scrolledLayerMatrix, visibleRect.width(), visibleRect.height(), 1, true); + drawTexturedQuad(scrolledLayerMatrix, visibleRect.width(), visibleRect.height(), 1); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height()); @@ -349,11 +388,11 @@ void LayerRendererChromium::drawLayers(const IntRect& updateRect, const IntRect& glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Render the root layer using a quad that takes up the entire visible area of the window. - glUseProgram(m_layerProgramObject); + useShaderProgram(ContentLayerProgram); glUniform1i(m_samplerLocation, 0); TransformationMatrix layerMatrix; layerMatrix.translate3d(visibleRect.width() / 2, visibleRect.height() / 2, 0); - drawTexturedQuad(layerMatrix, visibleRect.width(), visibleRect.height(), 1, false); + drawTexturedQuad(layerMatrix, visibleRect.width(), visibleRect.height(), 1); // If culling is enabled then we will cull the backface. glCullFace(GL_BACK); @@ -442,13 +481,14 @@ void LayerRendererChromium::drawDebugBorder(LayerChromium* layer, const Transfor if (!borderColor.alpha()) return; - glUseProgram(m_borderProgramObject); + useShaderProgram(DebugBorderProgram); TransformationMatrix renderMatrix = matrix; IntSize bounds = layer->bounds(); renderMatrix.scale3d(bounds.width(), bounds.height(), 1); renderMatrix.multiply(m_projectionMatrix); toGLMatrix(&glMatrix[0], renderMatrix); - glUniformMatrix4fv(m_borderMatrixLocation, 1, false, &glMatrix[0]); + unsigned borderMatrixLocation = m_shaderPrograms[DebugBorderProgram].m_matrixLocation; + glUniformMatrix4fv(borderMatrixLocation, 1, false, &glMatrix[0]); glUniform4f(m_borderColorLocation, borderColor.red() / 255.0, borderColor.green() / 255.0, @@ -460,9 +500,6 @@ void LayerRendererChromium::drawDebugBorder(LayerChromium* layer, const Transfor // The indices for the line are stored in the same array as the triangle indices. glDrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, (void*)(6 * sizeof(unsigned short))); checkGLError(); - - // Switch back to the shader program used for layer contents. - glUseProgram(m_layerProgramObject); } // Returns true if any part of the layer falls within the visibleRect @@ -524,11 +561,9 @@ void LayerRendererChromium::updateLayersRecursive(LayerChromium* layer, const Tr // Check if the layer falls within the visible bounds of the page. bool layerVisible = isLayerVisible(layer, localMatrix, visibleRect); - bool layerHasContent = layer->drawsContent() || layer->contents(); - bool skipLayer = false; if (bounds.width() > 2048 || bounds.height() > 2048) { - if (layerHasContent) + if (layer->drawsContent()) LOG(LayerRenderer, "Skipping layer with size %d %d", bounds.width(), bounds.height()); skipLayer = true; } @@ -571,15 +606,16 @@ void LayerRendererChromium::drawLayer(LayerChromium* layer) const TransformationMatrix& localMatrix = layer->drawTransform(); IntSize bounds = layer->bounds(); - // Note that there are two types of layers: - // 1. Layers that draw their own content via the GraphicsContext (layer->drawsContent() == true). - // 2. Layers that are pure containers of images/video/etc whose content is simply - // copied into the backing texture (layer->contents() == true). - if (layer->drawsContent() || layer->contents()) { - int textureId = getTextureId(layer); - // If no texture has been created for the layer yet then create one now. - if (textureId == -1) - textureId = assignTextureForLayer(layer); + if (layer->drawsContent()) { + int textureId; + if (layer->ownsTexture()) + textureId = layer->textureId(); + else { + textureId = getTextureId(layer); + // If no texture has been created for the layer yet then create one now. + if (textureId == -1) + textureId = assignTextureForLayer(layer); + } // Redraw the contents of the layer if necessary. if (layer->contentsDirty()) { @@ -587,14 +623,19 @@ void LayerRendererChromium::drawLayer(LayerChromium* layer) layer->updateTextureContents(textureId); } + // FIXME: This is temporary until WebGL layers stop changing the current + // context. + if (layer->ownsTexture()) + makeContextCurrent(); + if (layer->doubleSided()) glDisable(GL_CULL_FACE); else glEnable(GL_CULL_FACE); glBindTexture(GL_TEXTURE_2D, textureId); - - drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), layer->drawOpacity(), false); + useShaderProgram(static_cast<ShaderProgramType>(layer->shaderProgramId())); + drawTexturedQuad(localMatrix, bounds.width(), bounds.height(), layer->drawOpacity()); } // Draw the debug border if there is one. @@ -616,14 +657,15 @@ bool LayerRendererChromium::initGL() return true; } -// Binds the given attribute name to a common location across all three programs -// used by the compositor. This allows the code to bind the attributes only once -// even when switching between programs. -void LayerRendererChromium::bindCommonAttribLocation(int location, char* attribName) +void LayerRendererChromium::bindCommonAttribLocations(ShaderProgramType program) { - glBindAttribLocation(m_layerProgramObject, location, attribName); - glBindAttribLocation(m_borderProgramObject, location, attribName); - glBindAttribLocation(m_scrollProgramObject, location, attribName); + unsigned programId = m_shaderPrograms[program].m_shaderProgramId; + glBindAttribLocation(programId, m_positionLocation, "a_position"); + glBindAttribLocation(programId, m_texCoordLocation, "a_texCoord"); + + // Re-link the program for the new attribute locations to take effect. + glLinkProgram(programId); + checkGLError(); } bool LayerRendererChromium::initializeSharedGLObjects() @@ -663,6 +705,19 @@ bool LayerRendererChromium::initializeSharedGLObjects() " gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w); \n" "} \n"; + // WebGL layers need to be flipped vertically and their colors shouldn't be + // swizzled. + char webGLFragmentShaderString[] = + "precision mediump float; \n" + "varying vec2 v_texCoord; \n" + "uniform sampler2D s_texture; \n" + "uniform float alpha; \n" + "void main() \n" + "{ \n" + " vec4 texColor = texture2D(s_texture, vec2(v_texCoord.x, 1.0 - v_texCoord.y)); \n" + " gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n" + "} \n"; + // Shaders for drawing the debug borders around the layers. char borderVertexShaderString[] = "attribute vec4 a_position; \n" @@ -692,49 +747,38 @@ bool LayerRendererChromium::initializeSharedGLObjects() 0, 1, 2, 3}; // A line path for drawing the layer border. makeContextCurrent(); - m_layerProgramObject = loadShaderProgram(vertexShaderString, fragmentShaderString); - if (!m_layerProgramObject) { - LOG_ERROR("Failed to create shader program for layers"); + + if (!createLayerShader(ContentLayerProgram, vertexShaderString, fragmentShaderString)) { + LOG_ERROR("Failed to create shader program for content layers"); return false; } + LayerChromium::setShaderProgramId(ContentLayerProgram); - m_scrollProgramObject = loadShaderProgram(vertexShaderString, scrollFragmentShaderString); - if (!m_scrollProgramObject) { + if (!createLayerShader(WebGLLayerProgram, vertexShaderString, webGLFragmentShaderString)) { + LOG_ERROR("Failed to create shader program for WebGL layers"); + return false; + } + WebGLLayerChromium::setShaderProgramId(WebGLLayerProgram); + + if (!createLayerShader(ScrollLayerProgram, vertexShaderString, scrollFragmentShaderString)) { LOG_ERROR("Failed to create shader program for scrolling layer"); return false; } - m_borderProgramObject = loadShaderProgram(borderVertexShaderString, borderFragmentShaderString); - if (!m_borderProgramObject) { + if (!createLayerShader(DebugBorderProgram, borderVertexShaderString, borderFragmentShaderString)) { LOG_ERROR("Failed to create shader program for debug borders"); return false; } - // Specify the attrib location for the position and make it the same for all three programs to + // Specify the attrib location for the position and texCoord and make it the same for all programs to // avoid binding re-binding the vertex attributes. - bindCommonAttribLocation(m_positionLocation, "a_position"); - bindCommonAttribLocation(m_texCoordLocation, "a_texCoord"); - - checkGLError(); - - // Re-link the shaders to get the new attrib location to take effect. - glLinkProgram(m_layerProgramObject); - glLinkProgram(m_borderProgramObject); - glLinkProgram(m_scrollProgramObject); - - checkGLError(); - - // Get locations of uniforms for the layer content shader program. - m_samplerLocation = glGetUniformLocation(m_layerProgramObject, "s_texture"); - m_matrixLocation = glGetUniformLocation(m_layerProgramObject, "matrix"); - m_alphaLocation = glGetUniformLocation(m_layerProgramObject, "alpha"); - - m_scrollMatrixLocation = glGetUniformLocation(m_scrollProgramObject, "matrix"); - m_scrollSamplerLocation = glGetUniformLocation(m_scrollProgramObject, "s_texture"); + bindCommonAttribLocations(ContentLayerProgram); + bindCommonAttribLocations(WebGLLayerProgram); + bindCommonAttribLocations(DebugBorderProgram); + bindCommonAttribLocations(ScrollLayerProgram); - // Get locations of uniforms for the debug border shader program. - m_borderMatrixLocation = glGetUniformLocation(m_borderProgramObject, "matrix"); - m_borderColorLocation = glGetUniformLocation(m_borderProgramObject, "color"); + // Get the location of the color uniform for the debug border shader program. + m_borderColorLocation = glGetUniformLocation(m_shaderPrograms[DebugBorderProgram].m_shaderProgramId, "color"); glGenBuffers(3, m_quadVboIds); glBindBuffer(GL_ARRAY_BUFFER, m_quadVboIds[Vertices]); diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h index a2e3427..dc7ea70 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -47,6 +47,16 @@ namespace WebCore { class GLES2Context; class Page; +class ShaderProgram { +public: + ShaderProgram(); + + unsigned m_shaderProgramId; + int m_samplerLocation; + int m_matrixLocation; + int m_alphaLocation; +}; + // Class that handles drawing of composited render layers using GL. class LayerRendererChromium : public Noncopyable { public: @@ -74,17 +84,23 @@ public: GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); } private: + enum ShaderProgramType { DebugBorderProgram, ScrollLayerProgram, ContentLayerProgram, WebGLLayerProgram, NumShaderProgramTypes }; + void updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity, const IntRect& visibleRect); void drawLayer(LayerChromium*); void drawDebugBorder(LayerChromium*, const TransformationMatrix&); - void drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity, bool scrolling); + void drawTexturedQuad(const TransformationMatrix& matrix, float width, float height, float opacity); bool isLayerVisible(LayerChromium*, const TransformationMatrix&, const IntRect& visibleRect); - void bindCommonAttribLocation(int location, char* attribName); + bool createLayerShader(ShaderProgramType, const char* vertexShaderSource, const char* fragmentShaderSource); + + void useShaderProgram(ShaderProgramType); + + void bindCommonAttribLocations(ShaderProgramType); enum VboIds { Vertices, LayerElements }; @@ -96,12 +112,9 @@ private: int getTextureId(LayerChromium*); int assignTextureForLayer(LayerChromium*); - // GL shader program object IDs. - unsigned int m_layerProgramObject; - unsigned int m_borderProgramObject; - unsigned int m_scrollProgramObject; + ShaderProgram m_shaderPrograms[NumShaderProgramTypes]; - unsigned int m_rootLayerTextureId; + unsigned m_rootLayerTextureId; int m_rootLayerTextureWidth; int m_rootLayerTextureHeight; @@ -111,13 +124,9 @@ private: int m_samplerLocation; int m_matrixLocation; int m_alphaLocation; - int m_scrollMatrixLocation; - int m_scrollSamplerLocation; - - int m_borderMatrixLocation; int m_borderColorLocation; - unsigned int m_quadVboIds[3]; + unsigned m_quadVboIds[3]; TransformationMatrix m_projectionMatrix; RefPtr<LayerChromium> m_rootLayer; @@ -128,8 +137,10 @@ private: IntPoint m_scrollPosition; bool m_hardwareCompositing; + ShaderProgramType m_currentShaderProgramType; + // Map associating layers with textures ids used by the GL compositor. - typedef HashMap<LayerChromium*, unsigned int> TextureIdMap; + typedef HashMap<LayerChromium*, unsigned> TextureIdMap; TextureIdMap m_textureIdMap; #if PLATFORM(SKIA) diff --git a/WebCore/platform/graphics/chromium/TransformLayerChromium.cpp b/WebCore/platform/graphics/chromium/TransformLayerChromium.cpp new file mode 100644 index 0000000..6427eeb --- /dev/null +++ b/WebCore/platform/graphics/chromium/TransformLayerChromium.cpp @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "TransformLayerChromium.h" + +namespace WebCore { + +PassRefPtr<TransformLayerChromium> TransformLayerChromium::create(GraphicsLayerChromium* owner) +{ + return adoptRef(new TransformLayerChromium(owner)); +} + +TransformLayerChromium::TransformLayerChromium(GraphicsLayerChromium* owner) + : LayerChromium(owner) +{ +} + +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/platform/graphics/chromium/TransformLayerChromium.h b/WebCore/platform/graphics/chromium/TransformLayerChromium.h new file mode 100644 index 0000000..3d5ce94 --- /dev/null +++ b/WebCore/platform/graphics/chromium/TransformLayerChromium.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + + +#ifndef TransformLayerChromium_h +#define TransformLayerChromium_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerChromium.h" + +namespace WebCore { + +// A Layer that doesn't draw any content but simply exists to group and +// transform its descendants. +class TransformLayerChromium : public LayerChromium { +public: + static PassRefPtr<TransformLayerChromium> create(GraphicsLayerChromium* owner = 0); + virtual bool drawsContent() { return false; } + +private: + TransformLayerChromium(GraphicsLayerChromium* owner); +}; + +} +#endif // USE(ACCELERATED_COMPOSITING) + +#endif diff --git a/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp b/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp new file mode 100644 index 0000000..6b49b9a --- /dev/null +++ b/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "WebGLLayerChromium.h" + +namespace WebCore { + +unsigned WebGLLayerChromium::m_shaderProgramId = 0; + +WebGLLayerChromium::WebGLLayerChromium(GraphicsLayerChromium* owner) + : LayerChromium(owner) + , m_context(0) + , m_textureId(0) + , m_textureChanged(false) +{ +} + +unsigned WebGLLayerChromium::textureId() +{ + return m_textureId; +} + +void WebGLLayerChromium::updateTextureContents(unsigned textureId) +{ + // FIXME: Implement +} + +void WebGLLayerChromium::setContext(const GraphicsContext3D* context) +{ + // FIXME: Implement +} + +} +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/platform/graphics/chromium/WebGLLayerChromium.h b/WebCore/platform/graphics/chromium/WebGLLayerChromium.h new file mode 100644 index 0000000..abd0c93 --- /dev/null +++ b/WebCore/platform/graphics/chromium/WebGLLayerChromium.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + + +#ifndef WebGLLayerChromium_h +#define WebGLLayerChromium_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerChromium.h" + +namespace WebCore { + +class GraphicsContext3D; + +// A Layer that contains a WebGL element. +class WebGLLayerChromium : public LayerChromium { +public: + static PassRefPtr<WebGLLayerChromium> create(GraphicsLayerChromium* owner = 0); + virtual bool drawsContent() { return m_context; } + virtual bool ownsTexture() { return true; } + virtual void updateTextureContents(unsigned); + virtual unsigned textureId(); + virtual unsigned shaderProgramId() { return m_shaderProgramId; } + + void setContext(const GraphicsContext3D* context); + + static void setShaderProgramId(unsigned shaderProgramId) { m_shaderProgramId = shaderProgramId; } + +private: + WebGLLayerChromium(GraphicsLayerChromium* owner); + GraphicsContext3D* m_context; + unsigned m_textureId; + bool m_textureChanged; + + static unsigned m_shaderProgramId; +}; + +} +#endif // USE(ACCELERATED_COMPOSITING) + +#endif diff --git a/WebCore/platform/graphics/efl/FontEfl.cpp b/WebCore/platform/graphics/efl/FontEfl.cpp index 2aeb397..96d6a7b 100644 --- a/WebCore/platform/graphics/efl/FontEfl.cpp +++ b/WebCore/platform/graphics/efl/FontEfl.cpp @@ -51,13 +51,13 @@ float Font::floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontDat return 0.0f; } -int Font::offsetForPositionForComplexText(const TextRun&, int, bool) const +int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const { notImplemented(); return 0; } -FloatRect Font::selectionRectForComplexText(const TextRun&, const IntPoint&, int, int, int) const +FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const { notImplemented(); return FloatRect(); diff --git a/WebCore/platform/graphics/filters/FEBlend.h b/WebCore/platform/graphics/filters/FEBlend.h index a387814..52de647 100644 --- a/WebCore/platform/graphics/filters/FEBlend.h +++ b/WebCore/platform/graphics/filters/FEBlend.h @@ -19,8 +19,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef SVGFEBlend_h -#define SVGFEBlend_h +#ifndef FEBlend_h +#define FEBlend_h #if ENABLE(FILTERS) #include "FilterEffect.h" @@ -65,4 +65,4 @@ namespace WebCore { #endif // ENABLE(FILTERS) -#endif // SVGFEBlend_h +#endif // FEBlend_h diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.h b/WebCore/platform/graphics/filters/FEColorMatrix.h index 104a2e8..906d0f1 100644 --- a/WebCore/platform/graphics/filters/FEColorMatrix.h +++ b/WebCore/platform/graphics/filters/FEColorMatrix.h @@ -19,8 +19,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef SVGFEColorMatrix_h -#define SVGFEColorMatrix_h +#ifndef FEColorMatrix_h +#define FEColorMatrix_h #if ENABLE(FILTERS) #include "FilterEffect.h" @@ -65,4 +65,4 @@ namespace WebCore { #endif // ENABLE(FILTERS) -#endif // SVGFEColorMatrix_h +#endif // FEColorMatrix_h diff --git a/WebCore/platform/graphics/filters/FEComponentTransfer.h b/WebCore/platform/graphics/filters/FEComponentTransfer.h index a79e5df..834d9ee 100644 --- a/WebCore/platform/graphics/filters/FEComponentTransfer.h +++ b/WebCore/platform/graphics/filters/FEComponentTransfer.h @@ -19,8 +19,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef SVGFEComponentTransfer_h -#define SVGFEComponentTransfer_h +#ifndef FEComponentTransfer_h +#define FEComponentTransfer_h #if ENABLE(FILTERS) #include "FilterEffect.h" @@ -98,4 +98,4 @@ namespace WebCore { #endif // ENABLE(FILTERS) -#endif // SVGFEComponentTransfer_h +#endif // FEComponentTransfer_h diff --git a/WebCore/platform/graphics/filters/FEComposite.h b/WebCore/platform/graphics/filters/FEComposite.h index b05cc66..11268c7 100644 --- a/WebCore/platform/graphics/filters/FEComposite.h +++ b/WebCore/platform/graphics/filters/FEComposite.h @@ -19,8 +19,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef SVGFEComposite_h -#define SVGFEComposite_h +#ifndef FEComposite_h +#define FEComposite_h #if ENABLE(FILTERS) #include "FilterEffect.h" @@ -82,4 +82,4 @@ private: #endif // ENABLE(FILTERS) -#endif // SVGFEComposite_h +#endif // FEComposite_h diff --git a/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h b/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h index 3e88f63..38f69b1 100644 --- a/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/DataSourceGStreamer.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef DATA_SOURCE_GSTREAMER_H -#define DATA_SOURCE_GSTREAMER_H +#ifndef DataSourceGStreamer_h +#define DataSourceGStreamer_h #include <glib-object.h> #include <gst/base/gstbasesrc.h> diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index 7e6b71a..29ac356 100644 --- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -276,7 +276,7 @@ bool MediaPlayerPrivateGStreamer::isAvailable() MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player) : m_player(player) , m_playBin(0) - , m_videoSink(0) + , m_webkitVideoSink(0) , m_fpsSink(0) , m_source(0) , m_seekTime(0) @@ -327,20 +327,16 @@ MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer() m_source = 0; } + if (m_videoSinkBin) { + gst_object_unref(m_videoSinkBin); + m_videoSinkBin = 0; + } + if (m_playBin) { gst_element_set_state(m_playBin, GST_STATE_NULL); gst_object_unref(GST_OBJECT(m_playBin)); } - if (m_videoSink) { - g_object_unref(m_videoSink); - m_videoSink = 0; - } - - if (m_fpsSink) { - g_object_unref(m_fpsSink); - m_fpsSink = 0; - } } void MediaPlayerPrivateGStreamer::load(const String& url) @@ -515,7 +511,7 @@ IntSize MediaPlayerPrivateGStreamer::naturalSize() const if (!hasVideo()) return IntSize(); - GstPad* pad = gst_element_get_static_pad(m_videoSink, "sink"); + GstPad* pad = gst_element_get_static_pad(m_webkitVideoSink, "sink"); if (!pad) return IntSize(); @@ -1349,7 +1345,6 @@ bool MediaPlayerPrivateGStreamer::supportsFullscreen() const return true; } - PlatformMedia MediaPlayerPrivateGStreamer::platformMedia() const { PlatformMedia p; @@ -1393,26 +1388,56 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin() g_signal_connect(m_playBin, "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this); g_signal_connect(m_playBin, "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this); - m_videoSink = webkit_video_sink_new(); + m_webkitVideoSink = webkit_video_sink_new(); + + g_signal_connect(m_webkitVideoSink, "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this); + + m_videoSinkBin = gst_bin_new("sink"); + GstElement* videoTee = gst_element_factory_make("tee", "videoTee"); + GstElement* queue = gst_element_factory_make("queue", 0); - g_object_ref_sink(m_videoSink); + // Take ownership. + g_object_ref_sink(m_videoSinkBin); + + // Build a new video sink consisting of a bin containing a tee + // (meant to distribute data to multiple video sinks) and our + // internal video sink. For fullscreen we create an autovideosink + // and initially block the data flow towards it and configure it + + gst_bin_add_many(GST_BIN(m_videoSinkBin), videoTee, queue, NULL); + + // Link a new src pad from tee to queue1. + GstPad* srcPad = gst_element_get_request_pad(videoTee, "src%d"); + GstPad* sinkPad = gst_element_get_static_pad(queue, "sink"); + gst_pad_link(srcPad, sinkPad); + gst_object_unref(GST_OBJECT(srcPad)); + gst_object_unref(GST_OBJECT(sinkPad)); WTFLogChannel* channel = getChannelFromName("Media"); if (channel->state == WTFLogChannelOn) { m_fpsSink = gst_element_factory_make("fpsdisplaysink", "sink"); if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), "video-sink")) { - g_object_set(m_fpsSink, "video-sink", m_videoSink, NULL); - g_object_ref_sink(m_fpsSink); - g_object_set(m_playBin, "video-sink", m_fpsSink, NULL); + g_object_set(m_fpsSink, "video-sink", m_webkitVideoSink, NULL); + gst_bin_add(GST_BIN(m_videoSinkBin), m_fpsSink); + gst_element_link(queue, m_fpsSink); } else { m_fpsSink = 0; - g_object_set(m_playBin, "video-sink", m_videoSink, NULL); + gst_bin_add(GST_BIN(m_videoSinkBin), m_webkitVideoSink); + gst_element_link(queue, m_webkitVideoSink); LOG_VERBOSE(Media, "Can't display FPS statistics, you need gst-plugins-bad >= 0.10.18"); } - } else - g_object_set(m_playBin, "video-sink", m_videoSink, NULL); + } else { + gst_bin_add(GST_BIN(m_videoSinkBin), m_webkitVideoSink); + gst_element_link(queue, m_webkitVideoSink); + } + + // Add a ghostpad to the bin so it can proxy to tee. + GstPad* pad = gst_element_get_static_pad(videoTee, "sink"); + gst_element_add_pad(m_videoSinkBin, gst_ghost_pad_new("sink", pad)); + gst_object_unref(GST_OBJECT(pad)); - g_signal_connect(m_videoSink, "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this); + // Set the bin as video sink of playbin. + g_object_set(m_playBin, "video-sink", m_videoSinkBin, NULL); } } diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h index 81f90b8..d65bdbc 100644 --- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h @@ -146,7 +146,8 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface { private: MediaPlayer* m_player; GstElement* m_playBin; - GstElement* m_videoSink; + GstElement* m_webkitVideoSink; + GstElement* m_videoSinkBin; GstElement* m_fpsSink; GstElement* m_source; GstClockTime m_seekTime; diff --git a/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h b/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h index f5379b6..4fb0b73 100644 --- a/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h +++ b/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _HAVE_WEBKIT_VIDEO_SINK_H -#define _HAVE_WEBKIT_VIDEO_SINK_H +#ifndef VideoSinkGStreamer_h +#define VideoSinkGStreamer_h #include <glib-object.h> #include <gst/video/gstvideosink.h> diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp index 2164db5..fae84cb 100644 --- a/WebCore/platform/graphics/gtk/FontGtk.cpp +++ b/WebCore/platform/graphics/gtk/FontGtk.cpp @@ -210,7 +210,7 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F float red, green, blue, alpha; // Text shadow, inspired by FontMac - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur = 0; Color shadowColor; bool hasShadow = context->textDrawingMode() == cTextFill && @@ -308,8 +308,12 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return width; } -int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const +int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const { + // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers + // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem. + int x = static_cast<int>(xFloat); + PangoLayout* layout = getDefaultPangoLayout(run); setPangoAttributes(this, run, layout); @@ -328,7 +332,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includ return offset; } -FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { PangoLayout* layout = getDefaultPangoLayout(run); setPangoAttributes(this, run, layout); diff --git a/WebCore/platform/graphics/haiku/FontHaiku.cpp b/WebCore/platform/graphics/haiku/FontHaiku.cpp index d4622cb..a991bfc 100644 --- a/WebCore/platform/graphics/haiku/FontHaiku.cpp +++ b/WebCore/platform/graphics/haiku/FontHaiku.cpp @@ -100,13 +100,13 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return 0; } -FloatRect Font::selectionRectForComplexText(const TextRun&, const IntPoint&, int, int, int) const +FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const { notImplemented(); return FloatRect(); } -int Font::offsetForPositionForComplexText(const TextRun&, int, bool) const +int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const { notImplemented(); return 0; diff --git a/WebCore/platform/graphics/haiku/FontPlatformData.h b/WebCore/platform/graphics/haiku/FontPlatformData.h index 9feab8e..4e86e16 100644 --- a/WebCore/platform/graphics/haiku/FontPlatformData.h +++ b/WebCore/platform/graphics/haiku/FontPlatformData.h @@ -25,8 +25,8 @@ * */ -#ifndef FontPlatformData_H -#define FontPlatformData_H +#ifndef FontPlatformData_h +#define FontPlatformData_h #include "FontDescription.h" #include "GlyphBuffer.h" diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp index 7350eeb..2f02f31 100644 --- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp +++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp @@ -536,7 +536,7 @@ void GraphicsContext::clearPlatformShadow() notImplemented(); } -void GraphicsContext::setPlatformShadow(IntSize const&, float, Color const&, ColorSpace) +void GraphicsContext::setPlatformShadow(FloatSize const&, float, Color const&, ColorSpace) { notImplemented(); } diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp index 61d5518..61c9a59 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -69,6 +69,7 @@ ComplexTextController::ComplexTextController(const Font* font, const TextRun& ru , m_glyphInCurrentRun(0) , m_characterInCurrentGlyph(0) , m_finalRoundingWidth(0) + , m_padding(run.padding()) , m_fallbackFonts(fallbackFonts) , m_minGlyphBoundingBoxX(numeric_limits<float>::max()) , m_maxGlyphBoundingBoxX(numeric_limits<float>::min()) @@ -76,26 +77,26 @@ ComplexTextController::ComplexTextController(const Font* font, const TextRun& ru , m_maxGlyphBoundingBoxY(numeric_limits<float>::min()) , m_lastRoundingGlyph(0) { - m_padding = m_run.padding(); if (!m_padding) m_padPerSpace = 0; else { - float numSpaces = 0; - for (int s = 0; s < m_run.length(); s++) + int numSpaces = 0; + for (int s = 0; s < m_run.length(); s++) { if (Font::treatAsSpace(m_run[s])) numSpaces++; + } - if (numSpaces == 0) + if (!numSpaces) m_padPerSpace = 0; else - m_padPerSpace = ceilf(m_run.padding() / numSpaces); + m_padPerSpace = m_padding / numSpaces; } collectComplexTextRuns(); adjustGlyphsAndAdvances(); } -int ComplexTextController::offsetForPosition(int h, bool includePartialGlyphs) +int ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs) { if (h >= m_totalWidth) return m_run.ltr() ? m_end : 0; @@ -115,9 +116,9 @@ int ComplexTextController::offsetForPosition(int h, bool includePartialGlyphs) CFIndex hitGlyphStart = complexTextRun.indexAt(j); CFIndex hitGlyphEnd; if (m_run.ltr()) - hitGlyphEnd = max<CFIndex>(hitGlyphStart, j + 1 < complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : complexTextRun.stringLength()); + hitGlyphEnd = max<CFIndex>(hitGlyphStart, j + 1 < complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : static_cast<CFIndex>(complexTextRun.stringLength())); else - hitGlyphEnd = max<CFIndex>(hitGlyphStart, j > 0 ? complexTextRun.indexAt(j - 1) : complexTextRun.stringLength()); + hitGlyphEnd = max<CFIndex>(hitGlyphStart, j > 0 ? complexTextRun.indexAt(j - 1) : static_cast<CFIndex>(complexTextRun.stringLength())); // FIXME: Instead of dividing the glyph's advance equally between the characters, this // could use the glyph's "ligature carets". However, there is no Core Text API to get the @@ -259,7 +260,7 @@ void ComplexTextController::collectComplexTextRuns() } if (nextGlyphData.fontData != glyphData.fontData || nextIsSmallCaps != isSmallCaps || !nextGlyphData.glyph != !glyphData.glyph) { - int itemStart = m_run.rtl() ? index + 1 : indexOfFontTransition; + int itemStart = m_run.rtl() ? index + 1 : static_cast<int>(indexOfFontTransition); int itemLength = m_run.rtl() ? indexOfFontTransition - index : index - indexOfFontTransition; collectComplexTextRunsForCharacters((isSmallCaps ? m_smallCapsBuffer.data() : cp) + itemStart, itemLength, itemStart, glyphData.glyph ? glyphData.fontData : 0); indexOfFontTransition = index; @@ -508,8 +509,9 @@ void ComplexTextController::adjustGlyphsAndAdvances() advance.width += m_padding; m_padding = 0; } else { - advance.width += m_padPerSpace; + float previousPadding = m_padding; m_padding -= m_padPerSpace; + advance.width += roundf(previousPadding) - roundf(m_padding); } } diff --git a/WebCore/platform/graphics/mac/ComplexTextController.h b/WebCore/platform/graphics/mac/ComplexTextController.h index 55cde29..b520d33 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.h +++ b/WebCore/platform/graphics/mac/ComplexTextController.h @@ -53,7 +53,7 @@ public: void advance(unsigned to, GlyphBuffer* = 0); // Compute the character offset for a given x coordinate. - int offsetForPosition(int x, bool includePartialGlyphs); + int offsetForPosition(float x, bool includePartialGlyphs); // Returns the width of everything we've consumed so far. float runWidthSoFar() const { return m_runWidthSoFar; } diff --git a/WebCore/platform/graphics/mac/FontComplexTextMac.cpp b/WebCore/platform/graphics/mac/FontComplexTextMac.cpp index b7ed0e9..05eae03 100644 --- a/WebCore/platform/graphics/mac/FontComplexTextMac.cpp +++ b/WebCore/platform/graphics/mac/FontComplexTextMac.cpp @@ -37,7 +37,7 @@ using namespace std; namespace WebCore { -FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { ComplexTextController controller(this, run); @@ -97,7 +97,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return controller.totalWidth(); } -int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const +int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const { ComplexTextController controller(this, run); return controller.offsetForPosition(x, includePartialGlyphs); diff --git a/WebCore/platform/graphics/mac/FontMac.mm b/WebCore/platform/graphics/mac/FontMac.mm index 100200a..aeb0ab2 100644 --- a/WebCore/platform/graphics/mac/FontMac.mm +++ b/WebCore/platform/graphics/mac/FontMac.mm @@ -135,7 +135,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons CGContextSetFontSize(cgContext, platformData.m_size); - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; ColorSpace fillColorSpace = context->fillColorSpace(); diff --git a/WebCore/platform/graphics/mac/FontPlatformData.h b/WebCore/platform/graphics/mac/FontPlatformData.h index 23016e7..f4c92be 100644 --- a/WebCore/platform/graphics/mac/FontPlatformData.h +++ b/WebCore/platform/graphics/mac/FontPlatformData.h @@ -51,7 +51,8 @@ class String; inline CTFontRef toCTFontRef(NSFont *nsFont) { return reinterpret_cast<CTFontRef>(nsFont); } #endif -struct FontPlatformData { +class FontPlatformData { + public: FontPlatformData(float size, bool syntheticBold, bool syntheticOblique) : m_syntheticBold(syntheticBold) , m_syntheticOblique(syntheticOblique) diff --git a/WebCore/platform/graphics/mac/FontPlatformDataMac.mm b/WebCore/platform/graphics/mac/FontPlatformDataMac.mm index 53b0282..e2ab405 100644 --- a/WebCore/platform/graphics/mac/FontPlatformDataMac.mm +++ b/WebCore/platform/graphics/mac/FontPlatformDataMac.mm @@ -53,7 +53,8 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, bool syntheticBold, bool synt FontPlatformData::FontPlatformData(const FontPlatformData& f) { - m_font = f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1) ? static_cast<const NSFont *>(CFRetain(f.m_font)) : f.m_font; + m_font = f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1) ? const_cast<NSFont *>(static_cast<const NSFont *>(CFRetain(f.m_font))) : f.m_font; + m_syntheticBold = f.m_syntheticBold; m_syntheticOblique = f.m_syntheticOblique; m_size = f.m_size; diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm index 90678b2..6457e4f 100644 --- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp +++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm @@ -29,6 +29,7 @@ #include "GraphicsContext3D.h" +#import "BlockExceptions.h" #include "CanvasObject.h" #include "ImageBuffer.h" #include "NotImplemented.h" @@ -38,6 +39,7 @@ #include "Float32Array.h" #include "WebGLFramebuffer.h" #include "Int32Array.h" +#include "WebGLLayer.h" #include "WebGLProgram.h" #include "WebGLRenderbuffer.h" #include "WebGLShader.h" @@ -146,6 +148,14 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi validateAttributes(); + // Create the WebGLLayer + BEGIN_BLOCK_OBJC_EXCEPTIONS + m_webGLLayer.adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:this]); +#ifndef NDEBUG + [m_webGLLayer.get() setName:@"WebGL Layer"]; +#endif + END_BLOCK_OBJC_EXCEPTIONS + // create a texture to render into ::glGenTextures(1, &m_texture); ::glBindTexture(GL_TEXTURE_2D, m_texture); @@ -383,8 +393,8 @@ static inline void ensureContext(CGLContextObj context) void GraphicsContext3D::prepareTexture() { + ensureContext(m_contextObj); if (m_attrs.antialias) { - ensureContext(m_contextObj); ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); ::glBlitFramebufferEXT(0, 0, m_currentWidth, m_currentHeight, 0, 0, m_currentWidth, m_currentHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h index 26a5de6..c17204f 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h @@ -89,10 +89,7 @@ public: virtual void setNeedsDisplay(); virtual void setNeedsDisplayInRect(const FloatRect&); - -#if ENABLE(3D_CANVAS) - virtual void setGraphicsContext3DNeedsDisplay(); -#endif + virtual void setContentsNeedsDisplay(); virtual void setContentsRect(const IntRect&); @@ -107,7 +104,7 @@ public: virtual void setContentsToImage(Image*); virtual void setContentsToMedia(PlatformLayer*); #if ENABLE(3D_CANVAS) - virtual void setContentsToGraphicsContext3D(const GraphicsContext3D*); + virtual void setContentsToWebGL(PlatformLayer*); #endif virtual PlatformLayer* platformLayer() const; @@ -260,7 +257,7 @@ private: void updateContentsImage(); void updateContentsMediaLayer(); #if ENABLE(3D_CANVAS) - void updateContentsGraphicsContext3D(); + void updateContentsWebGLLayer(); #endif void updateContentsRect(); void updateGeometryOrientation(); @@ -268,6 +265,7 @@ private: void updateReplicatedLayers(); void updateLayerAnimations(); + void updateContentsNeedsDisplay(); enum StructuralLayerPurpose { NoStructuralLayer = 0, @@ -306,12 +304,13 @@ private: ContentsImageChanged = 1 << 17, ContentsMediaLayerChanged = 1 << 18, #if ENABLE(3D_CANVAS) - ContentsGraphicsContext3DChanged = 1 << 19, + ContentsWebGLLayerChanged = 1 << 19, #endif ContentsRectChanged = 1 << 20, GeometryOrientationChanged = 1 << 21, MaskLayerChanged = 1 << 22, - ReplicatedLayerChanged = 1 << 23 + ReplicatedLayerChanged = 1 << 23, + ContentsNeedsDisplay = 1 << 24 }; typedef unsigned LayerChangeFlags; void noteLayerPropertyChanged(LayerChangeFlags flags); @@ -333,7 +332,7 @@ private: ContentsLayerForImage, ContentsLayerForMedia #if ENABLE(3D_CANVAS) - ,ContentsLayerForGraphicsLayer3D + , ContentsLayerForWebGL #endif }; @@ -389,11 +388,6 @@ private: Vector<FloatRect> m_dirtyRects; LayerChangeFlags m_uncommittedChanges; - -#if ENABLE(3D_CANVAS) - PlatformGraphicsContext3D m_platformGraphicsContext3D; - Platform3DObject m_platformTexture; -#endif }; } // namespace WebCore diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm index bd01353..355c023 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm @@ -31,9 +31,6 @@ #import "Animation.h" #import "BlockExceptions.h" -#if ENABLE(3D_CANVAS) -#import "Canvas3DLayer.h" -#endif #import "FloatConversion.h" #import "FloatRect.h" #import "Image.h" @@ -369,10 +366,6 @@ GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client) , m_contentsLayerPurpose(NoContentsLayer) , m_contentsLayerHasBackgroundColor(false) , m_uncommittedChanges(NoChange) -#if ENABLE(3D_CANVAS) - , m_platformGraphicsContext3D(NullPlatformGraphicsContext3D) - , m_platformTexture(NullPlatform3DObject) -#endif { BEGIN_BLOCK_OBJC_EXCEPTIONS m_layer.adoptNS([[WebLayer alloc] init]); @@ -697,6 +690,11 @@ void GraphicsLayerCA::setNeedsDisplayInRect(const FloatRect& rect) noteLayerPropertyChanged(DirtyRectsChanged); } +void GraphicsLayerCA::setContentsNeedsDisplay() +{ + noteLayerPropertyChanged(ContentsNeedsDisplay); +} + void GraphicsLayerCA::setContentsRect(const IntRect& rect) { if (rect == m_contentsRect) @@ -914,8 +912,8 @@ void GraphicsLayerCA::commitLayerChangesBeforeSublayers() updateContentsMediaLayer(); #if ENABLE(3D_CANVAS) - if (m_uncommittedChanges & ContentsGraphicsContext3DChanged) // Needs to happen before ChildrenChanged - updateContentsGraphicsContext3D(); + if (m_uncommittedChanges & ContentsWebGLLayerChanged) // Needs to happen before ChildrenChanged + updateContentsWebGLLayer(); #endif if (m_uncommittedChanges & BackgroundColorChanged) // Needs to happen before ChildrenChanged, and after updating image or video @@ -969,6 +967,9 @@ void GraphicsLayerCA::commitLayerChangesBeforeSublayers() if (m_uncommittedChanges & MaskLayerChanged) updateMaskLayer(); + if (m_uncommittedChanges & ContentsNeedsDisplay) + updateContentsNeedsDisplay(); + END_BLOCK_OBJC_EXCEPTIONS } @@ -1390,9 +1391,9 @@ void GraphicsLayerCA::updateContentsMediaLayer() } #if ENABLE(3D_CANVAS) -void GraphicsLayerCA::updateContentsGraphicsContext3D() +void GraphicsLayerCA::updateContentsWebGLLayer() { - // Canvas3D layer was set as m_contentsLayer, and will get parented in updateSublayerList(). + // WebGLLayer was set as m_contentsLayer, and will get parented in updateSublayerList(). if (m_contentsLayer) { setupContentsLayer(m_contentsLayer.get()); [m_contentsLayer.get() setNeedsDisplay]; @@ -1716,38 +1717,19 @@ void GraphicsLayerCA::pauseAnimationOnLayer(AnimatedPropertyID property, const S } #if ENABLE(3D_CANVAS) -void GraphicsLayerCA::setContentsToGraphicsContext3D(const GraphicsContext3D* graphicsContext3D) +void GraphicsLayerCA::setContentsToWebGL(PlatformLayer* webglLayer) { - PlatformGraphicsContext3D context = graphicsContext3D->platformGraphicsContext3D(); - Platform3DObject texture = graphicsContext3D->platformTexture(); - - if (context == m_platformGraphicsContext3D && texture == m_platformTexture) + if (webglLayer == m_contentsLayer) return; - m_platformGraphicsContext3D = context; - m_platformTexture = texture; - - noteSublayersChanged(); + m_contentsLayer = webglLayer; + if (m_contentsLayer && [m_contentsLayer.get() respondsToSelector:@selector(setLayerOwner:)]) + [(id)m_contentsLayer.get() setLayerOwner:this]; - BEGIN_BLOCK_OBJC_EXCEPTIONS + m_contentsLayerPurpose = webglLayer ? ContentsLayerForWebGL : NoContentsLayer; - if (m_platformGraphicsContext3D != NullPlatformGraphicsContext3D && m_platformTexture != NullPlatform3DObject) { - // create the inner 3d layer - m_contentsLayer.adoptNS([[Canvas3DLayer alloc] initWithContext:const_cast<GraphicsContext3D*>(graphicsContext3D)]); -#ifndef NDEBUG - [m_contentsLayer.get() setName:@"3D Layer"]; -#endif - [m_contentsLayer.get() setLayerOwner:this]; - } else { - // remove the inner layer - [m_contentsLayer.get() setLayerOwner:0]; - m_contentsLayer = 0; - } - - END_BLOCK_OBJC_EXCEPTIONS - - noteLayerPropertyChanged(ContentsGraphicsContext3DChanged); - m_contentsLayerPurpose = m_contentsLayer ? ContentsLayerForGraphicsLayer3D : NoContentsLayer; + noteSublayersChanged(); + noteLayerPropertyChanged(ContentsWebGLLayerChanged); } #endif @@ -1762,6 +1744,12 @@ void GraphicsLayerCA::repaintLayerDirtyRects() m_dirtyRects.clear(); } +void GraphicsLayerCA::updateContentsNeedsDisplay() +{ + if (m_contentsLayer) + [m_contentsLayer.get() setNeedsDisplay]; +} + bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& keyframesName, double timeOffset) { ASSERT(valueList.property() != AnimatedPropertyWebkitTransform); @@ -2566,14 +2554,6 @@ void GraphicsLayerCA::noteLayerPropertyChanged(LayerChangeFlags flags) m_uncommittedChanges |= flags; } -#if ENABLE(3D_CANVAS) -void GraphicsLayerCA::setGraphicsContext3DNeedsDisplay() -{ - if (m_contentsLayerPurpose == ContentsLayerForGraphicsLayer3D) - [m_contentsLayer.get() setNeedsDisplay]; -} -#endif - } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index b49c52f..c73eeea 100644 --- a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -1252,22 +1252,22 @@ static void addFileTypesToCache(NSArray * fileTypes, HashSet<String> &cache) if (!uti) continue; RetainPtr<CFStringRef> mime(AdoptCF, UTTypeCopyPreferredTagWithClass(uti.get(), kUTTagClassMIMEType)); - - // UTI types are missing many media related MIME types supported by QTKit, see rdar://6434168, - // and not all third party movie importers register their types, so if we didn't find a type for - // this extension look it up in the hard coded table in the MIME type regsitry. - if (!mime) { - // -movieFileTypes: returns both file extensions and OSTypes. The later are surrounded by single - // quotes, eg. 'MooV', so don't bother looking at those. - if (CFStringGetCharacterAtIndex(ext, 0) != '\'') { - String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtension(String(ext)); - if (!mediaType.isEmpty()) - mime.adoptCF(mediaType.createCFString()); + if (mime) + cache.add(mime.get()); + + // -movieFileTypes: returns both file extensions and OSTypes. The later are surrounded by single + // quotes, eg. 'MooV', so don't bother looking at those. + if (CFStringGetCharacterAtIndex(ext, 0) != '\'') { + // UTI is missing many media related MIME types supported by QTKit (see rdar://6434168), and not all + // web servers use the MIME type UTI returns for an extension (see rdar://7875393), so even if UTI + // has a type for this extension add any types in hard coded table in the MIME type regsitry. + Vector<String> typesForExtension = MIMETypeRegistry::getMediaMIMETypesForExtension(ext); + unsigned count = typesForExtension.size(); + for (unsigned ndx = 0; ndx < count; ++ndx) { + if (!cache.contains(typesForExtension[ndx])) + cache.add(typesForExtension[ndx]); } } - if (!mime) - continue; - cache.add(mime.get()); } } diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index 04badbe..bddb2ad 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -270,7 +270,7 @@ void SimpleFontData::platformInit() // and web pages that foolishly use this metric for width will be laid out // poorly if we return an accurate height. Classic case is Times 13 point, // which has an "x" that is 7x6 pixels. - m_xHeight = static_cast<float>(max(CGRectGetMaxX(xBox), CGRectGetMaxY(xBox))); + m_xHeight = static_cast<float>(max(CGRectGetMaxX(xBox), -CGRectGetMinY(xBox))); } else { #ifndef BUILDING_ON_TIGER m_xHeight = static_cast<float>(CGFontGetXHeight(m_platformData.cgFont())) / m_unitsPerEm; @@ -427,6 +427,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const if (!m_platformData.font()) return boundingBox; boundingBox = [m_platformData.font() boundingRectForGlyph:glyph]; + boundingBox.setY(-boundingBox.bottom()); #endif if (m_syntheticBoldOffset) boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset); diff --git a/WebCore/platform/graphics/mac/Canvas3DLayer.h b/WebCore/platform/graphics/mac/WebGLLayer.h index 4609010..6440b71 100644 --- a/WebCore/platform/graphics/mac/Canvas3DLayer.h +++ b/WebCore/platform/graphics/mac/WebGLLayer.h @@ -23,27 +23,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Canvas3DLayer_h -#define Canvas3DLayer_h +#ifndef WebGLLayer_h +#define WebGLLayer_h #if USE(ACCELERATED_COMPOSITING) -#import "WebLayer.h" +#import <QuartzCore/QuartzCore.h> namespace WebCore { class GraphicsLayer; class GraphicsContext3D; } -@interface Canvas3DLayer : CAOpenGLLayer +@interface WebGLLayer : CAOpenGLLayer { WebCore::GraphicsLayer* m_layerOwner; WebCore::GraphicsContext3D* m_context; - CGLContextObj m_contextObj; - GLuint m_texture; } -- (id)initWithContext:(WebCore::GraphicsContext3D*)context; +- (id)initWithGraphicsContext3D:(WebCore::GraphicsContext3D*)context; - (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace; @@ -51,4 +49,4 @@ namespace WebCore { #endif // USE(ACCELERATED_COMPOSITING) -#endif // Canvas3DLayer_h +#endif // WebGLLayer_h diff --git a/WebCore/platform/graphics/mac/Canvas3DLayer.mm b/WebCore/platform/graphics/mac/WebGLLayer.mm index 22a0a10..12c6f0d 100644 --- a/WebCore/platform/graphics/mac/Canvas3DLayer.mm +++ b/WebCore/platform/graphics/mac/WebGLLayer.mm @@ -28,10 +28,10 @@ #if USE(ACCELERATED_COMPOSITING) #if ENABLE(3D_CANVAS) -#import "Canvas3DLayer.h" +#import "WebGLLayer.h" +#import "GraphicsContext3D.h" #import "GraphicsLayer.h" -#import <QuartzCore/QuartzCore.h> #import <OpenGL/OpenGL.h> #import <wtf/FastMalloc.h> #import <wtf/RetainPtr.h> @@ -39,13 +39,11 @@ using namespace WebCore; -@implementation Canvas3DLayer +@implementation WebGLLayer --(id)initWithContext:(GraphicsContext3D*)context +-(id)initWithGraphicsContext3D:(GraphicsContext3D*)context { m_context = context; - m_contextObj = static_cast<CGLContextObj>(context->platformGraphicsContext3D()); - m_texture = static_cast<GLuint>(context->platformTexture()); self = [super init]; return self; } @@ -59,13 +57,13 @@ using namespace WebCore; // If needed we will have to set the display mask in the Canvas CGLContext and // make sure it matches. UNUSED_PARAM(mask); - return CGLRetainPixelFormat(CGLGetPixelFormat(m_contextObj)); + return CGLRetainPixelFormat(CGLGetPixelFormat(m_context->platformGraphicsContext3D())); } -(CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat { CGLContextObj contextObj; - CGLCreateContext(pixelFormat, m_contextObj, &contextObj); + CGLCreateContext(pixelFormat, m_context->platformGraphicsContext3D(), &contextObj); return contextObj; } @@ -86,7 +84,7 @@ using namespace WebCore; glLoadIdentity(); glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, m_texture); + glBindTexture(GL_TEXTURE_2D, m_context->platformTexture()); glBegin(GL_TRIANGLE_FAN); glTexCoord2f(0, 0); @@ -113,7 +111,7 @@ static void freeData(void *, const void *data, size_t /* size */) -(CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace { - CGLSetCurrentContext(m_contextObj); + CGLSetCurrentContext(m_context->platformGraphicsContext3D()); RetainPtr<CGColorSpaceRef> imageColorSpace = colorSpace; if (!imageColorSpace) @@ -151,7 +149,7 @@ static void freeData(void *, const void *data, size_t /* size */) @end -@implementation Canvas3DLayer(WebLayerAdditions) +@implementation WebGLLayer(WebGLLayerAdditions) -(void)setLayerOwner:(GraphicsLayer*)aLayer { diff --git a/WebCore/platform/graphics/mac/WebLayer.mm b/WebCore/platform/graphics/mac/WebLayer.mm index 641d421..0c9925e 100644 --- a/WebCore/platform/graphics/mac/WebLayer.mm +++ b/WebCore/platform/graphics/mac/WebLayer.mm @@ -193,7 +193,6 @@ using namespace WebCore; { CGRect aBounds = [self bounds]; CGPoint aPos = [self position]; - CATransform3D t = [self transform]; NSString* selfString = [NSString stringWithFormat:@"%@<%@ 0x%08x> \"%@\" bounds(%.1f, %.1f, %.1f, %.1f) pos(%.1f, %.1f), sublayers=%d masking=%d", inPrefix, diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp index 7fe160a..0faf3ce 100644 --- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp +++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp @@ -292,7 +292,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) return FloatRect(enclosingIntRect(m_data->transformation().mapRect(rect))); } -void GraphicsContext::setPlatformShadow(const IntSize& size, float blur, const Color& color, ColorSpace colorSpace) +void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const Color& color, ColorSpace colorSpace) { if (paintingDisabled()) return; diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/WebCore/platform/graphics/qt/FontCustomPlatformData.h index 4305b87..0f2a6ce 100644 --- a/WebCore/platform/graphics/qt/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/qt/FontCustomPlatformData.h @@ -19,8 +19,8 @@ This class provides all functionality needed for loading images, style sheets and html pages from the web. It has a memory cache for these objects. */ -#ifndef FontCustomPlatformData_h_ -#define FontCustomPlatformData_h_ +#ifndef FontCustomPlatformData_h +#define FontCustomPlatformData_h #include "FontRenderingMode.h" #include <wtf/Noncopyable.h> @@ -43,4 +43,4 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer); } // namespace WebCore -#endif // FontCustomPlatformData_h_ +#endif // FontCustomPlatformData_h diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp index d357a22..0c1d271 100644 --- a/WebCore/platform/graphics/qt/FontQt.cpp +++ b/WebCore/platform/graphics/qt/FontQt.cpp @@ -109,7 +109,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float QPointF pt(point.x(), point.y()); // text shadow - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; bool hasShadow = ctx->textDrawingMode() == cTextFill && ctx->getShadow(shadowSize, shadowBlur, shadowColor); @@ -234,7 +234,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return 0; if (run.length() == 1 && treatAsSpace(run[0])) - return QFontMetrics(font()).width(run[0]) - m_wordSpacing + run.padding(); + return QFontMetrics(font()).width(run[0]) + run.padding(); String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); QString string = fromRawDataWithoutRef(sanitized); @@ -247,14 +247,14 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return w + run.padding(); } -int Font::offsetForPositionForSimpleText(const TextRun& run, int position, bool includePartialGlyphs) const +int Font::offsetForPositionForSimpleText(const TextRun& run, float position, bool includePartialGlyphs) const { #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); QString string = fromRawDataWithoutRef(sanitized); QFontMetrics fm(font()); - float delta = (float)position; + float delta = position; int curPos = 0; do { float charWidth = fm.width(string[curPos]); @@ -275,7 +275,7 @@ int Font::offsetForPositionForSimpleText(const TextRun& run, int position, bool #endif } -int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool) const +int Font::offsetForPositionForComplexText(const TextRun& run, float position, bool) const { String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); QString string = fromRawDataWithoutRef(sanitized); @@ -285,7 +285,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool return line.xToCursor(position); } -FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const +FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const { #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); @@ -302,7 +302,7 @@ FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& p #endif } -FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const { String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); QString string = fromRawDataWithoutRef(sanitized); diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index e0a785e..1a51910 100644 --- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -56,8 +56,13 @@ typedef char GLchar; #define APIENTRY #endif +#ifdef QT_OPENGL_ES_2 +typedef GLsizeiptr GLsizeiptrType; +typedef GLintptr GLintptrType; +#else typedef ptrdiff_t GLsizeiptrType; typedef ptrdiff_t GLintptrType; +#endif typedef void (APIENTRY* glActiveTextureType) (GLenum); typedef void (APIENTRY* glAttachShaderType) (GLuint, GLuint); @@ -517,18 +522,10 @@ void GraphicsContext3D::makeContextCurrent() void GraphicsContext3D::beginPaint(WebGLRenderingContext* context) { m_internal->m_glWidget->makeCurrent(); - HTMLCanvasElement* canvas = context->canvas(); ImageBuffer* imageBuffer = canvas->buffer(); - - m_internal->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_internal->m_mainFbo); - - glReadPixels(/* x */ 0, /* y */ 0, m_currentWidth, m_currentHeight, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, m_internal->m_pixels.bits()); - - QPainter* p = imageBuffer->context()->platformContext(); - p->drawImage(/* x */ 0, /* y */ 0, m_internal->m_pixels.rgbSwapped().transformed(QMatrix().rotate(180))); - - m_internal->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_internal->m_currentFbo); + QPainter* painter = imageBuffer->context()->platformContext(); + paint(painter, QRect(QPoint(0, 0), QSize(m_currentWidth, m_currentHeight))); } void GraphicsContext3D::endPaint() @@ -541,7 +538,7 @@ void GraphicsContext3D::paint(QPainter* painter, const QRect& rect) const QWebPageClient* webPageClient = m_internal->m_hostWindow->platformPageClient(); QGLWidget* ownerGLWidget = m_internal->getOwnerGLWidget(webPageClient); if (ownerGLWidget) { - ownerGLWidget->drawTexture(QPointF(0, 0), m_internal->m_texture); + ownerGLWidget->drawTexture(rect, m_internal->m_texture); return; } #endif @@ -1082,12 +1079,20 @@ void GraphicsContext3D::scissor(long x, long y, unsigned long width, unsigned lo void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& source) { ASSERT(shader); - + m_internal->m_glWidget->makeCurrent(); - CString sourceCS = source.utf8(); + String prefixedSource; + +#if defined (QT_OPENGL_ES_2) + prefixedSource.append("precision mediump float;\n"); +#endif + + prefixedSource.append(source); + + CString sourceCS = prefixedSource.utf8(); const char* data = sourceCS.data(); - int length = source.length(); + int length = prefixedSource.length(); m_internal->shaderSource((GLuint) shader->object(), /* count */ 1, &data, &length); } @@ -1615,11 +1620,10 @@ void GraphicsContext3D::synthesizeGLError(unsigned long error) } bool GraphicsContext3D::getImageData(Image* image, - Vector<uint8_t>& outputVector, + unsigned int format, + unsigned int type, bool premultiplyAlpha, - bool* hasAlphaChannel, - AlphaOp* neededAlphaOp, - unsigned int* format) + Vector<uint8_t>& outputVector) { if (!image) return false; @@ -1627,17 +1631,14 @@ bool GraphicsContext3D::getImageData(Image* image, if (!nativePixmap) return false; - *hasAlphaChannel = true; - *format = GraphicsContext3D::RGBA; - - *neededAlphaOp = kAlphaDoNothing; + AlphaOp neededAlphaOp = kAlphaDoNothing; if (!premultiplyAlpha && *hasAlphaChannel) - *neededAlphaOp = kAlphaDoUnmultiply; - + // FIXME: must fetch the image data before the premultiplication step + neededAlphaOp = kAlphaDoUnmultiply; QImage nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARGB32); - outputVector.append(nativeImage.rgbSwapped().bits(), nativeImage.byteCount()); - - return true; + outputVector.resize(nativeImage.byteCount()); + return packPixels(nativeImage.rgbSwapped().bits(), kSourceFormatRGBA8, image->width(), image->height(), + format, type, neededAlphaOp, outputVector.data()); } } diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 2a7db4e..13608b2 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -69,7 +69,7 @@ namespace WebCore { -static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op) +QPainter::CompositionMode GraphicsContext::toQtCompositionMode(CompositeOperator op) { switch (op) { case CompositeClear: @@ -333,7 +333,7 @@ void GraphicsContext::drawRect(const IntRect& rect) p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); if (m_common->state.shadowColor.isValid()) { - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -371,7 +371,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); adjustLineToPixelBoundaries(p1, p2, width, style); - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -473,7 +473,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, true); - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; startAngle *= 16; @@ -508,7 +508,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points QPainter* p = m_data->p(); p->save(); p->setRenderHint(QPainter::Antialiasing, shouldAntialias); - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -539,7 +539,7 @@ QPen GraphicsContext::pen() static void inline drawFilledShadowPath(GraphicsContext* context, QPainter* p, const QPainterPath& path) { - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -586,7 +586,7 @@ void GraphicsContext::strokePath() path.setFillRule(toQtFillRule(fillRule())); if (m_common->state.strokePattern || m_common->state.strokeGradient || strokeColor().alpha()) { - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -618,7 +618,7 @@ void GraphicsContext::strokePath() static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* p, const FloatRect& rect) { - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -628,6 +628,73 @@ static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* } } +static inline void drawRepeatPattern(QPainter* p, QPixmap* image, const FloatRect& rect, const bool repeatX, const bool repeatY) +{ + // Patterns must be painted so that the top left of the first image is anchored at + // the origin of the coordinate space + if (image) { + int w = image->width(); + int h = image->height(); + int startX, startY; + QRect r(static_cast<int>(rect.x()), static_cast<int>(rect.y()), static_cast<int>(rect.width()), static_cast<int>(rect.height())); + + // startX, startY is the coordinate of the first image we need to put on the left-top of the rect + if (repeatX && repeatY) { + // repeat + // startX, startY is at the left top side of the left-top of the rect + startX = r.x() >=0 ? r.x() - (r.x() % w) : r.x() - (w - qAbs(r.x()) % w); + startY = r.y() >=0 ? r.y() - (r.y() % h) : r.y() - (h - qAbs(r.y()) % h); + } else { + if (!repeatX && !repeatY) { + // no-repeat + // only draw the image once at orgin once, check if need to draw + QRect imageRect(0, 0, w, h); + if (imageRect.intersects(r)) { + startX = 0; + startY = 0; + } else + return; + } else if (repeatX && !repeatY) { + // repeat-x + // startY is fixed, but startX change based on the left-top of the rect + QRect imageRect(r.x(), 0, r.width(), h); + if (imageRect.intersects(r)) { + startX = r.x() >=0 ? r.x() - (r.x() % w) : r.x() - (w - qAbs(r.x()) % w); + startY = 0; + } else + return; + } else { + // repeat-y + // startX is fixed, but startY change based on the left-top of the rect + QRect imageRect(0, r.y(), w, r.height()); + if (imageRect.intersects(r)) { + startX = 0; + startY = r.y() >=0 ? r.y() - (r.y() % h) : r.y() - (h - qAbs(r.y()) % h); + } else + return; + } + } + + int x = startX; + int y = startY; + do { + // repeat Y + do { + // repeat X + QRect imageRect(x, y, w, h); + QRect intersectRect = imageRect.intersected(r); + QPoint destStart(intersectRect.x(), intersectRect.y()); + QRect sourceRect(intersectRect.x() - imageRect.x(), intersectRect.y() - imageRect.y(), intersectRect.width(), intersectRect.height()); + + p->drawPixmap(destStart, *image, sourceRect); + x += w; + } while (repeatX && x < r.x() + r.width()); + x = startX; + y += h; + } while (repeatY && y < r.y() + r.height()); + } +} + void GraphicsContext::fillRect(const FloatRect& rect) { if (paintingDisabled()) @@ -644,12 +711,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine)); QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame(); - if (!m_common->state.fillPattern->repeatX() && image) - rectM.setWidth(image->width()); - if (!m_common->state.fillPattern->repeatY() && image) - rectM.setHeight(image->height()); - p->fillRect(rectM, brush); - + drawRepeatPattern(p, image, rect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY()); } else if (m_common->state.fillGradient) { QBrush brush(*m_common->state.fillGradient->platformGradient()); brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform()); @@ -820,7 +882,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect) return FloatRect(roundedOrigin, roundedLowerRight - roundedOrigin); } -void GraphicsContext::setPlatformShadow(const IntSize& size, float, const Color&, ColorSpace) +void GraphicsContext::setPlatformShadow(const FloatSize& size, float, const Color&, ColorSpace) { // Qt doesn't support shadows natively, they are drawn manually in the draw* // functions @@ -828,7 +890,7 @@ void GraphicsContext::setPlatformShadow(const IntSize& size, float, const Color& if (m_common->state.shadowsIgnoreTransforms) { // Meaning that this graphics context is associated with a CanvasRenderingContext // We flip the height since CG and HTML5 Canvas have opposite Y axis - m_common->state.shadowSize = IntSize(size.width(), -size.height()); + m_common->state.shadowSize = FloatSize(size.width(), -size.height()); } } diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index cc707da..fb3d621 100644 --- a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -78,9 +78,6 @@ void ImageDecoderQt::setData(SharedBuffer* data, bool allDataReceived) m_buffer->open(QIODevice::ReadOnly | QIODevice::Unbuffered); m_reader.set(new QImageReader(m_buffer.get(), m_format)); - // This will force the JPEG decoder to use JDCT_IFAST - m_reader->setQuality(49); - // QImageReader only allows retrieving the format before reading the image m_format = m_reader->format(); } @@ -188,9 +185,21 @@ void ImageDecoderQt::internalReadImage(size_t frameIndex) bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex) { - // Now get the QImage from Qt and place it in the RGBA32Buffer - QImage img; - if (!m_reader->read(&img)) { + QPixmap pixmap; + bool pixmapLoaded; + const int imageCount = m_reader->imageCount(); + if (imageCount == 0 || imageCount == 1) + pixmapLoaded = pixmap.loadFromData((const uchar*)(m_data->data()), m_data->size(), m_format); + else { + QImage img; + const bool imageLoaded = m_reader->read(&img); + if (imageLoaded) { + pixmap = QPixmap::fromImage(img); + pixmapLoaded = true; + } + } + + if (!pixmapLoaded) { frameCount(); repetitionCount(); clearPointers(); @@ -198,12 +207,11 @@ bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex) } // now into the RGBA32Buffer - even if the image is not - QSize imageSize = img.size(); RGBA32Buffer* const buffer = &m_frameBufferCache[frameIndex]; buffer->setRect(m_reader->currentImageRect()); buffer->setStatus(RGBA32Buffer::FrameComplete); buffer->setDuration(m_reader->nextImageDelay()); - buffer->setDecodedImage(img); + buffer->setPixmap(pixmap); return true; } diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp index 0d23738..af94f55 100644 --- a/WebCore/platform/graphics/qt/ImageQt.cpp +++ b/WebCore/platform/graphics/qt/ImageQt.cpp @@ -177,17 +177,17 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, IntSize selfSize = size(); - ctxt->save(); - - // Set the compositing operation. - ctxt->setCompositeOperation(op); - QPainter* painter(ctxt->platformContext()); + QPainter::CompositionMode compositionMode = GraphicsContext::toQtCompositionMode(op); + if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver) - painter->setCompositionMode(QPainter::CompositionMode_Source); + compositionMode = QPainter::CompositionMode_Source; + + QPainter::CompositionMode lastCompositionMode = painter->compositionMode(); + painter->setCompositionMode(compositionMode); - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; if (ctxt->getShadow(shadowSize, shadowBlur, shadowColor)) { @@ -208,7 +208,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html painter->drawPixmap(dst, *image, src); - ctxt->restore(); + painter->setCompositionMode(lastCompositionMode); if (imageObserver()) imageObserver()->didDraw(this); diff --git a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp index e76ed7b..62e2f17 100644 --- a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp @@ -38,11 +38,10 @@ namespace WebCore { bool GraphicsContext3D::getImageData(Image* image, - Vector<uint8_t>& outputVector, + unsigned int format, + unsigned int type, bool premultiplyAlpha, - bool* hasAlphaChannel, - AlphaOp* neededAlphaOp, - unsigned int* format) + Vector<uint8_t>& outputVector) { if (!image) return false; @@ -60,18 +59,12 @@ bool GraphicsContext3D::getImageData(Image* image, ASSERT(rowBytes == skiaImage->width() * 4); uint8_t* pixels = reinterpret_cast<uint8_t*>(skiaImage->getPixels()); outputVector.resize(rowBytes * height); - int size = rowBytes * height; - memcpy(outputVector.data(), pixels, size); - *hasAlphaChannel = true; + AlphaOp neededAlphaOp = kAlphaDoNothing; if (!premultiplyAlpha) // FIXME: must fetch the image data before the premultiplication step - *neededAlphaOp = kAlphaDoUnmultiply; - // Convert from BGRA to RGBA. FIXME: add GL_BGRA extension support - // to all underlying OpenGL implementations. - for (int i = 0; i < size; i += 4) - std::swap(outputVector[i], outputVector[i + 2]); - *format = RGBA; - return true; + neededAlphaOp = kAlphaDoUnmultiply; + return packPixels(pixels, kSourceFormatBGRA8, skiaImage->width(), height, + format, type, neededAlphaOp, outputVector.data()); } } // namespace WebCore diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 6ef38f0..74d0c6e 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -977,7 +977,7 @@ void GraphicsContext::setPlatformFillPattern(Pattern* pattern) platformContext()->setFillShader(pattern->platformPattern(getCTM())); } -void GraphicsContext::setPlatformShadow(const IntSize& size, +void GraphicsContext::setPlatformShadow(const FloatSize& size, float blurFloat, const Color& color, ColorSpace colorSpace) diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp index e0d2840..6595f6b 100644 --- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp +++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp @@ -222,7 +222,7 @@ void SkiaWinOutlineCache::removePathsForFont(HFONT hfont) bool windowsCanHandleDrawTextShadow(WebCore::GraphicsContext *context) { - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.h b/WebCore/platform/graphics/skia/SkiaFontWin.h index 0bad30f..4c2bb32 100644 --- a/WebCore/platform/graphics/skia/SkiaFontWin.h +++ b/WebCore/platform/graphics/skia/SkiaFontWin.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SkiaWinOutlineCache_h -#define SkiaWinOutlineCache_h +#ifndef SkiaFontWin_h +#define SkiaFontWin_h #include <windows.h> #include <usp10.h> @@ -90,4 +90,4 @@ bool paintSkiaText(GraphicsContext* graphicsContext, } // namespace WebCore -#endif // SkiaWinOutlineCache_h +#endif // SkiaFontWin_h diff --git a/WebCore/platform/graphics/win/FontCGWin.cpp b/WebCore/platform/graphics/win/FontCGWin.cpp index 83178f3..34f9b07 100644 --- a/WebCore/platform/graphics/win/FontCGWin.cpp +++ b/WebCore/platform/graphics/win/FontCGWin.cpp @@ -140,7 +140,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData drawIntoBitmap = fillColor.alpha() != 255 || graphicsContext->inTransparencyLayer(); if (!drawIntoBitmap) { - IntSize size; + FloatSize size; float blur; Color color; graphicsContext->getShadow(size, blur, color); @@ -349,7 +349,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo CGContextSetFontSize(cgContext, platformData.size()); wkSetCGContextFontRenderingStyle(cgContext, font->isSystemFont(), false, font->platformData().useGDI()); - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur; Color shadowColor; graphicsContext->getShadow(shadowSize, shadowBlur, shadowColor); diff --git a/WebCore/platform/graphics/win/FontWin.cpp b/WebCore/platform/graphics/win/FontWin.cpp index 717171f..97971dc 100644 --- a/WebCore/platform/graphics/win/FontWin.cpp +++ b/WebCore/platform/graphics/win/FontWin.cpp @@ -43,7 +43,7 @@ bool Font::canReturnFallbackFontsForComplexText() return true; } -FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { UniscribeController it(this, run); @@ -104,8 +104,12 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return controller.runWidthSoFar(); } -int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const +int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const { + // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers + // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem. + int x = static_cast<int>(xFloat); + UniscribeController controller(this, run); return controller.offsetForPosition(x, includePartialGlyphs); } diff --git a/WebCore/platform/graphics/win/GraphicsLayerCACF.h b/WebCore/platform/graphics/win/GraphicsLayerCACF.h index 171cdbf..0b74266 100644 --- a/WebCore/platform/graphics/win/GraphicsLayerCACF.h +++ b/WebCore/platform/graphics/win/GraphicsLayerCACF.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GraphicsLayerCACF_h_ -#define GraphicsLayerCACF_h_ +#ifndef GraphicsLayerCACF_h +#define GraphicsLayerCACF_h #if USE(ACCELERATED_COMPOSITING) @@ -142,4 +142,4 @@ private: #endif // USE(ACCELERATED_COMPOSITING) -#endif // GraphicsLayerCACF_h_ +#endif // GraphicsLayerCACF_h diff --git a/WebCore/platform/graphics/win/QTMovieWinTimer.h b/WebCore/platform/graphics/win/QTMovieWinTimer.h index 3e3c2bc..976b310 100644 --- a/WebCore/platform/graphics/win/QTMovieWinTimer.h +++ b/WebCore/platform/graphics/win/QTMovieWinTimer.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef QTMovieViewTimer_h -#define QTMovieViewTimer_h +#ifndef QTMovieWinTimer_h +#define QTMovieWinTimer_h // This header should not be included from WebCore. // It is used by the QuickTime access DLL. It copies some WebCore code diff --git a/WebCore/platform/graphics/win/RefCountedGDIHandle.h b/WebCore/platform/graphics/win/RefCountedGDIHandle.h index 65f66f1..65f66f1 100755..100644 --- a/WebCore/platform/graphics/win/RefCountedGDIHandle.h +++ b/WebCore/platform/graphics/win/RefCountedGDIHandle.h diff --git a/WebCore/platform/graphics/win/UniscribeController.cpp b/WebCore/platform/graphics/win/UniscribeController.cpp index bcf7578..afea10a 100644 --- a/WebCore/platform/graphics/win/UniscribeController.cpp +++ b/WebCore/platform/graphics/win/UniscribeController.cpp @@ -1,29 +1,26 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010 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. * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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" @@ -51,24 +48,25 @@ UniscribeController::UniscribeController(const Font* font, const TextRun& run, H , m_end(run.length()) , m_currentCharacter(0) , m_runWidthSoFar(0) + , m_padding(run.padding()) , m_computingOffsetPosition(false) , m_includePartialGlyphs(false) , m_offsetX(0) , m_offsetPosition(0) { - m_padding = m_run.padding(); if (!m_padding) m_padPerSpace = 0; else { float numSpaces = 0; - for (int s = 0; s < m_run.length(); s++) + for (int s = 0; s < m_run.length(); s++) { if (Font::treatAsSpace(m_run[s])) numSpaces++; + } if (numSpaces == 0) m_padPerSpace = 0; else - m_padPerSpace = ceilf(m_run.padding() / numSpaces); + m_padPerSpace = m_padding / numSpaces; } // Null out our uniscribe structs @@ -339,8 +337,9 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S advance += m_padding; m_padding = 0; } else { - advance += m_padPerSpace; + float previousPadding = m_padding; m_padding -= m_padPerSpace; + advance += roundf(previousPadding) - roundf(m_padding); } } diff --git a/WebCore/platform/graphics/win/UniscribeController.h b/WebCore/platform/graphics/win/UniscribeController.h index 09203b5..162ddbe 100644 --- a/WebCore/platform/graphics/win/UniscribeController.h +++ b/WebCore/platform/graphics/win/UniscribeController.h @@ -1,29 +1,26 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010 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. * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 UniscribeController_h diff --git a/WebCore/platform/graphics/win/WebLayer.h b/WebCore/platform/graphics/win/WebLayer.h index 8dab5cc..8dab5cc 100755..100644 --- a/WebCore/platform/graphics/win/WebLayer.h +++ b/WebCore/platform/graphics/win/WebLayer.h diff --git a/WebCore/platform/graphics/win/WebTiledLayer.h b/WebCore/platform/graphics/win/WebTiledLayer.h index fdf0205..fdf0205 100755..100644 --- a/WebCore/platform/graphics/win/WebTiledLayer.h +++ b/WebCore/platform/graphics/win/WebTiledLayer.h diff --git a/WebCore/platform/graphics/wince/FontCacheWince.cpp b/WebCore/platform/graphics/wince/FontCacheWince.cpp index 3262fc0..6b5dfa5 100644 --- a/WebCore/platform/graphics/wince/FontCacheWince.cpp +++ b/WebCore/platform/graphics/wince/FontCacheWince.cpp @@ -51,7 +51,7 @@ static IMLangFontLink2* langFontLink = 0; static IMLangFontLink* langFontLink = 0; #endif -IMultiLanguage* getMultiLanguageInterface() +IMultiLanguage* FontCache::getMultiLanguageInterface() { if (!multiLanguage) CoCreateInstance(CLSID_CMultiLanguage, 0, CLSCTX_INPROC_SERVER, IID_IMultiLanguage, (void**)&multiLanguage); diff --git a/WebCore/platform/graphics/wince/FontPlatformData.h b/WebCore/platform/graphics/wince/FontPlatformData.h index 77803d3..bb49f75 100644 --- a/WebCore/platform/graphics/wince/FontPlatformData.h +++ b/WebCore/platform/graphics/wince/FontPlatformData.h @@ -22,8 +22,8 @@ * */ -#ifndef FontPlatformDataWince_H -#define FontPlatformDataWince_H +#ifndef FontPlatformData_h +#define FontPlatformData_h #include "FontDescription.h" #include "StringImpl.h" diff --git a/WebCore/platform/graphics/wince/FontWince.cpp b/WebCore/platform/graphics/wince/FontWince.cpp index f8b1886..c0948c0 100644 --- a/WebCore/platform/graphics/wince/FontWince.cpp +++ b/WebCore/platform/graphics/wince/FontWince.cpp @@ -242,8 +242,12 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon return w; } -int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool includePartialGlyphs) const +int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const { + // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers + // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem. + int position = static_cast<int>(xFloat); + TextRunComponents components; int w = generateComponents(&components, *this, run); @@ -308,7 +312,7 @@ static float cursorToX(const Font* font, const TextRunComponents& components, in return width; } -FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const { TextRunComponents components; diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp index 5896f90..c2c29c7 100644 --- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp +++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp @@ -1249,7 +1249,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& fillRect, const IntSize& to if (!m_data->m_dc) return; - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur = 0; Color shadowColor; @@ -1550,7 +1550,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) fillRect(rect, fillColor(), DeviceColorSpace); } -void GraphicsContext::setPlatformShadow(const IntSize&, float, const Color&, ColorSpace) +void GraphicsContext::setPlatformShadow(const FloatSize&, float, const Color&, ColorSpace) { notImplemented(); } @@ -1672,7 +1672,7 @@ void GraphicsContext::drawText(const SimpleFontData* fontData, const GlyphBuffer return; } - IntSize shadowSize; + FloatSize shadowSize; float shadowBlur = 0; Color shadowColor; bool hasShadow = textDrawingMode() == cTextFill diff --git a/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp b/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp index ceb5a7c..6fb262d 100644 --- a/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp +++ b/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp @@ -109,7 +109,7 @@ void WebMediaPlayerProxy::initEngine() } } serviceType = "application/x-mplayer2"; - frame->loader()->requestObject(static_cast<RenderPartObject*>(element->renderer()), url, nullAtom, serviceType, paramNames, paramValues); + frame->loader()->subframeLoader()->requestObject(static_cast<RenderPartObject*>(element->renderer()), url, nullAtom, serviceType, paramNames, paramValues); m_init = true; } diff --git a/WebCore/platform/graphics/wx/FontPlatformData.h b/WebCore/platform/graphics/wx/FontPlatformData.h index 9d506d6..952368e 100644 --- a/WebCore/platform/graphics/wx/FontPlatformData.h +++ b/WebCore/platform/graphics/wx/FontPlatformData.h @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FontPlatformData_H -#define FontPlatformData_H +#ifndef FontPlatformData_h +#define FontPlatformData_h #include "FontDescription.h" #include "AtomicString.h" diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp index 3dcabf1..cc45ab0 100644 --- a/WebCore/platform/graphics/wx/FontWx.cpp +++ b/WebCore/platform/graphics/wx/FontWx.cpp @@ -70,7 +70,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo drawTextWithSpacing(graphicsContext, font, color, glyphBuffer, from, numGlyphs, point); } -FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const +FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { #if OS(WINDOWS) || OS(DARWIN) ComplexTextController it(this, run); @@ -153,7 +153,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon #endif } -int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const +int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const { #if OS(WINDOWS) || OS(DARWIN) ComplexTextController controller(this, run); diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 127bf07..0b6c81b 100644 --- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -554,7 +554,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) return; } -void GraphicsContext::setPlatformShadow(IntSize const&, float, Color const&, ColorSpace) +void GraphicsContext::setPlatformShadow(FloatSize const&, float, Color const&, ColorSpace) { notImplemented(); } diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index ad1c665..924fabc 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -331,23 +331,7 @@ void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, c void ClipboardGtk::writeURL(const KURL& url, const String& label, Frame*) { - String actualLabel(label); - if (actualLabel.isEmpty()) - actualLabel = url; - m_dataObject->setText(actualLabel); - - Vector<UChar> markup; - append(markup, "<a href=\""); - append(markup, url.string()); - append(markup, "\">"); - append(markup, label); - append(markup, "</a>"); - m_dataObject->setMarkup(String::adopt(markup)); - - Vector<KURL> uriList; - uriList.append(url); - m_dataObject->setURIList(uriList); - + m_dataObject->setURL(url, label); if (m_clipboard) m_helper->writeClipboardContents(m_clipboard); } @@ -357,7 +341,7 @@ void ClipboardGtk::writeRange(Range* range, Frame* frame) ASSERT(range); m_dataObject->setText(frame->selectedText()); - m_dataObject->setMarkup(createMarkup(range, 0, AnnotateForInterchange)); + m_dataObject->setMarkup(createMarkup(range, 0, AnnotateForInterchange, false, AbsoluteURLs)); if (m_clipboard) m_helper->writeClipboardContents(m_clipboard); diff --git a/WebCore/platform/gtk/DataObjectGtk.cpp b/WebCore/platform/gtk/DataObjectGtk.cpp index 57d920c..db13345 100644 --- a/WebCore/platform/gtk/DataObjectGtk.cpp +++ b/WebCore/platform/gtk/DataObjectGtk.cpp @@ -21,6 +21,7 @@ #include "markup.h" #include <gtk/gtk.h> +#include <wtf/gobject/GOwnPtr.h> namespace WebCore { @@ -41,7 +42,7 @@ String DataObjectGtk::text() String DataObjectGtk::markup() { if (m_range) - return createMarkup(m_range.get(), 0, AnnotateForInterchange); + return createMarkup(m_range.get(), 0, AnnotateForInterchange, false, AbsoluteURLs); return m_markup; } @@ -58,6 +59,28 @@ void DataObjectGtk::setMarkup(const String& newMarkup) m_markup = newMarkup; } +void DataObjectGtk::setURL(const KURL& url, const String& label) +{ + setText(url.string()); + + String actualLabel(label); + if (actualLabel.isEmpty()) + actualLabel = url; + + Vector<UChar> markup; + append(markup, "<a href=\""); + append(markup, url.string()); + append(markup, "\">"); + GOwnPtr<gchar> escaped(g_markup_escape_text(actualLabel.utf8().data(), -1)); + append(markup, String::fromUTF8(escaped.get())); + append(markup, "</a>"); + setMarkup(String::adopt(markup)); + + Vector<KURL> uriList; + uriList.append(url); + setURIList(uriList); +} + void DataObjectGtk::clearText() { m_range = 0; diff --git a/WebCore/platform/gtk/DataObjectGtk.h b/WebCore/platform/gtk/DataObjectGtk.h index 41f8f49..8fba938 100644 --- a/WebCore/platform/gtk/DataObjectGtk.h +++ b/WebCore/platform/gtk/DataObjectGtk.h @@ -46,6 +46,7 @@ public: void setURIList(const Vector<KURL>& newURIList) { m_uriList = newURIList; } void setImage(GdkPixbuf* newImage) { m_image = newImage; } void setDragContext(GdkDragContext* newDragContext) { m_dragContext = newDragContext; } + void setURL(const KURL&, const String&); bool hasText() { return m_range || !m_text.isEmpty(); } bool hasMarkup() { return m_range || !m_markup.isEmpty(); } bool hasURIList() { return !m_uriList.isEmpty(); } diff --git a/WebCore/platform/gtk/GtkVersioning.h b/WebCore/platform/gtk/GtkVersioning.h index cdd679c..3ee6763 100644 --- a/WebCore/platform/gtk/GtkVersioning.h +++ b/WebCore/platform/gtk/GtkVersioning.h @@ -23,6 +23,16 @@ #include <gtk/gtk.h> // Macros to avoid deprecation checking churn +#if !GTK_CHECK_VERSION(2, 21, 2) +#define gdk_visual_get_depth(visual) (visual)->depth +#define gdk_visual_get_bits_per_rgb(visual) (visual)->bits_per_rgb +#define gdk_drag_context_get_selected_action(context) (context)->action +#endif // GTK_CHECK_VERSION(2, 21, 2) + +#if !GTK_CHECK_VERSION(2, 20, 0) +#define gtk_widget_set_realized(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_REALIZED) +#endif // GTK_CHECK_VERSION(2, 20, 0) + #if !GTK_CHECK_VERSION(2, 19, 0) #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL(widget) #define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget) @@ -31,8 +41,18 @@ #define gtk_widget_is_sensitive(widget) GTK_WIDGET_IS_SENSITIVE(widget) #endif // GTK_CHECK_VERSION(2, 19, 0) +#if !GTK_CHECK_VERSION(2, 18, 0) +#define gtk_widget_set_visible(widget, FALSE) GTK_WIDGET_UNSET_FLAGS((widget), GTK_VISIBLE) +#define gtk_widget_set_window(widget, new_window) (widget)->window = (new_window) +#define gtk_widget_set_can_focus(widget, TRUE) GTK_WIDGET_SET_FLAGS((widget), GTK_CAN_FOCUS) +#endif // GTK_CHECK_VERSION(2, 18, 0) + #if !GTK_CHECK_VERSION(2, 14, 0) #define gtk_widget_get_window(widget) (widget)->window -#endif +#define gtk_adjustment_get_value(adj) (adj)->value +#define gtk_dialog_get_content_area(dialog) (dialog)->vbox +#define gtk_selection_data_get_length(data) (data)->length +#define gtk_selection_data_get_data(data) (data)->data +#endif // GTK_CHECK_VERSION(2, 14, 0) #endif // GtkVersioning_h diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp index 599f7da..a0069cf 100644 --- a/WebCore/platform/gtk/PasteboardGtk.cpp +++ b/WebCore/platform/gtk/PasteboardGtk.cpp @@ -68,7 +68,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, GtkClipboard* clipboard = m_helper->getClipboard(frame); DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); dataObject->setText(frame->selectedText()); - dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange)); + dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs)); m_helper->writeClipboardContents(clipboard); } @@ -80,17 +80,14 @@ void Pasteboard::writePlainText(const String& text) m_helper->writeClipboardContents(clipboard); } -void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame) +void Pasteboard::writeURL(const KURL& url, const String& label, Frame* frame) { if (url.isEmpty()) return; GtkClipboard* clipboard = m_helper->getClipboard(frame); DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); - - Vector<KURL> uriList; - uriList.append(url); - dataObject->setURIList(uriList); + dataObject->setURL(url, label); m_helper->writeClipboardContents(clipboard); } diff --git a/WebCore/platform/gtk/PasteboardHelper.cpp b/WebCore/platform/gtk/PasteboardHelper.cpp index 3dc4cc0..141488f 100644 --- a/WebCore/platform/gtk/PasteboardHelper.cpp +++ b/WebCore/platform/gtk/PasteboardHelper.cpp @@ -25,6 +25,7 @@ #include "Chrome.h" #include "DataObjectGtk.h" #include "Frame.h" +#include "GtkVersioning.h" #include "Page.h" #include "Pasteboard.h" #include "TextResourceDecoder.h" @@ -115,7 +116,7 @@ void PasteboardHelper::getClipboardContents(GtkClipboard* clipboard) if (gtk_clipboard_wait_is_target_available(clipboard, gdkMarkupAtom)) { if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, gdkMarkupAtom)) { RefPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("text/plain", "UTF-8", true)); - String markup(decoder->decode(reinterpret_cast<char*>(data->data), data->length)); + String markup(decoder->decode(reinterpret_cast<const char*>(gtk_selection_data_get_data(data)), gtk_selection_data_get_length(data))); markup += decoder->flush(); dataObject->setMarkup(markup); gtk_selection_data_free(data); @@ -141,7 +142,7 @@ void PasteboardHelper::fillSelectionData(GtkSelectionData* selectionData, guint else if (info == getIdForTargetType(TargetTypeMarkup)) { GOwnPtr<gchar> markup(g_strdup(dataObject->markup().utf8().data())); - gtk_selection_data_set(selectionData, selectionData->target, 8, + gtk_selection_data_set(selectionData, gdkMarkupAtom, 8, reinterpret_cast<const guchar*>(markup.get()), strlen(markup.get())); } else if (info == getIdForTargetType(TargetTypeURIList)) { @@ -164,7 +165,7 @@ void PasteboardHelper::fillSelectionData(GtkSelectionData* selectionData, guint result.append(url); GOwnPtr<gchar> resultData(g_strdup(result.utf8().data())); - gtk_selection_data_set(selectionData, selectionData->target, 8, + gtk_selection_data_set(selectionData, netscapeURLAtom, 8, reinterpret_cast<const guchar*>(resultData.get()), strlen(resultData.get())); } else if (info == getIdForTargetType(TargetTypeImage)) diff --git a/WebCore/platform/gtk/PlatformScreenGtk.cpp b/WebCore/platform/gtk/PlatformScreenGtk.cpp index 0ab00a1..6ace728 100644 --- a/WebCore/platform/gtk/PlatformScreenGtk.cpp +++ b/WebCore/platform/gtk/PlatformScreenGtk.cpp @@ -72,7 +72,7 @@ int screenDepth(Widget* widget) GdkVisual* visual = getVisual(widget); if (!visual) return 24; - return visual->depth; + return gdk_visual_get_depth(visual); } int screenDepthPerComponent(Widget* widget) @@ -81,7 +81,7 @@ int screenDepthPerComponent(Widget* widget) if (!visual) return 8; - return visual->bits_per_rgb; + return gdk_visual_get_bits_per_rgb(visual); } bool screenIsMonochrome(Widget* widget) diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp index f29d51b..bf8cfb4 100644 --- a/WebCore/platform/gtk/PopupMenuGtk.cpp +++ b/WebCore/platform/gtk/PopupMenuGtk.cpp @@ -89,22 +89,24 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) gtk_widget_size_request(GTK_WIDGET(m_popup.get()), &requisition); gtk_widget_set_size_request(GTK_WIDGET(m_popup.get()), std::max(rect.width(), requisition.width), -1); - GList* children = GTK_MENU_SHELL(m_popup.get())->children; + GList* children = gtk_container_get_children(GTK_CONTAINER(m_popup.get())); + GList* p = children; if (size) for (int i = 0; i < size; i++) { if (i > index) break; - GtkWidget* item = reinterpret_cast<GtkWidget*>(children->data); + GtkWidget* item = reinterpret_cast<GtkWidget*>(p->data); GtkRequisition itemRequisition; gtk_widget_get_child_requisition(item, &itemRequisition); m_menuPosition.setY(m_menuPosition.y() - itemRequisition.height); - children = g_list_next(children); + p = g_list_next(p); } else // Center vertically the empty popup in the combo box area m_menuPosition.setY(m_menuPosition.y() - rect.height() / 2); + g_list_free(children); gtk_menu_popup(m_popup.get(), 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, 0, gtk_get_current_event_time()); } diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index 6205dbd..75fb946 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -299,77 +299,63 @@ static void setMozillaState(const RenderTheme* theme, GtkThemeWidgetType type, R static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetType type, RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) { - GRefPtr<GdkDrawable> pixmap; - // Painting is disabled so just claim to have succeeded if (i.context->paintingDisabled()) return false; - // No GdkWindow to render to, so return true to fall back - if (!i.context->gdkDrawable()) - // This is slow, used only during printing process - pixmap = adoptGRef(gdk_pixmap_new(0, rect.width(), rect.height(), gdk_visual_get_system()->depth)); - - GtkWidgetState mozState; - setMozillaState(theme, type, o, &mozState); - - int flags; + GtkWidgetState widgetState; + setMozillaState(theme, type, o, &widgetState); // We might want to make setting flags the caller's job at some point rather than doing it here. - switch (type) { - case MOZ_GTK_BUTTON: + int flags = 0; + if (type == MOZ_GTK_BUTTON) flags = GTK_RELIEF_NORMAL; - break; - case MOZ_GTK_CHECKBUTTON: - case MOZ_GTK_RADIOBUTTON: + else if (type == MOZ_GTK_CHECKBUTTON || type == MOZ_GTK_RADIOBUTTON) flags = theme->isChecked(o); - break; - default: - flags = 0; - break; - } - - GtkTextDirection direction = gtkTextDirection(o->style()->direction()); - if (pixmap) { - GdkRectangle gdkRect = IntRect(0, 0, rect.width(), rect.height()); + GRefPtr<GdkDrawable> drawable(i.context->gdkDrawable()); + GdkRectangle paintRect, clipRect; + if (drawable) { + AffineTransform ctm = i.context->getCTM(); + IntPoint pos = ctm.mapPoint(rect.location()); + paintRect = IntRect(pos.x(), pos.y(), rect.width(), rect.height()); + + // Intersect the cairo rectangle with the target widget region. This will + // prevent the theme drawing code from drawing into regions that cairo will + // clip anyway. + cairo_t* cr = i.context->platformContext(); + double clipX1, clipX2, clipY1, clipY2; + cairo_clip_extents(cr, &clipX1, &clipY1, &clipX2, &clipY2); + IntPoint clipPos = ctm.mapPoint(IntPoint(clipX1, clipY1)); + + clipRect.width = clipX2 - clipX1; + clipRect.height = clipY2 - clipY1; + clipRect.x = clipPos.x(); + clipRect.y = clipPos.y(); + gdk_rectangle_intersect(&paintRect, &clipRect, &clipRect); - moz_gtk_use_theme_parts(theme->partsForDrawable(pixmap.get())); - - bool result = moz_gtk_widget_paint(type, pixmap.get(), &gdkRect, &gdkRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS; - - if (!result) { - cairo_t* cr = i.context->platformContext(); - gdk_cairo_set_source_pixmap(cr, pixmap.get(), rect.x(), rect.y()); - cairo_paint(cr); - } - - return result; + } else { + // In some situations, like during print previews, this GraphicsContext is not + // backed by a GdkDrawable. In those situations, we render onto a pixmap and then + // copy the rendered data back to the GraphicsContext via Cairo. + drawable = adoptGRef(gdk_pixmap_new(0, rect.width(), rect.height(), gdk_visual_get_system()->depth)); + paintRect = clipRect = IntRect(0, 0, rect.width(), rect.height()); } - AffineTransform ctm = i.context->getCTM(); - - IntPoint pos = ctm.mapPoint(rect.location()); - GdkRectangle gdkRect = IntRect(pos.x(), pos.y(), rect.width(), rect.height()); - - // Find the clip rectangle - cairo_t* cr = i.context->platformContext(); - double clipX1, clipX2, clipY1, clipY2; - cairo_clip_extents(cr, &clipX1, &clipY1, &clipX2, &clipY2); - - GdkRectangle gdkClipRect; - gdkClipRect.width = clipX2 - clipX1; - gdkClipRect.height = clipY2 - clipY1; - IntPoint clipPos = ctm.mapPoint(IntPoint(clipX1, clipY1)); - gdkClipRect.x = clipPos.x(); - gdkClipRect.y = clipPos.y(); - - gdk_rectangle_intersect(&gdkRect, &gdkClipRect, &gdkClipRect); + moz_gtk_use_theme_parts(theme->partsForDrawable(drawable.get())); + bool success = moz_gtk_widget_paint(type, drawable.get(), &paintRect, &clipRect, &widgetState, flags, gtkTextDirection(o->style()->direction())) == MOZ_GTK_SUCCESS; + + // If the drawing was successful and we rendered onto a pixmap, copy the + // results back to the original GraphicsContext. + if (success && !i.context->gdkDrawable()) { + cairo_t* cairoContext = i.context->platformContext(); + cairo_save(cairoContext); + gdk_cairo_set_source_pixmap(cairoContext, drawable.get(), rect.x(), rect.y()); + cairo_paint(cairoContext); + cairo_restore(cairoContext); + } - // Since the theme renderer is going to be drawing onto this GdkDrawable, - // select the appropriate widgets for the drawable depth. - moz_gtk_use_theme_parts(theme->partsForDrawable(i.context->gdkDrawable())); - return moz_gtk_widget_paint(type, i.context->gdkDrawable(), &gdkRect, &gdkClipRect, &mozState, flags, direction) != MOZ_GTK_SUCCESS; + return !success; } static void setButtonPadding(RenderStyle* style) diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp index 3d4cc47..5dc4dd6 100644 --- a/WebCore/platform/gtk/ScrollbarGtk.cpp +++ b/WebCore/platform/gtk/ScrollbarGtk.cpp @@ -120,11 +120,15 @@ void ScrollbarGtk::detachAdjustment() // For the case where we only operate on the GtkAdjustment it is best to // reset the values so that the surrounding scrollbar gets updated, or // e.g. for a GtkScrolledWindow the scrollbar gets hidden. +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_adjustment_configure(m_adjustment, 0, 0, 0, 0, 0, 0); +#else m_adjustment->lower = 0; m_adjustment->upper = 0; m_adjustment->value = 0; gtk_adjustment_changed(m_adjustment); gtk_adjustment_value_changed(m_adjustment); +#endif g_object_unref(m_adjustment); m_adjustment = 0; } @@ -158,19 +162,33 @@ void ScrollbarGtk::frameRectsChanged() void ScrollbarGtk::updateThumbPosition() { - if (m_adjustment->value != m_currentPos) { + if (gtk_adjustment_get_value(m_adjustment) != m_currentPos) { +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_adjustment_set_value(m_adjustment, m_currentPos); +#else m_adjustment->value = m_currentPos; gtk_adjustment_value_changed(m_adjustment); +#endif } } void ScrollbarGtk::updateThumbProportion() { +#if GTK_CHECK_VERSION(2, 14, 0) + gtk_adjustment_configure(m_adjustment, + gtk_adjustment_get_value(m_adjustment), + gtk_adjustment_get_lower(m_adjustment), + m_totalSize, + m_lineStep, + m_pageStep, + m_visibleSize); +#else m_adjustment->step_increment = m_lineStep; m_adjustment->page_increment = m_pageStep; m_adjustment->page_size = m_visibleSize; m_adjustment->upper = m_totalSize; gtk_adjustment_changed(m_adjustment); +#endif } void ScrollbarGtk::setFrameRect(const IntRect& rect) diff --git a/WebCore/platform/haiku/PasteboardHaiku.cpp b/WebCore/platform/haiku/PasteboardHaiku.cpp index defec3f..d7a7e08 100644 --- a/WebCore/platform/haiku/PasteboardHaiku.cpp +++ b/WebCore/platform/haiku/PasteboardHaiku.cpp @@ -102,7 +102,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, data->AddData("text/plain", B_MIME_TYPE, string.String(), string.Length()); - BString markupString(createMarkup(selectedRange, 0, AnnotateForInterchange)); + BString markupString(createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs)); data->AddData("text/html", B_MIME_TYPE, markupString.String(), markupString.Length()); be_clipboard->Commit(); diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index b063db2..f32536c 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -41,6 +41,7 @@ #include "NativeImageSkia.h" #include "SkColorPriv.h" #elif PLATFORM(QT) +#include <QPixmap> #include <QImage> #endif @@ -136,8 +137,7 @@ namespace WebCore { } #if PLATFORM(QT) - void setDecodedImage(const QImage& image); - QImage decodedImage() const { return m_image; } + void setPixmap(const QPixmap& pixmap); #endif private: @@ -149,6 +149,8 @@ namespace WebCore { #if PLATFORM(SKIA) return m_bitmap.getAddr32(x, y); #elif PLATFORM(QT) + m_image = m_pixmap.toImage(); + m_pixmap = QPixmap(); return reinterpret_cast<QRgb*>(m_image.scanLine(y)) + x; #else return m_bytes.data() + (y * width()) + x; @@ -178,6 +180,7 @@ namespace WebCore { #if PLATFORM(SKIA) NativeImageSkia m_bitmap; #elif PLATFORM(QT) + mutable QPixmap m_pixmap; mutable QImage m_image; bool m_hasAlpha; IntSize m_size; @@ -236,7 +239,7 @@ namespace WebCore { virtual void setData(SharedBuffer* data, bool allDataReceived) { - if (failed()) + if (m_failed) return; m_data = data; m_isAllDataReceived = allDataReceived; @@ -305,7 +308,8 @@ namespace WebCore { // Sets the "decode failure" flag. For caller convenience (since so // many callers want to return false after calling this), returns false - // to enable easy tailcalling. + // to enable easy tailcalling. Subclasses may override this to also + // clean up any local data. virtual bool setFailed() { m_failed = true; diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp index a6d36ef..901f60d 100644 --- a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp +++ b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp @@ -77,6 +77,12 @@ RGBA32Buffer* BMPImageDecoder::frameBufferAtIndex(size_t index) return buffer; } +bool BMPImageDecoder::setFailed() +{ + m_reader.clear(); + return ImageDecoder::setFailed(); +} + void BMPImageDecoder::decode(bool onlySize) { if (failed()) @@ -86,6 +92,10 @@ void BMPImageDecoder::decode(bool onlySize) // has failed. if (!decodeHelper(onlySize) && isAllDataReceived()) setFailed(); + // If we're done decoding the image, we don't need the BMPImageReader + // anymore. (If we failed, |m_reader| has already been cleared.) + else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache.first().status() == RGBA32Buffer::FrameComplete)) + m_reader.clear(); } bool BMPImageDecoder::decodeHelper(bool onlySize) diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h index 15be0a2..b08b32b 100644 --- a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h +++ b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h @@ -46,6 +46,10 @@ namespace WebCore { virtual void setData(SharedBuffer*, bool allDataReceived); virtual bool isSizeAvailable(); virtual RGBA32Buffer* frameBufferAtIndex(size_t index); + // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid + // accessing deleted memory, especially when calling this from inside + // BMPImageReader! + virtual bool setFailed(); private: inline uint32_t readUint32(int offset) const diff --git a/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp b/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp index 2f3bffa..93bedf3 100644 --- a/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp +++ b/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp @@ -79,7 +79,7 @@ bool BMPImageReader::decodeBMP(bool onlySize) ASSERT(m_buffer); // Parent should set this before asking us to decode! if (m_buffer->status() == RGBA32Buffer::FrameEmpty) { if (!m_buffer->setSize(m_parent->size().width(), m_parent->size().height())) - return setFailed(); // Unable to allocate. + return m_parent->setFailed(); // Unable to allocate. m_buffer->setStatus(RGBA32Buffer::FramePartial); // setSize() calls eraseARGB(), which resets the alpha flag, so we force // it back to false here. We'll set it true below in all cases where @@ -95,10 +95,11 @@ bool BMPImageReader::decodeBMP(bool onlySize) // Decode the data. if ((m_andMaskState != Decoding) && !pastEndOfImage(0)) { - if ((m_infoHeader.biCompression == RLE4) || (m_infoHeader.biCompression == RLE8) || (m_infoHeader.biCompression == RLE24)) { - if (!processRLEData()) - return false; - } else if (!processNonRLEData(false, 0)) + if ((m_infoHeader.biCompression != RLE4) && (m_infoHeader.biCompression != RLE8) && (m_infoHeader.biCompression != RLE24)) { + const ProcessingResult result = processNonRLEData(false, 0); + if (result != Success) + return (result == Failure) ? m_parent->setFailed() : false; + } else if (!processRLEData()) return false; } @@ -114,8 +115,11 @@ bool BMPImageReader::decodeBMP(bool onlySize) m_andMaskState = Decoding; } - if ((m_andMaskState == Decoding) && !processNonRLEData(false, 0)) - return false; + if (m_andMaskState == Decoding) { + const ProcessingResult result = processNonRLEData(false, 0); + if (result != Success) + return (result == Failure) ? m_parent->setFailed() : false; + } // Done! m_buffer->setStatus(RGBA32Buffer::FrameComplete); @@ -136,7 +140,7 @@ bool BMPImageReader::readInfoHeaderSize() // problematic or at least confusing in other places), or to overrun the // image data. if (((m_headerOffset + m_infoHeader.biSize) < m_headerOffset) || (m_imgDataOffset && (m_imgDataOffset < (m_headerOffset + m_infoHeader.biSize)))) - return setFailed(); + return m_parent->setFailed(); // See if this is a header size we understand: // OS/2 1.x: 12 @@ -149,7 +153,7 @@ bool BMPImageReader::readInfoHeaderSize() else if ((m_infoHeader.biSize >= 16) && (m_infoHeader.biSize <= 64) && (!(m_infoHeader.biSize & 3) || (m_infoHeader.biSize == 42) || (m_infoHeader.biSize == 46))) m_isOS22x = true; else - return setFailed(); + return m_parent->setFailed(); return true; } @@ -164,11 +168,11 @@ bool BMPImageReader::processInfoHeader() // Sanity-check header values. if (!isInfoHeaderValid()) - return setFailed(); + return m_parent->setFailed(); // Set our size. if (!m_parent->setSize(m_infoHeader.biWidth, m_infoHeader.biHeight)) - return setFailed(); + return false; // For paletted images, bitmaps can set biClrUsed to 0 to mean "all // colors", so set it to the maximum number of colors for this bit depth. @@ -228,7 +232,7 @@ bool BMPImageReader::readInfoHeader() m_infoHeader.biCompression = RLE24; m_isOS22x = true; } else if (biCompression > 5) - return setFailed(); // Some type we don't understand. + return m_parent->setFailed(); // Some type we don't understand. else m_infoHeader.biCompression = static_cast<CompressionType>(biCompression); } @@ -395,7 +399,7 @@ bool BMPImageReader::processBitmasks() // Fail if we don't have enough file space for the bitmasks. static const size_t SIZEOF_BITMASKS = 12; if (((m_headerOffset + m_infoHeader.biSize + SIZEOF_BITMASKS) < (m_headerOffset + m_infoHeader.biSize)) || (m_imgDataOffset && (m_imgDataOffset < (m_headerOffset + m_infoHeader.biSize + SIZEOF_BITMASKS)))) - return setFailed(); + return m_parent->setFailed(); // Read bitmasks. if ((m_data->size() - m_decodedOffset) < SIZEOF_BITMASKS) @@ -435,7 +439,7 @@ bool BMPImageReader::processBitmasks() // Make sure bitmask does not overlap any other bitmasks. for (int j = 0; j < i; ++j) { if (tempMask & m_bitMasks[j]) - return setFailed(); + return m_parent->setFailed(); } // Count offset into pixel data. @@ -448,7 +452,7 @@ bool BMPImageReader::processBitmasks() // Make sure bitmask is contiguous. if (tempMask) - return setFailed(); + return m_parent->setFailed(); // Since RGBABuffer tops out at 8 bits per channel, adjust the shift // amounts to use the most significant 8 bits of the channel. @@ -467,7 +471,7 @@ bool BMPImageReader::processColorTable() // Fail if we don't have enough file space for the color table. if (((m_headerOffset + m_infoHeader.biSize + m_tableSizeInBytes) < (m_headerOffset + m_infoHeader.biSize)) || (m_imgDataOffset && (m_imgDataOffset < (m_headerOffset + m_infoHeader.biSize + m_tableSizeInBytes)))) - return setFailed(); + return m_parent->setFailed(); // Read color table. if ((m_decodedOffset > m_data->size()) || ((m_data->size() - m_decodedOffset) < m_tableSizeInBytes)) @@ -529,10 +533,10 @@ bool BMPImageReader::processRLEData() const uint8_t count = m_data->data()[m_decodedOffset]; const uint8_t code = m_data->data()[m_decodedOffset + 1]; if ((count || (code != 1)) && pastEndOfImage(0)) - return setFailed(); + return m_parent->setFailed(); // Decode. - if (count == 0) { + if (!count) { switch (code) { case 0: // Magic token: EOL // Skip any remaining pixels in this row. @@ -562,7 +566,7 @@ bool BMPImageReader::processRLEData() if (dx || dy) m_buffer->setHasAlpha(true); if (((m_coord.x() + dx) > m_parent->size().width()) || pastEndOfImage(dy)) - return setFailed(); + return m_parent->setFailed(); // Skip intervening pixels. m_coord.move(dx, m_isTopDown ? dy : -dy); @@ -571,19 +575,23 @@ bool BMPImageReader::processRLEData() break; } - default: // Absolute mode + default: { // Absolute mode // |code| pixels specified as in BI_RGB, zero-padded at the end // to a multiple of 16 bits. // Because processNonRLEData() expects m_decodedOffset to // point to the beginning of the pixel data, bump it past // the escape bytes and then reset if decoding failed. m_decodedOffset += 2; - if (!processNonRLEData(true, code)) { + const ProcessingResult result = processNonRLEData(true, code); + if (result == Failure) + return m_parent->setFailed(); + if (result == InsufficientData) { m_decodedOffset -= 2; return false; } break; } + } } else { // Encoded mode // The following color data is repeated for |count| total pixels. // Strangely, some BMPs seem to specify excessively large counts @@ -608,7 +616,7 @@ bool BMPImageReader::processRLEData() colorIndexes[1] &= 0xf; } if ((colorIndexes[0] >= m_infoHeader.biClrUsed) || (colorIndexes[1] >= m_infoHeader.biClrUsed)) - return setFailed(); + return m_parent->setFailed(); for (int which = 0; m_coord.x() < endX; ) { setI(colorIndexes[which]); which = !which; @@ -620,10 +628,10 @@ bool BMPImageReader::processRLEData() } } -bool BMPImageReader::processNonRLEData(bool inRLE, int numPixels) +BMPImageReader::ProcessingResult BMPImageReader::processNonRLEData(bool inRLE, int numPixels) { if (m_decodedOffset > m_data->size()) - return false; + return InsufficientData; if (!inRLE) numPixels = m_parent->size().width(); @@ -631,7 +639,7 @@ bool BMPImageReader::processNonRLEData(bool inRLE, int numPixels) // Fail if we're being asked to decode more pixels than remain in the row. const int endX = m_coord.x() + numPixels; if (endX > m_parent->size().width()) - return setFailed(); + return Failure; // Determine how many bytes of data the requested number of pixels // requires. @@ -648,7 +656,7 @@ bool BMPImageReader::processNonRLEData(bool inRLE, int numPixels) while (!pastEndOfImage(0)) { // Bail if we don't have enough data for the desired number of pixels. if ((m_data->size() - m_decodedOffset) < paddedNumBytes) - return false; + return InsufficientData; if (m_infoHeader.biBitCount < 16) { // Paletted data. Pixels are stored little-endian within bytes. @@ -672,7 +680,7 @@ bool BMPImageReader::processNonRLEData(bool inRLE, int numPixels) m_coord.move(1, 0); } else { if (colorIndex >= m_infoHeader.biClrUsed) - return setFailed(); + return Failure; setI(colorIndex); } pixelData <<= m_infoHeader.biBitCount; @@ -713,12 +721,12 @@ bool BMPImageReader::processNonRLEData(bool inRLE, int numPixels) // Success, keep going. m_decodedOffset += paddedNumBytes; if (inRLE) - return true; + return Success; moveBufferToNextRow(); } // Finished decoding whole image. - return true; + return Success; } void BMPImageReader::moveBufferToNextRow() @@ -726,11 +734,4 @@ void BMPImageReader::moveBufferToNextRow() m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); } -bool BMPImageReader::setFailed() -{ - m_parent->setFailed(); - m_colorTable.clear(); - return false; -} - } // namespace WebCore diff --git a/WebCore/platform/image-decoders/bmp/BMPImageReader.h b/WebCore/platform/image-decoders/bmp/BMPImageReader.h index a30a721..0a6dc84 100644 --- a/WebCore/platform/image-decoders/bmp/BMPImageReader.h +++ b/WebCore/platform/image-decoders/bmp/BMPImageReader.h @@ -97,6 +97,11 @@ namespace WebCore { NotYetDecoded, Decoding, }; + enum ProcessingResult { + Success, + Failure, + InsufficientData, + }; // These are based on the Windows BITMAPINFOHEADER and RGBTRIPLE // structs, but with unnecessary entries removed. @@ -161,14 +166,18 @@ namespace WebCore { // Processes a set of non-RLE-compressed pixels. Two cases: // * inRLE = true: the data is inside an RLE-encoded bitmap. Tries to - // process |numPixels| pixels on the current row; returns true on - // success. + // process |numPixels| pixels on the current row. // * inRLE = false: the data is inside a non-RLE-encoded bitmap. // |numPixels| is ignored. Expects |m_coord| to point at the // beginning of the next row to be decoded. Tries to process as - // many complete rows as possible. Returns true if the whole image - // was decoded. - bool processNonRLEData(bool inRLE, int numPixels); + // many complete rows as possible. Returns InsufficientData if + // there wasn't enough data to decode the whole image. + // + // This function returns a ProcessingResult instead of a bool so that it + // can avoid calling m_parent->setFailed(), which could lead to memory + // corruption since that will delete |this| but some callers still want + // to access member variables after this returns. + ProcessingResult processNonRLEData(bool inRLE, int numPixels); // Returns true if the current y-coordinate plus |numRows| would be past // the end of the image. Here "plus" means "toward the end of the @@ -261,11 +270,6 @@ namespace WebCore { // depending on the value of |m_isTopDown|. void moveBufferToNextRow(); - // Sets the "decode failure" flag and clears any local storage. For - // caller convenience (since so many callers want to return false after - // calling this), returns false to enable easy tailcalling. - bool setFailed(); - // The decoder that owns us. ImageDecoder* m_parent; diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp index 3cf516e..a590a6c 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp +++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp @@ -119,6 +119,12 @@ RGBA32Buffer* GIFImageDecoder::frameBufferAtIndex(size_t index) return &frame; } +bool GIFImageDecoder::setFailed() +{ + m_reader.clear(); + return ImageDecoder::setFailed(); +} + void GIFImageDecoder::clearFrameBufferCache(size_t clearBeforeFrame) { // In some cases, like if the decoder was destroyed while animating, we @@ -300,9 +306,6 @@ void GIFImageDecoder::decode(unsigned haltAtFrame, GIFQuery query) // has failed. if (!m_reader->read((const unsigned char*)m_data->data() + m_readOffset, m_data->size() - m_readOffset, query, haltAtFrame) && isAllDataReceived()) setFailed(); - - if (failed()) - m_reader.clear(); } bool GIFImageDecoder::initFrameBuffer(unsigned frameIndex) diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h index 1c3378c..e0f8173 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h +++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h @@ -49,6 +49,10 @@ namespace WebCore { virtual size_t frameCount(); virtual int repetitionCount() const; virtual RGBA32Buffer* frameBufferAtIndex(size_t index); + // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid + // accessing deleted memory, especially when calling this from inside + // GIFImageReader! + virtual bool setFailed(); virtual void clearFrameBufferCache(size_t clearBeforeFrame); // Callbacks from the GIF reader. diff --git a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp index 325c506..d667795 100644 --- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp +++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp @@ -116,6 +116,13 @@ RGBA32Buffer* ICOImageDecoder::frameBufferAtIndex(size_t index) return buffer; } +bool ICOImageDecoder::setFailed() +{ + m_bmpReaders.clear(); + m_pngDecoders.clear(); + return ImageDecoder::setFailed(); +} + // static bool ICOImageDecoder::compareEntries(const IconDirectoryEntry& a, const IconDirectoryEntry& b) { @@ -147,6 +154,13 @@ void ICOImageDecoder::decode(size_t index, bool onlySize) // has failed. if ((!decodeDirectory() || (!onlySize && !decodeAtIndex(index))) && isAllDataReceived()) setFailed(); + // If we're done decoding this frame, we don't need the BMPImageReader or + // PNGImageDecoder anymore. (If we failed, these have already been + // cleared.) + else if ((m_frameBufferCache.size() > index) && (m_frameBufferCache[index].status() == RGBA32Buffer::FrameComplete)) { + m_bmpReaders[index].clear(); + m_pngDecoders[index].clear(); + } } bool ICOImageDecoder::decodeDirectory() @@ -241,8 +255,9 @@ bool ICOImageDecoder::processDirectoryEntries() // The image size is the size of the largest entry. const IconDirectoryEntry& dirEntry = m_dirEntries.first(); - setSize(dirEntry.m_size.width(), dirEntry.m_size.height()); - return true; + // Technically, this next call shouldn't be able to fail, since the width + // and height here are each <= 256, and |m_frameSize| is empty. + return setSize(dirEntry.m_size.width(), dirEntry.m_size.height()); } ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() diff --git a/WebCore/platform/image-decoders/ico/ICOImageDecoder.h b/WebCore/platform/image-decoders/ico/ICOImageDecoder.h index c1f29c9..48024a2 100644 --- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.h +++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.h @@ -52,6 +52,10 @@ namespace WebCore { virtual bool setSize(unsigned width, unsigned height); virtual size_t frameCount(); virtual RGBA32Buffer* frameBufferAtIndex(size_t); + // CAUTION: setFailed() deletes all readers and decoders. Be careful to + // avoid accessing deleted memory, especially when calling this from + // inside BMPImageReader! + virtual bool setFailed(); private: enum ImageType { diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 8375693..cce4f64 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -167,10 +167,8 @@ public: m_bufferLength = data.size(); // We need to do the setjmp here. Otherwise bad things will happen - if (setjmp(m_err.setjmp_buffer)) { - close(); + if (setjmp(m_err.setjmp_buffer)) return m_decoder->setFailed(); - } switch (m_state) { case JPEG_HEADER: @@ -304,7 +302,7 @@ public: case JPEG_DONE: // Finish decompression. return jpeg_finish_decompress(&m_info); - + case JPEG_ERROR: // We can get here if the constructor failed. return m_decoder->setFailed(); @@ -402,6 +400,12 @@ RGBA32Buffer* JPEGImageDecoder::frameBufferAtIndex(size_t index) return &frame; } +bool JPEGImageDecoder::setFailed() +{ + m_reader.clear(); + return ImageDecoder::setFailed(); +} + bool JPEGImageDecoder::outputScanlines() { if (m_frameBufferCache.isEmpty()) @@ -482,8 +486,9 @@ void JPEGImageDecoder::decode(bool onlySize) // has failed. if (!m_reader->decode(m_data->buffer(), onlySize) && isAllDataReceived()) setFailed(); - - if (failed() || (!m_frameBufferCache.isEmpty() && m_frameBufferCache[0].status() == RGBA32Buffer::FrameComplete)) + // If we're done decoding the image, we don't need the JPEGImageReader + // anymore. (If we failed, |m_reader| has already been cleared.) + else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() == RGBA32Buffer::FrameComplete)) m_reader.clear(); } diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h index 79bad47..43b35fd 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h @@ -46,6 +46,10 @@ namespace WebCore { virtual bool setSize(unsigned width, unsigned height); virtual RGBA32Buffer* frameBufferAtIndex(size_t index); virtual bool supportsAlpha() const { return false; } + // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid + // accessing deleted memory, especially when calling this from inside + // JPEGImageReader! + virtual bool setFailed(); bool outputScanlines(); void jpegComplete(); diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp index 1dcf6c7..56cf05f 100644 --- a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp @@ -125,10 +125,8 @@ public: PNGImageDecoder* decoder = static_cast<PNGImageDecoder*>(png_get_progressive_ptr(m_png)); // We need to do the setjmp here. Otherwise bad things will happen. - if (setjmp(m_png->jmpbuf)) { - close(); + if (setjmp(m_png->jmpbuf)) return decoder->setFailed(); - } const char* segment; while (unsigned segmentLength = data.getSomeData(segment, m_readOffset)) { @@ -166,6 +164,7 @@ private: }; PNGImageDecoder::PNGImageDecoder() + : m_doNothingOnFailure(false) { } @@ -204,6 +203,14 @@ RGBA32Buffer* PNGImageDecoder::frameBufferAtIndex(size_t index) return &frame; } +bool PNGImageDecoder::setFailed() +{ + if (m_doNothingOnFailure) + return false; + m_reader.clear(); + return ImageDecoder::setFailed(); +} + void PNGImageDecoder::headerAvailable() { png_structp png = m_reader->pngPtr(); @@ -217,8 +224,15 @@ void PNGImageDecoder::headerAvailable() return; } - // We can fill in the size now that the header is available. - if (!setSize(width, height)) { + // We can fill in the size now that the header is available. Avoid memory + // corruption issues by neutering setFailed() during this call; if we don't + // do this, failures will cause |m_reader| to be deleted, and our jmpbuf + // will cease to exist. Note that we'll still properly set the failure flag + // in this case as soon as we longjmp(). + m_doNothingOnFailure = true; + bool result = setSize(width, height); + m_doNothingOnFailure = false; + if (!result) { longjmp(png->jmpbuf, 1); return; } @@ -341,7 +355,9 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, // Copy the data into our buffer. int width = scaledSize().width(); int destY = scaledY(rowIndex); - if (destY < 0) + + // Check that the row is within the image bounds. LibPNG may supply an extra row. + if (destY < 0 || destY >= scaledSize().height()) return; bool sawAlpha = buffer.hasAlpha(); for (int x = 0; x < width; ++x) { @@ -373,8 +389,9 @@ void PNGImageDecoder::decode(bool onlySize) // has failed. if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) setFailed(); - - if (failed() || isComplete()) + // If we're done decoding the image, we don't need the PNGImageReader + // anymore. (If we failed, |m_reader| has already been cleared.) + else if (isComplete()) m_reader.clear(); } diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.h b/WebCore/platform/image-decoders/png/PNGImageDecoder.h index 287a794..145fc4d 100644 --- a/WebCore/platform/image-decoders/png/PNGImageDecoder.h +++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.h @@ -44,6 +44,10 @@ namespace WebCore { virtual bool isSizeAvailable(); virtual bool setSize(unsigned width, unsigned height); virtual RGBA32Buffer* frameBufferAtIndex(size_t index); + // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid + // accessing deleted memory, especially when calling this from inside + // PNGImageReader! + virtual bool setFailed(); // Callbacks from libpng void headerAvailable(); @@ -62,6 +66,7 @@ namespace WebCore { void decode(bool onlySize); OwnPtr<PNGImageReader> m_reader; + bool m_doNothingOnFailure; }; } // namespace WebCore diff --git a/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp b/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp index b2e5e17..044515a 100644 --- a/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp +++ b/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp @@ -57,6 +57,7 @@ RGBA32Buffer& RGBA32Buffer::operator=(const RGBA32Buffer& other) void RGBA32Buffer::clear() { + m_pixmap = QPixmap(); m_image = QImage(); m_status = FrameEmpty; // NOTE: Do not reset other members here; clearFrameBufferCache() @@ -67,7 +68,11 @@ void RGBA32Buffer::clear() void RGBA32Buffer::zeroFill() { - m_image.fill(0); + if (m_pixmap.isNull() && !m_image.isNull()) { + m_pixmap = QPixmap(m_image.width(), m_image.height()); + m_image = QImage(); + } + m_pixmap.fill(QColor(0, 0, 0, 0)); } void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) @@ -76,6 +81,7 @@ void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) return; m_image = other.m_image; + m_pixmap = other.m_pixmap; m_size = other.m_size; m_hasAlpha = other.m_hasAlpha; } @@ -87,8 +93,9 @@ bool RGBA32Buffer::setSize(int newWidth, int newHeight) ASSERT(width() == 0 && height() == 0); m_size = IntSize(newWidth, newHeight); - m_image = QImage(newWidth, newHeight, QImage::Format_ARGB32_Premultiplied); - if (m_image.isNull()) + m_image = QImage(); + m_pixmap = QPixmap(newWidth, newHeight); + if (m_pixmap.isNull()) return false; // Zero the image. @@ -99,10 +106,11 @@ bool RGBA32Buffer::setSize(int newWidth, int newHeight) QPixmap* RGBA32Buffer::asNewNativeImage() const { - QPixmap pix = QPixmap::fromImage(m_image); - m_image = QImage(); - - return new QPixmap(pix); + if (m_pixmap.isNull() && !m_image.isNull()) { + m_pixmap = QPixmap::fromImage(m_image); + m_image = QImage(); + } + return new QPixmap(m_pixmap); } bool RGBA32Buffer::hasAlpha() const @@ -121,11 +129,12 @@ void RGBA32Buffer::setStatus(FrameStatus status) } // The image must not have format 8888 pre multiplied... -void RGBA32Buffer::setDecodedImage(const QImage& image) +void RGBA32Buffer::setPixmap(const QPixmap& pixmap) { - m_image = image; - m_size = image.size(); - m_hasAlpha = image.hasAlphaChannel(); + m_pixmap = pixmap; + m_image = QImage(); + m_size = pixmap.size(); + m_hasAlpha = pixmap.hasAlphaChannel(); } int RGBA32Buffer::width() const diff --git a/WebCore/platform/mac/EventLoopMac.mm b/WebCore/platform/mac/EventLoopMac.mm index 05ef33a..4c3c8a4 100644 --- a/WebCore/platform/mac/EventLoopMac.mm +++ b/WebCore/platform/mac/EventLoopMac.mm @@ -32,7 +32,10 @@ void EventLoop::cycle() { // FIXME: Should this use NSRunLoopCommonModes? Switching to NSRunLoopCommonModes causes Safari to hang in a tight loop. [NSApp setWindowsNeedUpdate:YES]; - NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]; + NSTimeInterval interval = [[NSDate date] timeIntervalSinceReferenceDate]; + interval += 0.05; + NSDate *untilDate = [NSDate dateWithTimeIntervalSinceReferenceDate:interval]; + NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:untilDate inMode:NSDefaultRunLoopMode dequeue:YES]; [NSApp sendEvent:event]; } diff --git a/WebCore/platform/mac/KeyEventMac.mm b/WebCore/platform/mac/KeyEventMac.mm index 7b8b2ce..30f1689 100644 --- a/WebCore/platform/mac/KeyEventMac.mm +++ b/WebCore/platform/mac/KeyEventMac.mm @@ -30,6 +30,7 @@ #import "KeyEventCocoa.h" #import "Logging.h" +#import "WindowsKeyboardCodes.h" #import <Carbon/Carbon.h> using namespace WTF; @@ -203,20 +204,19 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(NSEvent *event) , m_macEvent(event) { // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter. - if (m_windowsVirtualKeyCode == '\r') { + if (m_windowsVirtualKeyCode == VK_RETURN) { m_text = "\r"; m_unmodifiedText = "\r"; } - // The adjustments below are only needed in backward compatibility mode, but we cannot tell what mode we are in from here. - - // Turn 0x7F into 8, because backspace needs to always be 8. - if (m_text == "\x7F") + // AppKit sets text to "\x7F" for backspace, but the correct KeyboardEvent character code is 8. + if (m_windowsVirtualKeyCode == VK_BACK) { m_text = "\x8"; - if (m_unmodifiedText == "\x7F") m_unmodifiedText = "\x8"; - // Always use 9 for tab -- we don't want to use AppKit's different character for shift-tab. - if (m_windowsVirtualKeyCode == 9) { + } + + // Always use 9 for Tab -- we don't want to use AppKit's different character for shift-tab. + if (m_windowsVirtualKeyCode == VK_TAB) { m_text = "\x9"; m_unmodifiedText = "\x9"; } diff --git a/WebCore/platform/mac/PasteboardHelper.h b/WebCore/platform/mac/PasteboardHelper.h index 4ae964d..0e241bb 100644 --- a/WebCore/platform/mac/PasteboardHelper.h +++ b/WebCore/platform/mac/PasteboardHelper.h @@ -48,9 +48,9 @@ namespace WebCore { class PasteboardHelper { public: virtual ~PasteboardHelper() {} - virtual String urlFromPasteboard(const NSPasteboard*, String* title) const = 0; - virtual String plainTextFromPasteboard(const NSPasteboard*) const = 0; - virtual DOMDocumentFragment* fragmentFromPasteboard(const NSPasteboard*) const = 0; + virtual String urlFromPasteboard(NSPasteboard*, String* title) const = 0; + virtual String plainTextFromPasteboard(NSPasteboard*) const = 0; + virtual DOMDocumentFragment* fragmentFromPasteboard(NSPasteboard*) const = 0; virtual NSArray* insertablePasteboardTypes() const = 0; }; diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm index 03ede03..bba7cac 100644 --- a/WebCore/platform/mac/PasteboardMac.mm +++ b/WebCore/platform/mac/PasteboardMac.mm @@ -378,6 +378,10 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP } } if ([HTMLString length] != 0) { + // FIXME: FragmentScriptingNotAllowed is a HACK and should + // be removed or replaced with an enum with a better name. + // FragmentScriptingNotAllowed causes the Parser to remove children + // of <script> tags (so javascript doesn't show up in pastes). RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), HTMLString, "", FragmentScriptingNotAllowed); if (fragment) return fragment.release(); diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm index 7cc913f..20b662f 100644 --- a/WebCore/platform/mac/ThemeMac.mm +++ b/WebCore/platform/mac/ThemeMac.mm @@ -31,6 +31,7 @@ #import "LocalCurrentGraphicsContext.h" #import "ScrollView.h" #import "WebCoreSystemInterface.h" +#import <Carbon/Carbon.h> #include <wtf/StdLibExtras.h> using namespace std; @@ -100,19 +101,22 @@ static LengthSize sizeFromFont(const Font& font, const LengthSize& zoomedSize, f return sizeFromNSControlSize(controlSizeForFont(font), zoomedSize, zoomFactor, sizes); } -static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor) +static ControlSize controlSizeFromPixelSize(const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor) { - NSControlSize size; if (minZoomedSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomFactor) && minZoomedSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomFactor)) - size = NSRegularControlSize; - else if (minZoomedSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomFactor) && - minZoomedSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomFactor)) - size = NSSmallControlSize; - else - size = NSMiniControlSize; + return NSRegularControlSize; + if (minZoomedSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomFactor) && + minZoomedSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomFactor)) + return NSSmallControlSize; + return NSMiniControlSize; +} + +static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor) +{ + ControlSize size = controlSizeFromPixelSize(sizes, minZoomedSize, zoomFactor); if (size != [cell controlSize]) // Only update if we have to, since AppKit does work even if the size is the same. - [cell setControlSize:size]; + [cell setControlSize:(NSControlSize)size]; } static void updateStates(NSCell* cell, ControlStates states) @@ -149,6 +153,22 @@ static void updateStates(NSCell* cell, ControlStates states) // a view in a window whose key state can be detected. } +static ThemeDrawState convertControlStatesToThemeDrawState(ThemeButtonKind kind, ControlStates states) +{ + if (states & ReadOnlyState) + return kThemeStateUnavailableInactive; + if (!(states & EnabledState)) + return kThemeStateUnavailableInactive; + + // Do not process PressedState if !EnabledState or ReadOnlyState. + if (states & PressedState) { + if (kind == kThemeIncDecButton || kind == kThemeIncDecButtonSmall || kind == kThemeIncDecButtonMini) + return states & SpinUpState ? kThemeStatePressedUp : kThemeStatePressedDown; + return kThemeStatePressed; + } + return kThemeStateActive; +} + static IntRect inflateRect(const IntRect& zoomedRect, const IntSize& zoomedSize, const int* margins, float zoomFactor) { // Only do the inflation if the available width/height are too small. Otherwise try to @@ -469,29 +489,25 @@ static NSControlSize stepperControlSizeForFont(const Font& font) return NSMiniControlSize; } -static NSStepperCell* stepper(ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static void paintStepper(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView*) { - static NSStepperCell* cell = [[NSStepperCell alloc] init]; - setControlSize(cell, stepperSizes(), zoomedRect.size(), zoomFactor); + // We don't use NSStepperCell because there are no ways to draw an + // NSStepperCell with the up button highlighted. - updateStates(cell, states); - if (states & PressedState && states & SpinUpState) { - // FIXME: There is no way to draw a NSSteperCell with the up button hilighted. - // Disables the hilight of the down button if the up button is pressed. - [cell setHighlighted:NO]; - } - return cell; -} - -static void paintStepper(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) -{ - NSStepperCell* cell = stepper(states, zoomedRect, zoomFactor); + HIThemeButtonDrawInfo drawInfo; + drawInfo.version = 0; + drawInfo.state = convertControlStatesToThemeDrawState(kThemeIncDecButton, states); + drawInfo.adornment = kThemeAdornmentDefault; + ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor); + if (controlSize == NSSmallControlSize) + drawInfo.kind = kThemeIncDecButtonSmall; + else if (controlSize == NSMiniControlSize) + drawInfo.kind = kThemeIncDecButtonMini; + else + drawInfo.kind = kThemeIncDecButton; - context->save(); - NSControlSize controlSize = [cell controlSize]; - IntSize zoomedSize = stepperSizes()[controlSize]; IntRect rect(zoomedRect); - + context->save(); if (zoomFactor != 1.0f) { rect.setWidth(rect.width() / zoomFactor); rect.setHeight(rect.height() / zoomFactor); @@ -499,12 +515,15 @@ static void paintStepper(ControlStates states, GraphicsContext* context, const I context->scale(FloatSize(zoomFactor, zoomFactor)); context->translate(-rect.x(), -rect.y()); } - - BEGIN_BLOCK_OBJC_EXCEPTIONS - [cell drawWithFrame:NSRect(rect) inView:ThemeMac::ensuredView(scrollView)]; - [cell setControlView:nil]; - END_BLOCK_OBJC_EXCEPTIONS - + CGRect bounds(rect); + // Adjust 'bounds' so that HIThemeDrawButton(bounds,...) draws exactly on 'rect'. + CGRect backgroundBounds; + HIThemeGetButtonBackgroundBounds(&bounds, &drawInfo, &backgroundBounds); + if (bounds.origin.x != backgroundBounds.origin.x) + bounds.origin.x += bounds.origin.x - backgroundBounds.origin.x; + if (bounds.origin.y != backgroundBounds.origin.y) + bounds.origin.y += bounds.origin.y - backgroundBounds.origin.y; + HIThemeDrawButton(&bounds, &drawInfo, context->platformContext(), kHIThemeOrientationNormal, 0); context->restore(); } @@ -669,8 +688,7 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, I } case OuterSpinButtonPart: { static const int stepperMargin[4] = { 0, 0, 0, 0}; - NSCell *cell = stepper(states, zoomedRect, zoomFactor); - NSControlSize controlSize = [cell controlSize]; + ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor); IntSize zoomedSize = stepperSizes()[controlSize]; zoomedSize.setHeight(zoomedSize.height() * zoomFactor); zoomedSize.setWidth(zoomedSize.width() * zoomFactor); diff --git a/WebCore/platform/mac/WebCoreSystemInterface.h b/WebCore/platform/mac/WebCoreSystemInterface.h index 88472da..1f14311 100644 --- a/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/WebCore/platform/mac/WebCoreSystemInterface.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. + * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -59,30 +59,27 @@ typedef struct _NSRect NSRect; @class QTMovie; @class QTMovieView; #else -typedef struct NSArray NSArray; -typedef struct NSButtonCell NSButtonCell; -typedef struct NSData NSData; -typedef struct NSDate NSDate; -typedef struct NSEvent NSEvent; -typedef struct NSFont NSFont; -typedef struct NSImage NSImage; -typedef struct NSMenu NSMenu; -typedef struct NSMutableArray NSMutableArray; -typedef struct NSMutableURLRequest NSMutableURLRequest; -typedef struct NSURLRequest NSURLRequest; -typedef struct NSString NSString; -typedef struct NSTextFieldCell NSTextFieldCell; -typedef struct NSURLConnection NSURLConnection; -typedef struct NSURLResponse NSURLResponse; -typedef struct NSView NSView; -typedef struct objc_object *id; -typedef struct QTMovie QTMovie; -typedef struct QTMovieView QTMovieView; +class NSArray; +class NSButtonCell; +class NSData; +class NSDate; +class NSEvent; +class NSFont; +class NSImage; +class NSMenu; +class NSMutableArray; +class NSMutableURLRequest; +class NSURLRequest; +class NSString; +class NSTextFieldCell; +class NSURLConnection; +class NSURLResponse; +class NSView; +class QTMovie; +class QTMovieView; #endif -#ifdef __cplusplus extern "C" { -#endif // In alphabetical order. @@ -173,12 +170,12 @@ extern BOOL (*wkUseSharedMediaUI)(); #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) extern NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *); +extern void* wkGetHyphenationLocationBeforeIndex; #else extern void* wkNoteOpenPanelFiles; +extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); #endif -#ifdef __cplusplus } -#endif #endif diff --git a/WebCore/platform/mac/WebCoreSystemInterface.mm b/WebCore/platform/mac/WebCoreSystemInterface.mm index bb54ad0..2a06f15 100644 --- a/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -1,5 +1,5 @@ /* - * Copyright 2006, 2007, 2008, 2010 Apple Computer, Inc. All rights reserved. + * Copyright 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -112,6 +112,8 @@ BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *); #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *); +void* wkGetHyphenationLocationBeforeIndex; #else void* wkNoteOpenPanelFiles; +CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); #endif diff --git a/WebCore/platform/network/CredentialStorage.cpp b/WebCore/platform/network/CredentialStorage.cpp index 1adda69..a48af77 100644 --- a/WebCore/platform/network/CredentialStorage.cpp +++ b/WebCore/platform/network/CredentialStorage.cpp @@ -77,7 +77,7 @@ static String protectionSpaceMapKeyFromURL(const KURL& url) if (directoryURL.length() > directoryURLPathStart + 1) { int index = directoryURL.reverseFind('/'); ASSERT(index > 0); - directoryURL = directoryURL.substring(0, (static_cast<unsigned>(index) != directoryURLPathStart) ? index : directoryURLPathStart + 1); + directoryURL = directoryURL.substring(0, (static_cast<unsigned>(index) != directoryURLPathStart) ? static_cast<unsigned>(index) : directoryURLPathStart + 1); } ASSERT(directoryURL.length() == directoryURLPathStart + 1 || directoryURL[directoryURL.length() - 1] != '/'); diff --git a/WebCore/platform/network/CredentialStorage.h b/WebCore/platform/network/CredentialStorage.h index 21fcbad..ff7b5ee 100644 --- a/WebCore/platform/network/CredentialStorage.h +++ b/WebCore/platform/network/CredentialStorage.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SessionCredentialStorage_h -#define SessionCredentialStorage_h +#ifndef CredentialStorage_h +#define CredentialStorage_h namespace WebCore { @@ -49,4 +49,4 @@ public: } // namespace WebCore -#endif // SessionCredentialStorage_h +#endif // CredentialStorage_h diff --git a/WebCore/platform/network/FormData.cpp b/WebCore/platform/network/FormData.cpp index 431dbe4..9e4a227 100644 --- a/WebCore/platform/network/FormData.cpp +++ b/WebCore/platform/network/FormData.cpp @@ -204,9 +204,8 @@ void FormData::appendFileRange(const String& filename, long long start, long lon void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEncoding& encoding, bool isMultiPartForm, Document* document) { - FormDataBuilder formDataBuilder; if (isMultiPartForm) - m_boundary = formDataBuilder.generateUniqueBoundaryString(); + m_boundary = FormDataBuilder::generateUniqueBoundaryString(); Vector<char> encodedData; @@ -218,7 +217,7 @@ void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEnco ASSERT(key); if (isMultiPartForm) { Vector<char> header; - formDataBuilder.beginMultiPartHeader(header, m_boundary.data(), key->cstr()); + FormDataBuilder::beginMultiPartHeader(header, m_boundary.data(), key->cstr()); bool shouldGenerateFile = false; // If the current type is FILE, then we also need to include the filename @@ -238,7 +237,7 @@ void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEnco } // We have to include the filename=".." part in the header, even if the filename is empty - formDataBuilder.addFilenameToMultiPartHeader(header, encoding, fileName); + FormDataBuilder::addFilenameToMultiPartHeader(header, encoding, fileName); // If the item is sliced from a file, do not add the content type. #if ENABLE(BLOB_SLICE) @@ -252,11 +251,11 @@ void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEnco // MIME type of the generated file. String mimeType = MIMETypeRegistry::getMIMETypeForPath(fileName); if (!mimeType.isEmpty()) - formDataBuilder.addContentTypeToMultiPartHeader(header, mimeType.latin1()); + FormDataBuilder::addContentTypeToMultiPartHeader(header, mimeType.latin1()); } } - formDataBuilder.finishMultiPartHeader(header); + FormDataBuilder::finishMultiPartHeader(header); // Append body appendData(header.data(), header.size()); @@ -271,12 +270,12 @@ void FormData::appendKeyValuePairItems(const BlobItemList& items, const TextEnco if (encodedData.isEmpty() && key->cstr() == "isindex") FormDataBuilder::encodeStringAsFormData(encodedData, stringValue->cstr()); else - formDataBuilder.addKeyValuePairAsFormData(encodedData, key->cstr(), stringValue->cstr()); + FormDataBuilder::addKeyValuePairAsFormData(encodedData, key->cstr(), stringValue->cstr()); } } if (isMultiPartForm) - formDataBuilder.addBoundaryToMultiPartHeader(encodedData, m_boundary.data(), true); + FormDataBuilder::addBoundaryToMultiPartHeader(encodedData, m_boundary.data(), true); appendData(encodedData.data(), encodedData.size()); } diff --git a/WebCore/platform/network/FormDataBuilder.cpp b/WebCore/platform/network/FormDataBuilder.cpp index 13a457b..fb78b08 100644 --- a/WebCore/platform/network/FormDataBuilder.cpp +++ b/WebCore/platform/network/FormDataBuilder.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "FormDataBuilder.h" +#include "CSSHelper.h" #include "Document.h" #include "Frame.h" #include "FrameLoader.h" @@ -48,6 +49,12 @@ FormDataBuilder::~FormDataBuilder() { } +void FormDataBuilder::parseAction(const String& action) +{ + // FIXME: Can we parse into a KURL? + m_action = deprecatedParseURL(action); +} + void FormDataBuilder::parseEncodingType(const String& type) { if (type.contains("multipart", false) || type.contains("form-data", false)) { diff --git a/WebCore/platform/network/FormDataBuilder.h b/WebCore/platform/network/FormDataBuilder.h index 390a87b..559906e 100644 --- a/WebCore/platform/network/FormDataBuilder.h +++ b/WebCore/platform/network/FormDataBuilder.h @@ -45,12 +45,18 @@ public: bool isMultiPartForm() const { return m_isMultiPartForm; } void setIsMultiPartForm(bool value) { m_isMultiPartForm = value; } + const String& action() const { return m_action; } + + const String& target() const { return m_target; } + void setTarget(const String& target) { m_target = target; } + String encodingType() const { return m_encodingType; } void setEncodingType(const String& value) { m_encodingType = value; } String acceptCharset() const { return m_acceptCharset; } void setAcceptCharset(const String& value) { m_acceptCharset = value; } + void parseAction(const String&); void parseEncodingType(const String&); void parseMethodType(const String&); @@ -72,6 +78,8 @@ private: bool m_isPostMethod; bool m_isMultiPartForm; + String m_action; + String m_target; String m_encodingType; String m_acceptCharset; }; diff --git a/WebCore/platform/network/ResourceHandle.cpp b/WebCore/platform/network/ResourceHandle.cpp index de416fe..d3ee3f2 100644 --- a/WebCore/platform/network/ResourceHandle.cpp +++ b/WebCore/platform/network/ResourceHandle.cpp @@ -69,7 +69,7 @@ PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request void ResourceHandle::scheduleFailure(FailureType type) { - d->m_failureType = type; + d->m_scheduledFailureType = type; d->m_failureTimer.startOneShot(0); } @@ -78,11 +78,16 @@ void ResourceHandle::fireFailure(Timer<ResourceHandle>*) if (!client()) return; - switch (d->m_failureType) { + switch (d->m_scheduledFailureType) { + case NoFailure: + ASSERT_NOT_REACHED(); + return; case BlockedFailure: + d->m_scheduledFailureType = NoFailure; client()->wasBlocked(this); return; case InvalidURLFailure: + d->m_scheduledFailureType = NoFailure; client()->cannotShowURL(this); return; } @@ -138,6 +143,25 @@ void ResourceHandle::forceContentSniffing() shouldForceContentSniffing = true; } +void ResourceHandle::setDefersLoading(bool defers) +{ + LOG(Network, "Handle %p setDefersLoading(%s)", this, defers ? "true" : "false"); + + ASSERT(d->m_defersLoading != defers); // Deferring is not counted, so calling setDefersLoading() repeatedly is likely to be in error. + d->m_defersLoading = defers; + + if (defers) { + ASSERT(d->m_failureTimer.isActive() == (d->m_scheduledFailureType != NoFailure)); + if (d->m_failureTimer.isActive()) + d->m_failureTimer.stop(); + } else if (d->m_scheduledFailureType != NoFailure) { + ASSERT(!d->m_failureTimer.isActive()); + d->m_failureTimer.startOneShot(0); + } + + platformSetDefersLoading(defers); +} + #if !USE(SOUP) void ResourceHandle::prepareForURL(const KURL& url) { diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h index 4b60a33..e1c889a 100644 --- a/WebCore/platform/network/ResourceHandle.h +++ b/WebCore/platform/network/ResourceHandle.h @@ -102,6 +102,7 @@ private: ResourceHandle(const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff); enum FailureType { + NoFailure, BlockedFailure, InvalidURLFailure }; @@ -209,6 +210,8 @@ public: using RefCounted<ResourceHandle>::deref; private: + void platformSetDefersLoading(bool); + void scheduleFailure(FailureType); bool start(Frame*); diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h index f20f055..92b24cb 100644 --- a/WebCore/platform/network/ResourceHandleInternal.h +++ b/WebCore/platform/network/ResourceHandleInternal.h @@ -133,6 +133,7 @@ namespace WebCore { , m_needsSiteSpecificQuirks(false) , m_currentMacChallenge(nil) #endif + , m_scheduledFailureType(ResourceHandle::NoFailure) , m_failureTimer(loader, &ResourceHandle::fireFailure) { const KURL& url = m_request.url(); @@ -220,7 +221,7 @@ namespace WebCore { #endif AuthenticationChallenge m_currentWebChallenge; - ResourceHandle::FailureType m_failureType; + ResourceHandle::FailureType m_scheduledFailureType; Timer<ResourceHandle> m_failureTimer; }; diff --git a/WebCore/platform/network/android/ResourceHandleAndroid.cpp b/WebCore/platform/network/android/ResourceHandleAndroid.cpp index 1530a26..ba01e6a 100644 --- a/WebCore/platform/network/android/ResourceHandleAndroid.cpp +++ b/WebCore/platform/network/android/ResourceHandleAndroid.cpp @@ -84,6 +84,7 @@ bool ResourceHandle::supportsBufferedData() return false; } +<<<<<<< HEAD #if PLATFORM(ANDROID) // TODO: this needs upstreaming. void ResourceHandle::pauseLoad(bool pause) @@ -94,6 +95,9 @@ void ResourceHandle::pauseLoad(bool pause) #endif void ResourceHandle::setDefersLoading(bool defers) +======= +void ResourceHandle::platformSetDefersLoading(bool) +>>>>>>> webkit.org at r61871 { notImplemented(); } diff --git a/WebCore/bindings/js/JSWebSocketConstructor.h b/WebCore/platform/network/brew/SocketStreamError.h index 633e612..80dfa39 100644 --- a/WebCore/bindings/js/JSWebSocketConstructor.h +++ b/WebCore/platform/network/brew/SocketStreamError.h @@ -28,27 +28,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSWebSocketConstructor_h -#define JSWebSocketConstructor_h +#ifndef SocketStreamError_h +#define SocketStreamError_h -#if ENABLE(WEB_SOCKETS) - -#include "JSDOMBinding.h" +#include "SocketStreamErrorBase.h" namespace WebCore { -class JSWebSocketConstructor : public DOMConstructorObject { - public: - JSWebSocketConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; +class SocketStreamError : public SocketStreamErrorBase { +public: + SocketStreamError() { } + explicit SocketStreamError(int errorCode) + : SocketStreamErrorBase(errorCode) + { + } - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } }; } // namespace WebCore -#endif // ENABLE(WEB_SOCKETS) - -#endif // JSWebSocketConstructor_h +#endif // SocketStreamError_h diff --git a/WebCore/platform/network/brew/SocketStreamHandle.h b/WebCore/platform/network/brew/SocketStreamHandle.h new file mode 100644 index 0000000..d2d3e34 --- /dev/null +++ b/WebCore/platform/network/brew/SocketStreamHandle.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 SocketStreamHandle_h +#define SocketStreamHandle_h + +#include "SocketStreamHandleBase.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class AuthenticationChallenge; +class Credential; +class SocketStreamHandleClient; +class SocketStreamHandlePrivate; + +class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase { +public: + static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); } + + virtual ~SocketStreamHandle(); + +protected: + virtual int platformSend(const char* data, int length); + virtual void platformClose(); + +private: + SocketStreamHandle(const KURL&, SocketStreamHandleClient*); + + // No authentication for streams per se, but proxy may ask for credentials. + void didReceiveAuthenticationChallenge(const AuthenticationChallenge&); + void receivedCredential(const AuthenticationChallenge&, const Credential&); + void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&); + void receivedCancellation(const AuthenticationChallenge&); + + SocketStreamHandlePrivate* m_p; + friend class SocketStreamHandlePrivate; +}; + +} // namespace WebCore + +#endif // SocketStreamHandle_h diff --git a/WebCore/platform/network/brew/SocketStreamHandleBrew.cpp b/WebCore/platform/network/brew/SocketStreamHandleBrew.cpp new file mode 100644 index 0000000..5dc925e --- /dev/null +++ b/WebCore/platform/network/brew/SocketStreamHandleBrew.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2010 Company 100, 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 "SocketStreamHandle.h" + +#include "KURL.h" +#include "Logging.h" +#include "NotImplemented.h" +#include "SocketStreamHandleClient.h" +#include "SocketStreamHandlePrivate.h" +#include <wtf/Vector.h> +#include <wtf/brew/ShellBrew.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +static void socketStreamConnectCallback(void* user, int nError) +{ + SocketStreamHandlePrivate* p = reinterpret_cast<SocketStreamHandlePrivate*>(user); + + if (nError != AEE_NET_SUCCESS) { + p->socketError(nError); + return; + } + + p->socketConnected(); +} + +static void getHostByNameCallback(void* user) +{ + SocketStreamHandlePrivate* p = reinterpret_cast<SocketStreamHandlePrivate*>(user); + + if (p->m_dns.nResult < 1 || p->m_dns.nResult > AEEDNSMAXADDRS) { + p->socketError(p->m_dns.nResult); + return; + } + + p->connect(); +} + +static void socketReadableCallback(void* user) +{ + SocketStreamHandlePrivate* p = reinterpret_cast<SocketStreamHandlePrivate*>(user); + p->socketReadyRead(); +} + +static INetMgr* networkManager() +{ + static INetMgr* s_netMgr; + + if (!s_netMgr) { + IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; + ISHELL_CreateInstance(shell, AEECLSID_NET, reinterpret_cast<void**>(&s_netMgr)); + ASSERT(s_netMgr); + } + + return s_netMgr; +} + +SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamHandle, const KURL& url) +{ + m_streamHandle = streamHandle; + m_isSecure = url.protocolIs("wss"); + + m_socket.set(INETMGR_OpenSocket(networkManager(), AEE_SOCK_STREAM)); + if (!m_socket) + return; + + if (m_isSecure) + m_ssl = createInstance<ISSL>(AEECLSID_SSL); + + m_port = url.hasPort() ? url.port() : (m_isSecure ? 443 : 80); + + CALLBACK_Init(&m_dnsCallback, getHostByNameCallback, this); + m_dnsCallback.pfnCancel = 0; + + INETMGR_GetHostByName(networkManager(), &m_dns, url.host().latin1().data(), &m_dnsCallback); +} + +SocketStreamHandlePrivate::~SocketStreamHandlePrivate() +{ +} + +void SocketStreamHandlePrivate::socketConnected() +{ + if (m_streamHandle && m_streamHandle->client()) { + m_streamHandle->m_state = SocketStreamHandleBase::Open; + m_streamHandle->client()->didOpen(m_streamHandle); + } + + ISOCKET_Readable(m_socket.get(), socketReadableCallback, this); +} + +void SocketStreamHandlePrivate::socketReadyRead() +{ + if (m_streamHandle && m_streamHandle->client()) { + Vector<char> buffer(1024); + + int readSize = ISOCKET_Read(m_socket.get(), buffer.data(), buffer.size()); + if (readSize == AEE_NET_ERROR) { + socketError(ISOCKET_GetLastError(m_socket.get())); + return; + } + + m_streamHandle->client()->didReceiveData(m_streamHandle, buffer.data(), readSize); + } + + ISOCKET_Readable(m_socket.get(), socketReadableCallback, this); +} + +void SocketStreamHandlePrivate::connect() +{ + ISOCKET_Connect(m_socket.get(), m_dns.addrs[0], HTONS(m_port), socketStreamConnectCallback, this); +} + +int SocketStreamHandlePrivate::send(const char* data, int len) +{ + if (!m_socket) + return 0; + + int sentSize = ISOCKET_Write(m_socket.get(), reinterpret_cast<byte*>(const_cast<char*>(data)), len); + if (sentSize == AEE_NET_ERROR) { + socketError(ISOCKET_GetLastError(m_socket.get())); + return 0; + } + + return sentSize; +} + +void SocketStreamHandlePrivate::close() +{ + m_socket.clear(); +} + +void SocketStreamHandlePrivate::socketClosed() +{ + if (m_streamHandle && m_streamHandle->client()) { + SocketStreamHandle* streamHandle = m_streamHandle; + m_streamHandle = 0; + // This following call deletes _this_. Nothing should be after it. + streamHandle->client()->didClose(streamHandle); + } +} + +void SocketStreamHandlePrivate::socketError(int error) +{ + // FIXME - in the future, we might not want to treat all errors as fatal. + if (m_streamHandle && m_streamHandle->client()) { + SocketStreamHandle* streamHandle = m_streamHandle; + m_streamHandle = 0; + // This following call deletes _this_. Nothing should be after it. + streamHandle->client()->didClose(streamHandle); + } +} + +SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client) + : SocketStreamHandleBase(url, client) +{ + LOG(Network, "SocketStreamHandle %p new client %p", this, m_client); + m_p = new SocketStreamHandlePrivate(this, url); +} + +SocketStreamHandle::~SocketStreamHandle() +{ + LOG(Network, "SocketStreamHandle %p delete", this); + setClient(0); + delete m_p; +} + +int SocketStreamHandle::platformSend(const char* data, int len) +{ + LOG(Network, "SocketStreamHandle %p platformSend", this); + return m_p->send(data, len); +} + +void SocketStreamHandle::platformClose() +{ + LOG(Network, "SocketStreamHandle %p platformClose", this); + m_p->close(); +} + +void SocketStreamHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge&) +{ + notImplemented(); +} + +void SocketStreamHandle::receivedCredential(const AuthenticationChallenge&, const Credential&) +{ + notImplemented(); +} + +void SocketStreamHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&) +{ + notImplemented(); +} + +void SocketStreamHandle::receivedCancellation(const AuthenticationChallenge&) +{ + notImplemented(); +} + +} // namespace WebCore diff --git a/WebCore/platform/network/brew/SocketStreamHandlePrivate.h b/WebCore/platform/network/brew/SocketStreamHandlePrivate.h new file mode 100644 index 0000000..3c6fd18 --- /dev/null +++ b/WebCore/platform/network/brew/SocketStreamHandlePrivate.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Company 100, 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 SocketStreamHandlePrivate_h +#define SocketStreamHandlePrivate_h + +#include "SocketStreamHandleBase.h" + +#include <AEENet.h> +#include <AEESSL.h> +#include <wtf/OwnPtr.h> + +namespace WebCore { + +class SocketStreamHandleClient; + +class SocketStreamHandlePrivate { +public: + SocketStreamHandlePrivate(SocketStreamHandle*, const KURL&); + ~SocketStreamHandlePrivate(); + + void socketConnected(); + void socketReadyRead(); + void socketClosed(); + void socketError(int); + + void connect(); + int send(const char* data, int len); + void close(); + + AEEDNSResult m_dns; + AEECallback m_dnsCallback; + unsigned int m_port; + bool m_isSecure; + + OwnPtr<ISocket> m_socket; + OwnPtr<ISSL> m_ssl; + SocketStreamHandle* m_streamHandle; +}; + +} + +#endif // SocketStreamHandlePrivate_h diff --git a/WebCore/platform/network/cf/AuthenticationCF.h b/WebCore/platform/network/cf/AuthenticationCF.h index 55f3e5f..b945ca1 100644 --- a/WebCore/platform/network/cf/AuthenticationCF.h +++ b/WebCore/platform/network/cf/AuthenticationCF.h @@ -26,8 +26,9 @@ #ifndef AuthenticationCF_h #define AuthenticationCF_h +#include <CFNetwork/CFURLCredentialPriv.h> + typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef; -typedef struct _CFURLCredential* CFURLCredentialRef; typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef; namespace WebCore { diff --git a/WebCore/platform/network/cf/DNSCFNet.cpp b/WebCore/platform/network/cf/DNSCFNet.cpp index c17b59f..bda9e41 100644 --- a/WebCore/platform/network/cf/DNSCFNet.cpp +++ b/WebCore/platform/network/cf/DNSCFNet.cpp @@ -49,12 +49,18 @@ namespace WebCore { const int namesToResolveImmediately = 4; // Coalesce prefetch requests for this long before sending them out. -const double coalesceDelay = 1.0; +const double coalesceDelayInSeconds = 1.0; + +// Sending many DNS requests at once can overwhelm some gateways. CFHost doesn't currently throttle for us, see <rdar://8105550>. +const int maxSimultaneousRequests = 8; // For a page has links to many outside sites, it is likely that the system DNS resolver won't be able to cache them all anyway, and we don't want -// to negatively affect other appications' performance, by pushing their cached entries out, too. +// to negatively affect other applications' performance by pushing their cached entries out. // If we end up with lots of names to prefetch, some will be dropped. -const int maxRequestsToSend = 64; +const int maxRequestsToQueue = 64; + +// If there were queued names that couldn't be sent simultaneously, check the state of resolvers after this delay. +const double retryResolvingInSeconds = 0.1; class DNSResolveQueue : public TimerBase { public: @@ -92,9 +98,14 @@ void DNSResolveQueue::add(const String& name) } atomicDecrement(&m_requestsInFlight); } - m_names.add(name); - if (!isActive()) - startOneShot(coalesceDelay); + + // It's better to not prefetch some names than to clog the queue. + // Dropping the newest names, because on a single page, these are likely to be below oldest ones. + if (m_names.size() < maxRequestsToQueue) { + m_names.add(name); + if (!isActive()) + startOneShot(coalesceDelayInSeconds); + } } void DNSResolveQueue::decrementRequestCount() @@ -104,15 +115,17 @@ void DNSResolveQueue::decrementRequestCount() void DNSResolveQueue::fired() { - int requestsAllowed = maxRequestsToSend - m_requestsInFlight; + int requestsAllowed = maxSimultaneousRequests - m_requestsInFlight; - for (HashSet<String>::iterator iter = m_names.begin(); iter != m_names.end() && requestsAllowed > 0; ++iter, --requestsAllowed) { + for (; !m_names.isEmpty() && requestsAllowed > 0; --requestsAllowed) { atomicIncrement(&m_requestsInFlight); - resolve(*iter); + HashSet<String>::iterator currentName = m_names.begin(); + resolve(*currentName); + m_names.remove(currentName); } - // It's better to skip some names than to clog the queue. - m_names.clear(); + if (!m_names.isEmpty()) + startOneShot(retryResolvingInSeconds); } static void clientCallback(CFHostRef theHost, CFHostInfoType, const CFStreamError*, void*) diff --git a/WebCore/platform/network/cf/FormDataStreamCFNet.h b/WebCore/platform/network/cf/FormDataStreamCFNet.h index 254a2cd..e57a0d1 100644 --- a/WebCore/platform/network/cf/FormDataStreamCFNet.h +++ b/WebCore/platform/network/cf/FormDataStreamCFNet.h @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FormDataStreamCFNet_h_ -#define FormDataStreamCFNet_h_ +#ifndef FormDataStreamCFNet_h +#define FormDataStreamCFNet_h #include <CoreFoundation/CoreFoundation.h> #include <wtf/Forward.h> @@ -41,4 +41,4 @@ namespace WebCore { PassRefPtr<FormData> httpBodyFromRequest(CFURLRequestRef); } -#endif FormDataStreamCFNet_h_ +#endif FormDataStreamCFNet_h diff --git a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp index e54f6d6..f126d27 100644 --- a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp +++ b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp @@ -626,7 +626,7 @@ void ResourceHandle::setClientCertificate(const String& host, CFDataRef cert) clientCerts().set(host.lower(), cert); } -void ResourceHandle::setDefersLoading(bool defers) +void ResourceHandle::platformSetDefersLoading(bool defers) { if (!d->m_connection) return; diff --git a/WebCore/platform/network/chromium/ResourceResponse.h b/WebCore/platform/network/chromium/ResourceResponse.h index f80bf42..852b9f5 100644 --- a/WebCore/platform/network/chromium/ResourceResponse.h +++ b/WebCore/platform/network/chromium/ResourceResponse.h @@ -21,7 +21,7 @@ * 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. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ResourceResponse_h @@ -41,6 +41,7 @@ namespace WebCore { , m_isMultipartPayload(false) , m_wasFetchedViaSPDY(false) , m_wasNpnNegotiated(false) + , m_wasAlternateProtocolAvailable(false) , m_wasFetchedViaProxy(false) , m_responseTime(0) { @@ -53,6 +54,7 @@ namespace WebCore { , m_isMultipartPayload(false) , m_wasFetchedViaSPDY(false) , m_wasNpnNegotiated(false) + , m_wasAlternateProtocolAvailable(false) , m_wasFetchedViaProxy(false) , m_responseTime(0) { @@ -76,6 +78,15 @@ namespace WebCore { bool wasNpnNegotiated() const { return m_wasNpnNegotiated; } void setWasNpnNegotiated(bool value) { m_wasNpnNegotiated = value; } + bool wasAlternateProtocolAvailable() const + { + return m_wasAlternateProtocolAvailable; + } + void setWasAlternateProtocolAvailable(bool value) + { + m_wasAlternateProtocolAvailable = value; + } + bool wasFetchedViaProxy() const { return m_wasFetchedViaProxy; } void setWasFetchedViaProxy(bool value) { m_wasFetchedViaProxy = value; } @@ -119,6 +130,10 @@ namespace WebCore { // Was the resource fetched over a channel which used TLS/Next-Protocol-Negotiation (also SPDY related). bool m_wasNpnNegotiated; + // Was the resource fetched over a channel which specified "Alternate-Protocol" + // (e.g.: Alternate-Protocol: 443:npn-spdy/1). + bool m_wasAlternateProtocolAvailable; + // Was the resource fetched over an explicit proxy (HTTP, SOCKS, etc). bool m_wasFetchedViaProxy; diff --git a/WebCore/platform/network/curl/FormDataStreamCurl.h b/WebCore/platform/network/curl/FormDataStreamCurl.h index 85ca8b0..bba1547 100644 --- a/WebCore/platform/network/curl/FormDataStreamCurl.h +++ b/WebCore/platform/network/curl/FormDataStreamCurl.h @@ -22,8 +22,8 @@ * (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 FormatDataStreamCurl_h -#define FormatDataStreamCurl_h +#ifndef FormDataStreamCurl_h +#define FormDataStreamCurl_h #include "config.h" diff --git a/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/WebCore/platform/network/curl/ResourceHandleCurl.cpp index 05134a5..1fbafbd 100644 --- a/WebCore/platform/network/curl/ResourceHandleCurl.cpp +++ b/WebCore/platform/network/curl/ResourceHandleCurl.cpp @@ -153,34 +153,24 @@ void ResourceHandle::setClientCertificate(const String& host, CFDataRef cert) } #endif -void ResourceHandle::setDefersLoading(bool defers) +void ResourceHandle::platformSetDefersLoading(bool defers) { - if (d->m_defersLoading == defers) - return; - #if LIBCURL_VERSION_NUM > 0x071200 if (!d->m_handle) - d->m_defersLoading = defers; - else if (defers) { + return; + + if (defers) { CURLcode error = curl_easy_pause(d->m_handle, CURLPAUSE_ALL); // If we could not defer the handle, so don't do it. if (error != CURLE_OK) return; - - d->m_defersLoading = defers; } else { - // We need to set defersLoading before restarting a connection - // or libcURL will call the callbacks in curl_easy_pause and - // we would ASSERT. - d->m_defersLoading = defers; - CURLcode error = curl_easy_pause(d->m_handle, CURLPAUSE_CONT); if (error != CURLE_OK) // Restarting the handle has failed so just cancel it. cancel(); } #else - d->m_defersLoading = defers; LOG_ERROR("Deferred loading is implemented if libcURL version is above 7.18.0"); #endif } diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm index 0454dd6..f14c108 100644 --- a/WebCore/platform/network/mac/ResourceHandleMac.mm +++ b/WebCore/platform/network/mac/ResourceHandleMac.mm @@ -325,11 +325,8 @@ void ResourceHandle::cancel() [d->m_connection.get() cancel]; } -void ResourceHandle::setDefersLoading(bool defers) +void ResourceHandle::platformSetDefersLoading(bool defers) { - LOG(Network, "Handle %p setDefersLoading(%s)", this, defers ? "true" : "false"); - - d->m_defersLoading = defers; if (d->m_connection) wkSetNSURLConnectionDefersCallbacks(d->m_connection.get(), defers); } diff --git a/WebCore/platform/network/qt/DnsPrefetchHelper.h b/WebCore/platform/network/qt/DnsPrefetchHelper.h index e355025..892a3fb 100644 --- a/WebCore/platform/network/qt/DnsPrefetchHelper.h +++ b/WebCore/platform/network/qt/DnsPrefetchHelper.h @@ -16,8 +16,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef DNSPREFETCHHELPER_H -#define DNSPREFETCHHELPER_H +#ifndef DnsPrefetchHelper_h +#define DnsPrefetchHelper_h #include <QObject> #include <QCache> @@ -83,4 +83,4 @@ namespace WebCore { } -#endif // DNSPREFETCHHELPER_H +#endif // DnsPrefetchHelper_h diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.h b/WebCore/platform/network/qt/QNetworkReplyHandler.h index 1abad4e..9f8217d 100644 --- a/WebCore/platform/network/qt/QNetworkReplyHandler.h +++ b/WebCore/platform/network/qt/QNetworkReplyHandler.h @@ -16,8 +16,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef QNETWORKREPLYHANDLER_H -#define QNETWORKREPLYHANDLER_H +#ifndef QNetworkReplyHandler_h +#define QNetworkReplyHandler_h #include <QObject> @@ -113,4 +113,4 @@ private: } -#endif // QNETWORKREPLYHANDLER_H +#endif // QNetworkReplyHandler_h diff --git a/WebCore/platform/network/qt/ResourceHandleQt.cpp b/WebCore/platform/network/qt/ResourceHandleQt.cpp index aaa306a..b35df6b 100644 --- a/WebCore/platform/network/qt/ResourceHandleQt.cpp +++ b/WebCore/platform/network/qt/ResourceHandleQt.cpp @@ -210,10 +210,8 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S } -void ResourceHandle::setDefersLoading(bool defers) +void ResourceHandle::platformSetDefersLoading(bool defers) { - d->m_defersLoading = defers; - if (d->m_job) d->m_job->setLoadMode(QNetworkReplyHandler::LoadMode(defers)); } diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index e2c67bc..15d914f 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -637,9 +637,8 @@ bool ResourceHandle::supportsBufferedData() return false; } -void ResourceHandle::setDefersLoading(bool defers) +void ResourceHandle::platformSetDefersLoading(bool) { - d->m_defersLoading = defers; notImplemented(); } diff --git a/WebCore/platform/network/win/NetworkStateNotifierWin.cpp b/WebCore/platform/network/win/NetworkStateNotifierWin.cpp index 5cc381d..1620669 100644 --- a/WebCore/platform/network/win/NetworkStateNotifierWin.cpp +++ b/WebCore/platform/network/win/NetworkStateNotifierWin.cpp @@ -88,6 +88,10 @@ void NetworkStateNotifier::callAddressChanged(void* context) void CALLBACK NetworkStateNotifier::addrChangeCallback(void* context, BOOLEAN timedOut) { + // NotifyAddrChange only notifies us of a single address change. Now that we've been notified, + // we need to call it again so we'll get notified the *next* time. + static_cast<NetworkStateNotifier*>(context)->registerForAddressChange(); + callOnMainThread(callAddressChanged, context); } diff --git a/WebCore/platform/network/win/ResourceHandleWin.cpp b/WebCore/platform/network/win/ResourceHandleWin.cpp index aff316e..63c84a9 100644 --- a/WebCore/platform/network/win/ResourceHandleWin.cpp +++ b/WebCore/platform/network/win/ResourceHandleWin.cpp @@ -25,9 +25,6 @@ #include "config.h" #include "ResourceHandle.h" -#include "ResourceHandleClient.h" -#include "ResourceHandleInternal.h" -#include "ResourceHandleWin.h" #include "DocLoader.h" #include "Document.h" @@ -35,7 +32,11 @@ #include "FrameLoader.h" #include "Page.h" #include "ResourceError.h" +#include "ResourceHandleClient.h" +#include "ResourceHandleInternal.h" +#include "ResourceHandleWin.h" #include "Timer.h" +#include "WebCoreInstanceHandle.h" #include <wtf/text/CString.h> #include <windows.h> #include <wininet.h> @@ -113,12 +114,12 @@ static void initializeOffScreenResourceHandleWindow() memset(&wcex, 0, sizeof(WNDCLASSEX)); wcex.cbSize = sizeof(WNDCLASSEX); wcex.lpfnWndProc = ResourceHandleWndProc; - wcex.hInstance = Page::instanceHandle(); + wcex.hInstance = WebCore::instanceHandle(); wcex.lpszClassName = kResourceHandleWindowClassName; RegisterClassEx(&wcex); transferJobWindowHandle = CreateWindow(kResourceHandleWindowClassName, 0, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - HWND_MESSAGE, 0, Page::instanceHandle(), 0); + HWND_MESSAGE, 0, WebCore::instanceHandle(), 0); } ResourceHandleInternal::~ResourceHandleInternal() @@ -144,9 +145,9 @@ void ResourceHandle::onHandleCreated(LPARAM lParam) return; } - if (method() == "POST") { + if (request().httpMethod() == "POST") { // FIXME: Too late to set referrer properly. - String urlStr = url().path(); + String urlStr = request().url().path(); int fragmentIndex = urlStr.find('#'); if (fragmentIndex != -1) urlStr = urlStr.left(fragmentIndex); @@ -166,7 +167,7 @@ void ResourceHandle::onHandleCreated(LPARAM lParam) } } } else if (!d->m_secondaryHandle) { - assert(method() == "POST"); + assert(request().httpMethod() == "POST"); d->m_secondaryHandle = HINTERNET(lParam); // Need to actually send the request now. @@ -175,18 +176,18 @@ void ResourceHandle::onHandleCreated(LPARAM lParam) headers += d->m_postReferrer; headers += "\n"; const CString& headersLatin1 = headers.latin1(); - String formData = postData()->flattenToString(); + String formData = request().httpBody()->flattenToString(); INTERNET_BUFFERSA buffers; memset(&buffers, 0, sizeof(buffers)); buffers.dwStructSize = sizeof(INTERNET_BUFFERSA); - buffers.lpcszHeader = headersLatin1; + buffers.lpcszHeader = headersLatin1.data(); buffers.dwHeadersLength = headers.length(); buffers.dwBufferTotal = formData.length(); d->m_bytesRemainingToWrite = formData.length(); d->m_formDataString = (char*)malloc(formData.length()); d->m_formDataLength = formData.length(); - strncpy(d->m_formDataString, formData.latin1(), formData.length()); + strncpy(d->m_formDataString, formData.latin1().data(), formData.length()); d->m_writing = true; HttpSendRequestExA(d->m_secondaryHandle, &buffers, 0, 0, (DWORD_PTR)d->m_jobId); // FIXME: add proper error handling @@ -223,7 +224,7 @@ void ResourceHandle::onRequestComplete(LPARAM lParam) return; } - HINTERNET handle = (method() == "POST") ? d->m_secondaryHandle : d->m_resourceHandle; + HINTERNET handle = (request().httpMethod() == "POST") ? d->m_secondaryHandle : d->m_resourceHandle; BOOL ok = FALSE; static const int bufferSize = 32768; @@ -260,7 +261,11 @@ void ResourceHandle::onRequestComplete(LPARAM lParam) InternetGetLastResponseInfo(&platformData.error, platformData.errorString, &errorStringChars); } } - _RPTF1(_CRT_WARN, "Load error: %i\n", error); +#ifdef RESOURCE_LOADER_DEBUG + char buf[64]; + _snprintf(buf, sizeof(buf), "Load error: %i\n", error); + OutputDebugStringA(buf); +#endif } if (d->m_secondaryHandle) @@ -309,8 +314,8 @@ static void __stdcall transferJobStatusCallback(HINTERNET internetHandle, // need to block the redirect at this point so the application can // decide whether or not to follow the redirect) msg = requestRedirectedMessage; - lParam = (LPARAM) new StringImpl((const UChar*) statusInformation, - statusInformationLength); + lParam = (LPARAM) StringImpl::create((const UChar*) statusInformation, + statusInformationLength).releaseRef(); break; case INTERNET_STATUS_USER_INPUT_REQUIRED: // FIXME: prompt the user if necessary @@ -327,8 +332,8 @@ static void __stdcall transferJobStatusCallback(HINTERNET internetHandle, bool ResourceHandle::start(Frame* frame) { ref(); - if (url().isLocalFile()) { - String path = url().path(); + if (request().url().isLocalFile()) { + String path = request().url().path(); // windows does not enjoy a leading slash on paths if (path[0] == '/') path = path.substring(1); @@ -347,7 +352,7 @@ bool ResourceHandle::start(Frame* frame) } else { static HINTERNET internetHandle = 0; if (!internetHandle) { - String userAgentStr = frame->loader()->userAgent() + String("", 1); + String userAgentStr = frame->loader()->userAgent(request().url()) + String("", 1); LPCWSTR userAgent = reinterpret_cast<const WCHAR*>(userAgentStr.characters()); // leak the Internet for now internetHandle = InternetOpen(userAgent, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, INTERNET_FLAG_ASYNC); @@ -371,17 +376,17 @@ bool ResourceHandle::start(Frame* frame) // InternetConnect followed by HttpSendRequest. HINTERNET urlHandle; String referrer = frame->loader()->referrer(); - if (method() == "POST") { + if (request().httpMethod() == "POST") { d->m_postReferrer = referrer; - String host = url().host(); + String host = request().url().host(); urlHandle = InternetConnectA(internetHandle, host.latin1().data(), - url().port(), + request().url().port(), NULL, // no username NULL, // no password INTERNET_SERVICE_HTTP, flags, (DWORD_PTR)d->m_jobId); } else { - String urlStr = url().string(); + String urlStr = request().url().string(); int fragmentIndex = urlStr.find('#'); if (fragmentIndex != -1) urlStr = urlStr.left(fragmentIndex); diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp index c98c79a..485d0d1 100644 --- a/WebCore/platform/qt/ClipboardQt.cpp +++ b/WebCore/platform/qt/ClipboardQt.cpp @@ -283,7 +283,7 @@ void ClipboardQt::writeRange(Range* range, Frame* frame) QString text = frame->selectedText(); text.replace(QChar(0xa0), QLatin1Char(' ')); m_writableData->setText(text); - m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange)); + m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange, false, AbsoluteURLs)); #ifndef QT_NO_CLIPBOARD if (!isForDragging()) QApplication::clipboard()->setMimeData(m_writableData); diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp index 86d2cfe..e1e6d84 100644 --- a/WebCore/platform/qt/PasteboardQt.cpp +++ b/WebCore/platform/qt/PasteboardQt.cpp @@ -66,7 +66,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, md->setText(text); QString html = QLatin1String("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>"); - html += createMarkup(selectedRange, 0, AnnotateForInterchange); + html += createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs); html += QLatin1String("</body></html>"); md->setHtml(html); diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h index 9e32d31..1f508bb 100644 --- a/WebCore/platform/qt/QWebPageClient.h +++ b/WebCore/platform/qt/QWebPageClient.h @@ -87,11 +87,13 @@ public: virtual QObject* pluginParent() const = 0; virtual QStyle* style() const = 0; - + virtual QRectF graphicsItemVisibleRect() const { return QRectF(); } - + virtual bool viewResizesToContentsEnabled() const = 0; + virtual QRectF windowRect() const = 0; + protected: #ifndef QT_NO_CURSOR virtual QCursor cursor() const = 0; diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp index cd2a467..78bbfeb 100644 --- a/WebCore/platform/sql/SQLiteStatement.cpp +++ b/WebCore/platform/sql/SQLiteStatement.cpp @@ -61,7 +61,7 @@ SQLiteStatement::~SQLiteStatement() int SQLiteStatement::prepare() { ASSERT(!m_isPrepared); - const void* tail; + const void* tail = 0; LOG(SQLDatabase, "SQL - prepare - %s", m_query.ascii().data()); String strippedQuery = m_query.stripWhiteSpace(); int error = sqlite3_prepare16_v2(m_database.sqlite3Handle(), strippedQuery.charactersWithNullTermination(), -1, &m_statement, &tail); @@ -77,7 +77,7 @@ int SQLiteStatement::prepare() if (error != SQLITE_OK) LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", error, m_query.ascii().data(), sqlite3_errmsg(m_database.sqlite3Handle())); const UChar* ch = static_cast<const UChar*>(tail); - if (*ch) + if (ch && *ch) error = SQLITE_ERROR; #ifndef NDEBUG m_isPrepared = error == SQLITE_OK; diff --git a/WebCore/platform/text/BidiContext.cpp b/WebCore/platform/text/BidiContext.cpp index 59db7bd..fb6b8cf 100644 --- a/WebCore/platform/text/BidiContext.cpp +++ b/WebCore/platform/text/BidiContext.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * Copyright (C) 2003, 2004, 2006, 2007, 2009 Apple Inc. All right reserved. + * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 Apple Inc. All right reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,35 +22,40 @@ #include "config.h" #include "BidiContext.h" -#include <wtf/StdLibExtras.h> - namespace WebCore { using namespace WTF::Unicode; +inline PassRefPtr<BidiContext> BidiContext::createUncached(unsigned char level, Direction direction, bool override, BidiContext* parent) +{ + return adoptRef(new BidiContext(level, direction, override, parent)); +} + PassRefPtr<BidiContext> BidiContext::create(unsigned char level, Direction direction, bool override, BidiContext* parent) { ASSERT(direction == (level % 2 ? RightToLeft : LeftToRight)); if (parent) - return adoptRef(new BidiContext(level, direction, override, parent)); + return createUncached(level, direction, override, parent); ASSERT(level <= 1); if (!level) { - DEFINE_STATIC_LOCAL(BidiContext, ltrContext, (0, LeftToRight, false, 0)); - if (!override) - return <rContext; + if (!override) { + static BidiContext* ltrContext = createUncached(0, LeftToRight, false, 0).releaseRef(); + return ltrContext; + } - DEFINE_STATIC_LOCAL(BidiContext, ltrOverrideContext, (0, LeftToRight, true, 0)); - return <rOverrideContext; + static BidiContext* ltrOverrideContext = createUncached(0, LeftToRight, true, 0).releaseRef(); + return ltrOverrideContext; } - DEFINE_STATIC_LOCAL(BidiContext, rtlContext, (1, RightToLeft, false, 0)); - if (!override) - return &rtlContext; + if (!override) { + static BidiContext* rtlContext = createUncached(1, RightToLeft, false, 0).releaseRef(); + return rtlContext; + } - DEFINE_STATIC_LOCAL(BidiContext, rtlOverrideContext, (1, RightToLeft, true, 0)); - return &rtlOverrideContext; + static BidiContext* rtlOverrideContext = createUncached(1, RightToLeft, true, 0).releaseRef(); + return rtlOverrideContext; } bool operator==(const BidiContext& c1, const BidiContext& c2) diff --git a/WebCore/platform/text/BidiContext.h b/WebCore/platform/text/BidiContext.h index 8791605..b52815f 100644 --- a/WebCore/platform/text/BidiContext.h +++ b/WebCore/platform/text/BidiContext.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * Copyright (C) 2003, 2004, 2006, 2007, 2009 Apple Inc. All right reserved. + * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 Apple Inc. All right reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -49,6 +49,8 @@ private: { } + static PassRefPtr<BidiContext> createUncached(unsigned char level, WTF::Unicode::Direction, bool override, BidiContext* parent); + unsigned char m_level; unsigned m_direction : 5; // Direction bool m_override : 1; diff --git a/WebCore/platform/text/CharacterNames.h b/WebCore/platform/text/CharacterNames.h index 687bfb4..f06246c 100644 --- a/WebCore/platform/text/CharacterNames.h +++ b/WebCore/platform/text/CharacterNames.h @@ -42,6 +42,7 @@ const UChar ethiopicPrefaceColon = 0x1366; const UChar hebrewPunctuationGeresh = 0x05F3; const UChar hebrewPunctuationGershayim = 0x05F4; const UChar horizontalEllipsis = 0x2026; +const UChar hyphen = 0x2010; const UChar hyphenMinus = 0x002D; const UChar ideographicComma = 0x3001; const UChar ideographicFullStop = 0x3002; diff --git a/WebCore/platform/text/Hyphenation.cpp b/WebCore/platform/text/Hyphenation.cpp new file mode 100644 index 0000000..8ef5a25 --- /dev/null +++ b/WebCore/platform/text/Hyphenation.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Hyphenation.h" + +#include "NotImplemented.h" + +namespace WebCore { + +size_t lastHyphenLocation(const UChar* /* characters */, size_t /* length */, size_t /* beforeIndex */) +{ + notImplemented(); + return 0; +} + +} // namespace WebCore diff --git a/WebCore/platform/text/Hyphenation.h b/WebCore/platform/text/Hyphenation.h new file mode 100644 index 0000000..dbcbe69 --- /dev/null +++ b/WebCore/platform/text/Hyphenation.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Hyphenation_h +#define Hyphenation_h + +#include <wtf/unicode/Unicode.h> + +namespace WebCore { + +size_t lastHyphenLocation(const UChar*, size_t length, size_t beforeIndex); + +} // namespace WebCore + +#endif // Hyphenation_h diff --git a/WebCore/platform/text/cf/HyphenationCF.cpp b/WebCore/platform/text/cf/HyphenationCF.cpp new file mode 100644 index 0000000..50ba4c8 --- /dev/null +++ b/WebCore/platform/text/cf/HyphenationCF.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Hyphenation.h" + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + +#include "TextBreakIteratorInternalICU.h" +#include <wtf/RetainPtr.h> + +namespace WebCore { + +static CFLocaleRef createCurrentSearchLocale() +{ + RetainPtr<CFStringRef> localeIdentifier(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, (const UInt8*)currentSearchLocaleID(), strlen(currentSearchLocaleID()), kCFStringEncodingASCII, false, kCFAllocatorNull)); + return CFLocaleCreate(kCFAllocatorDefault, localeIdentifier.get()); +} + +size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex) +{ + RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull)); + + static CFLocaleRef locale = createCurrentSearchLocale(); + + CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale, 0); + return result == kCFNotFound ? 0 : result; +} + +} // namespace WebCore + +#endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) diff --git a/WebCore/platform/text/mac/HyphenationMac.mm b/WebCore/platform/text/mac/HyphenationMac.mm new file mode 100644 index 0000000..e64477f --- /dev/null +++ b/WebCore/platform/text/mac/HyphenationMac.mm @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "Hyphenation.h" + +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) + +#import "TextBreakIteratorInternalICU.h" +#import "WebCoreSystemInterface.h" +#import <wtf/RetainPtr.h> + +namespace WebCore { + +size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex) +{ + static bool localeIsEnglish = !strcmp("en", currentSearchLocaleID()); + if (!localeIsEnglish) + return 0; + + RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull)); + return wkGetHyphenationLocationBeforeIndex(string.get(), beforeIndex); +} + +} // namespace WebCore + +#endif // defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) diff --git a/WebCore/platform/text/wince/TextCodecWinCE.cpp b/WebCore/platform/text/wince/TextCodecWinCE.cpp new file mode 100644 index 0000000..644b12f --- /dev/null +++ b/WebCore/platform/text/wince/TextCodecWinCE.cpp @@ -0,0 +1,483 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, 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 library is distributed in the hope that i 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 "TextCodecWinCE.h" + +#include "ce_textcodecs.h" +#include "FontCache.h" +#include "PlatformString.h" +#include "StringHash.h" +#include <mlang.h> +#include <winbase.h> +#include <winnls.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/text/CString.h> +#include <wtf/unicode/UTF8.h> + +namespace WebCore { + +struct CharsetInfo { + CString m_name; + String m_friendlyName; + UINT m_codePage; + Vector<CString> m_aliases; + bool m_usesNativeCodec; +}; + +class LanguageManager { +private: + LanguageManager(); + + friend LanguageManager& languageManager(); +}; + +// Usage: a lookup table used to get CharsetInfo with code page ID. +// Key: code page ID. Value: charset information. +static HashMap<UINT, CString>& codePageCharsets() +{ + static HashMap<UINT, CString> cc; + return cc; +} + +static HashMap<String, CharsetInfo>& knownCharsets() +{ + static HashMap<String, CharsetInfo> kc; + return kc; +} + +// Usage: a map that stores charsets that are supported by system. Sorted by name. +// Key: charset. Value: code page ID. +typedef HashSet<String> CharsetSet; +static CharsetSet& supportedCharsets() +{ + static CharsetSet sl; + return sl; +} + +static LanguageManager& languageManager() +{ + static LanguageManager lm; + return lm; +} + +static void addCharset(UINT codePage, const char* charsetName, const wchar_t* friendlyName, const char* charsetAliases, bool nativeSupport = false) +{ + CharsetInfo info; + info.m_codePage = codePage; + info.m_name = charsetName; + info.m_friendlyName = friendlyName; + info.m_usesNativeCodec = nativeSupport; + const char* begin = charsetAliases; + for (;;) { + const char* end = strchr(begin, '|'); + CString alias = end ? CString(begin, end - begin) : begin; + if (alias.length()) + info.m_aliases.append(alias); + if (!end) + break; + begin = end + 1; + } + knownCharsets().set(info.m_name.data(), info); + if (codePage != CP_ACP) + codePageCharsets().set(codePage, info.m_name); +} + +LanguageManager::LanguageManager() +{ + // 437, 708, 709, 710, 720, 737, 775, 850, 852 + addCharset(932, "SHIFT_JIS", L"Japanese (SHIFT_JIS)", "shift_jis"); + addCharset(936, "GBK", L"Chinese Simplified (GBK)", "gbk|gb2312"); + addCharset(949, "KSC5601", L"Korean (KSC5601)", "ks_c_5601-1987|ksc5601|euc-kr|euckr|x-euc-kr"); + addCharset(950, "BIG5", L"Chinese Traditional (BIG5)", "big5"); + addCharset(1361, "JOHAB", L"Korean (Johab)", "johab|korean.johab"); + addCharset(51932, "EUC-JP", L"Japanese (EUC)", "euc-jp|eucjp|x-euc-jp", true); + addCharset(874, "CP874", L"Thai (Windows)", "cp874|windows-874", true); + addCharset(CP_ACP, "TIS620", L"Thai (TIS 620)", "tis620|ISO-8859-11|ISO-IR-166|TIS-620|TIS620-0TIS620.2529-1|TIS620.2533-0|TIS620.2533-1|thai8", true); + addCharset(CP_ACP, "MACTHAI", L"Thai (Mac OS)", "macthai|x-mac-thai|mac-thai", true); + supportedCharsets().add("EUC-JP"); + supportedCharsets().add("CP874"); + supportedCharsets().add("TIS620"); + supportedCharsets().add("MACTHAI"); + + IEnumCodePage* enumInterface; + IMultiLanguage* mli = FontCache::getMultiLanguageInterface(); + if (mli && S_OK == mli->EnumCodePages(MIMECONTF_BROWSER, &enumInterface)) { + MIMECPINFO cpInfo; + ULONG ccpInfo; + while (S_OK == enumInterface->Next(1, &cpInfo, &ccpInfo) && ccpInfo) { + if (!IsValidCodePage(cpInfo.uiCodePage)) + continue; + + HashMap<UINT, CString>::iterator i = codePageCharsets().find(cpInfo.uiCodePage); + + CString name(String(cpInfo.wszWebCharset).latin1()); + if (i == codePageCharsets().end()) { + CharsetInfo info; + info.m_codePage = cpInfo.uiCodePage; + knownCharsets().set(name.data(), info); + i = codePageCharsets().set(cpInfo.uiCodePage, name).first; + } + if (i != codePageCharsets().end()) { + HashMap<String, CharsetInfo>::iterator j = knownCharsets().find(String(i->second.data(), i->second.length())); + ASSERT(j != knownCharsets().end()); + CharsetInfo& info = j->second; + info.m_name = i->second.data(); + info.m_friendlyName = cpInfo.wszDescription; + info.m_aliases.append(name); + info.m_aliases.append(String(cpInfo.wszHeaderCharset).latin1()); + info.m_aliases.append(String(cpInfo.wszBodyCharset).latin1()); + info.m_usesNativeCodec = false; + String cpName = String::format("cp%d", cpInfo.uiCodePage); + info.m_aliases.append(cpName.latin1()); + supportedCharsets().add(i->second.data()); + } + } + enumInterface->Release(); + } +} + +static UINT getCodePage(const char* name) +{ + if (!strcmp(name, "UTF-8")) + return CP_UTF8; + + // Explicitly use a "const" reference to fix the silly VS build error + // saying "==" is not found for const_iterator and iterator + const HashMap<String, CharsetInfo>& charsets = knownCharsets(); + HashMap<String, CharsetInfo>::const_iterator i = charsets.find(name); + return i == charsets.end() ? CP_ACP : i->second.m_codePage; +} + +static PassOwnPtr<TextCodec> newTextCodecWinCE(const TextEncoding& encoding, const void*) +{ + return new TextCodecWinCE(encoding); +} + +TextCodecWinCE::TextCodecWinCE(const TextEncoding& encoding) + : m_encoding(encoding) +{ +} + +TextCodecWinCE::~TextCodecWinCE() +{ +} + +void TextCodecWinCE::registerBaseEncodingNames(EncodingNameRegistrar registrar) +{ + registrar("UTF-8", "UTF-8"); +} + +void TextCodecWinCE::registerBaseCodecs(TextCodecRegistrar registrar) +{ + registrar("UTF-8", newTextCodecWinCE, 0); +} + +void TextCodecWinCE::registerExtendedEncodingNames(EncodingNameRegistrar registrar) +{ + languageManager(); + for (CharsetSet::iterator i = supportedCharsets().begin(); i != supportedCharsets().end(); ++i) { + HashMap<String, CharsetInfo>::iterator j = knownCharsets().find(*i); + if (j != knownCharsets().end()) { + registrar(j->second.m_name.data(), j->second.m_name.data()); + for (Vector<CString>::const_iterator alias = j->second.m_aliases.begin(); alias != j->second.m_aliases.end(); ++alias) + registrar(alias->data(), j->second.m_name.data()); + } + } +} + +void TextCodecWinCE::registerExtendedCodecs(TextCodecRegistrar registrar) +{ + languageManager(); + for (CharsetSet::iterator i = supportedCharsets().begin(); i != supportedCharsets().end(); ++i) { + HashMap<String, CharsetInfo>::iterator j = knownCharsets().find(*i); + if (j != knownCharsets().end()) + registrar(j->second.m_name.data(), newTextCodecWinCE, 0); + } +} + +static DWORD getCodePageFlags(UINT codePage) +{ + if (codePage == CP_UTF8) + return MB_ERR_INVALID_CHARS; + + if (codePage == 42) // Symbol + return 0; + + // Microsoft says the flag must be 0 for the following code pages + if (codePage > 50000) { + if ((codePage >= 50220 && codePage <= 50222) + || codePage == 50225 + || codePage == 50227 + || codePage == 50229 + || codePage == 52936 + || codePage == 54936 + || (codePage >= 57002 && codePage <= 57001) + || codePage == 65000 // UTF-7 + ) + return 0; + } + + return MB_PRECOMPOSED | MB_ERR_INVALID_CHARS; +} + +static inline const char* findFirstNonAsciiCharacter(const char* bytes, size_t length) +{ + for (const char* bytesEnd = bytes + length; bytes < bytesEnd; ++bytes) { + if (*bytes & 0x80) + break; + } + return bytes; +} + +static void decode(Vector<UChar, 8192>& result, const char* encodingName, const char* bytes, size_t length, size_t* left, bool canBeFirstTime, bool& sawInvalidChar) +{ + *left = length; + if (!bytes || !length) + return; + + UINT codePage; + + HashMap<String, CharsetInfo>::iterator i = knownCharsets().find(encodingName); + if (i == knownCharsets().end()) { + if (!strcmp(encodingName, "UTF-8")) + codePage = CP_UTF8; + else + codePage = CP_ACP; + } else { + codePage = i->second.m_codePage; + if (i->second.m_usesNativeCodec) { + typedef int (*FuncEucMbToWc)(wchar_t *pwc, const unsigned char *s, int n); + FuncEucMbToWc encMbToWc = 0; + if (!strcmp(encodingName, "EUC-JP")) + encMbToWc = TextCodecsCE::euc_jp_mbtowc; + else if (!strcmp(encodingName, "CP874")) + encMbToWc = TextCodecsCE::cp874_mbtowc; + else if (!strcmp(encodingName, "TIS620")) + encMbToWc = TextCodecsCE::tis620_mbtowc; + else if (!strcmp(encodingName, "MACTHAI")) + encMbToWc = TextCodecsCE::mac_thai_mbtowc; + + if (encMbToWc) { + const char* const srcStart = bytes; + const char* const srcEnd = bytes + length; + int lastSize = result.size(); + result.resize(lastSize + length); + for (;;) { + UChar* dst = result.data() + lastSize; + const UChar* const dstEnd = result.data() + result.size(); + for (; dst < dstEnd && bytes < srcEnd; ++dst) { + int numberEncoded = encMbToWc(dst, (const unsigned char*)bytes, srcEnd - bytes); + if (numberEncoded >= 0) + bytes += numberEncoded; + else { + if (numberEncoded == RET_ILSEQ) + sawInvalidChar = true; + break; + } + } + if (bytes == srcEnd || dst != dstEnd) { + *left = srcEnd - bytes; + result.resize(dst - result.data()); + return; + } + lastSize = result.size(); + result.resize(result.size() + 256); + } + } else { + *left = 0; + result.append(bytes, length); + return; + } + } + } + + DWORD flags = getCodePageFlags(codePage); + + if (codePage == CP_UTF8) { + if (canBeFirstTime) { + // Handle BOM. + if (length > 3) { + if (bytes[0] == (char)0xEF && bytes[1] == (char)0xBB && bytes[2] == (char)0xBF) { + // BOM found! + length -= 3; + bytes += 3; + *left = length; + } + } else if (bytes[0] == 0xEF && (length < 2 || bytes[1] == (char)0xBB) && (length < 3 || bytes[2] == (char)0xBF)) { + if (length == 3) + *left = 0; + return; + } + } + + // Process ASCII characters at beginning. + const char* firstNonAsciiChar = findFirstNonAsciiCharacter(bytes, length); + int numAsciiCharacters = firstNonAsciiChar - bytes; + if (numAsciiCharacters) { + result.append(bytes, numAsciiCharacters); + length -= numAsciiCharacters; + if (!length) { + *left = 0; + return; + } + bytes = firstNonAsciiChar; + } + + int oldSize = result.size(); + result.resize(oldSize + length); + UChar* resultStart = result.data() + oldSize; + const char* sourceStart = bytes; + const char* const sourceEnd = bytes + length; + for (;;) { + using namespace WTF::Unicode; + ConversionResult convRes = convertUTF8ToUTF16(&sourceStart + , sourceEnd + , &resultStart + , result.data() + result.size() + , true); + + // FIXME: is it possible? + if (convRes == targetExhausted && sourceStart < sourceEnd) { + oldSize = result.size(); + result.resize(oldSize + 256); + resultStart = result.data() + oldSize; + continue; + } + + if (convRes != conversionOK) + sawInvalidChar = true; + + break; + } + + *left = sourceEnd - sourceStart; + result.resize(resultStart - result.data()); + } else { + int testLength = length; + int untestedLength = length; + for (;;) { + int resultLength = MultiByteToWideChar(codePage, flags, bytes, testLength, 0, 0); + + if (resultLength > 0) { + int oldSize = result.size(); + result.resize(oldSize + resultLength); + + MultiByteToWideChar(codePage, flags, bytes, testLength, result.data() + oldSize, resultLength); + + if (testLength == untestedLength) { + *left = length - testLength; + break; + } + untestedLength -= testLength; + length -= testLength; + bytes += testLength; + } else { + untestedLength = testLength - 1; + if (!untestedLength) { + *left = length; + break; + } + } + testLength = (untestedLength + 1) / 2; + } + } +} + +String TextCodecWinCE::decode(const char* bytes, size_t length, bool flush, bool stopOnError, bool& sawError) +{ + if (!m_decodeBuffer.isEmpty()) { + m_decodeBuffer.append(bytes, length); + bytes = m_decodeBuffer.data(); + length = m_decodeBuffer.size(); + } + + size_t left; + Vector<UChar, 8192> result; + for (;;) { + bool sawInvalidChar = false; + WebCore::decode(result, m_encoding.name(), bytes, length, &left, m_decodeBuffer.isEmpty(), sawInvalidChar); + if (!left) + break; + + if (!sawInvalidChar && !flush && left < 16) + break; + + result.append(L'?'); + sawError = true; + if (stopOnError) + return String(result.data(), result.size()); + + + if (left == 1) + break; + + bytes += length - left + 1; + length = left - 1; + } + if (left && !flush) { + if (m_decodeBuffer.isEmpty()) + m_decodeBuffer.append(bytes + length - left, left); + else { + memmove(m_decodeBuffer.data(), bytes + length - left, left); + m_decodeBuffer.resize(left); + } + } else + m_decodeBuffer.clear(); + return String(result.data(), result.size()); +} + +CString TextCodecWinCE::encode(const UChar* characters, size_t length, UnencodableHandling) +{ + if (!characters || !length) + return CString(); + + UINT codePage = getCodePage(m_encoding.name()); + DWORD flags = codePage == CP_UTF8 ? 0 : WC_COMPOSITECHECK; + + int resultLength = WideCharToMultiByte(codePage, flags, characters, length, 0, 0, 0, 0); + + // FIXME: We need to implement UnencodableHandling: QuestionMarksForUnencodables, EntitiesForUnencodables, and URLEncodedEntitiesForUnencodables. + + if (resultLength <= 0) + return "?"; + + Vector<char> result(resultLength); + + WideCharToMultiByte(codePage, flags, characters, length, result.data(), resultLength, 0, 0); + + return CString(result.data(), result.size()); +} + +void TextCodecWinCE::enumerateSupportedEncodings(EncodingReceiver& receiver) +{ + languageManager(); + for (CharsetSet::iterator i = supportedCharsets().begin(); i != supportedCharsets().end(); ++i) { + HashMap<String, CharsetInfo>::iterator j = knownCharsets().find(*i); + if (j != knownCharsets().end() && !receiver.receive(j->second.m_name.data(), j->second.m_friendlyName.charactersWithNullTermination(), j->second.m_codePage)) + break; + } +} + +} // namespace WebCore diff --git a/WebCore/bindings/js/JSWorkerConstructor.h b/WebCore/platform/text/wince/TextCodecWinCE.h index c845fa6..a870d3e 100644 --- a/WebCore/bindings/js/JSWorkerConstructor.h +++ b/WebCore/platform/text/wince/TextCodecWinCE.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> + * Copyright (C) 2007-2009 Torch Mobile, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,29 +25,47 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSWorkerConstructor_h -#define JSWorkerConstructor_h +#ifndef TextCodecWinCE_h +#define TextCodecWinCE_h -#if ENABLE(WORKERS) - -#include "JSDOMBinding.h" +#include "PlatformString.h" +#include "TextCodec.h" +#include "TextEncoding.h" +#include <wtf/Vector.h> namespace WebCore { - class JSWorkerConstructor : public DOMConstructorObject { - public: - JSWorkerConstructor(JSC::ExecState*, JSDOMGlobalObject*); +class TextCodecWinCE : public TextCodec { +public: + static void registerBaseEncodingNames(EncodingNameRegistrar); + static void registerBaseCodecs(TextCodecRegistrar); + + static void registerExtendedEncodingNames(EncodingNameRegistrar); + static void registerExtendedCodecs(TextCodecRegistrar); - static const JSC::ClassInfo s_info; + TextCodecWinCE(const TextEncoding&); + virtual ~TextCodecWinCE(); - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); + virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError); + virtual CString encode(const UChar*, size_t length, UnencodableHandling); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + struct EncodingInfo { + String m_encoding; + String m_friendlyName; }; -} // namespace WebCore + struct EncodingReceiver { + // Return false to stop enumerating. + virtual bool receive(const char* encoding, const wchar_t* friendlyName, unsigned int codePage) = 0; + }; -#endif // ENABLE(WORKERS) + static void enumerateSupportedEncodings(EncodingReceiver& receiver); + +private: + TextEncoding m_encoding; + Vector<char> m_decodeBuffer; +}; + +} // namespace WebCore -#endif // JSWorkerConstructor_h +#endif // TextCodecWinCE_h diff --git a/WebCore/platform/win/PlatformScrollBar.h b/WebCore/platform/win/PlatformScrollBar.h index c84616a..89c6e4a 100644 --- a/WebCore/platform/win/PlatformScrollBar.h +++ b/WebCore/platform/win/PlatformScrollBar.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PlatformScrollbar_h -#define PlatformScrollbar_h +#ifndef PlatformScrollBar_h +#define PlatformScrollBar_h #include "Scrollbar.h" #include "Timer.h" @@ -46,5 +46,5 @@ public: } -#endif // PlatformScrollbar_h +#endif // PlatformScrollBar_h diff --git a/WebCore/plugins/MimeType.cpp b/WebCore/plugins/MimeType.cpp index 247e7a4..5faeb5f 100644 --- a/WebCore/plugins/MimeType.cpp +++ b/WebCore/plugins/MimeType.cpp @@ -25,6 +25,7 @@ #include "Plugin.h" #include "PluginData.h" #include "Settings.h" +#include "StringBuilder.h" namespace WebCore { @@ -43,9 +44,17 @@ const String &MimeType::type() const return mimeClassInfo().type; } -const String &MimeType::suffixes() const +String MimeType::suffixes() const { - return mimeClassInfo().suffixes; + const Vector<String>& extensions = mimeClassInfo().extensions; + + StringBuilder builder; + for (size_t i = 0; i < extensions.size(); ++i) { + if (i) + builder.append(','); + builder.append(extensions[i]); + } + return builder.toString(); } const String &MimeType::description() const @@ -56,10 +65,10 @@ const String &MimeType::description() const PassRefPtr<Plugin> MimeType::enabledPlugin() const { const Page* p = m_pluginData->page(); - if (!p || !p->mainFrame()->loader()->allowPlugins(NotAboutToInstantiatePlugin)) + if (!p || !p->mainFrame()->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) return 0; - return Plugin::create(m_pluginData.get(), mimeClassInfo().pluginIndex); + return Plugin::create(m_pluginData.get(), m_pluginData->mimePluginIndices()[m_index]); } } // namespace WebCore diff --git a/WebCore/plugins/MimeType.h b/WebCore/plugins/MimeType.h index 33a7fa0..c91e0a3 100644 --- a/WebCore/plugins/MimeType.h +++ b/WebCore/plugins/MimeType.h @@ -37,7 +37,7 @@ namespace WebCore { ~MimeType(); const String &type() const; - const String &suffixes() const; + String suffixes() const; const String &description() const; PassRefPtr<Plugin> enabledPlugin() const; diff --git a/WebCore/plugins/Plugin.cpp b/WebCore/plugins/Plugin.cpp index 765478d..dcbf3f1 100644 --- a/WebCore/plugins/Plugin.cpp +++ b/WebCore/plugins/Plugin.cpp @@ -64,7 +64,7 @@ PassRefPtr<MimeType> Plugin::item(unsigned index) const Vector<MimeClassInfo>& mimes = m_pluginData->mimes(); for (unsigned i = 0; i < mimes.size(); ++i) { - if (mimes[i] == mime) + if (mimes[i] == mime && m_pluginData->mimePluginIndices()[i] == m_index) return MimeType::create(m_pluginData.get(), i).get(); } return 0; diff --git a/WebCore/plugins/PluginData.cpp b/WebCore/plugins/PluginData.cpp index 7780cff..ff90747 100644 --- a/WebCore/plugins/PluginData.cpp +++ b/WebCore/plugins/PluginData.cpp @@ -24,6 +24,11 @@ #include "config.h" #include "PluginData.h" +#if USE(PLATFORM_STRATEGIES) +#include "PlatformStrategies.h" +#include "PluginStrategy.h" +#endif + namespace WebCore { PluginData::PluginData(const Page* page) @@ -33,8 +38,10 @@ PluginData::PluginData(const Page* page) for (unsigned i = 0; i < m_plugins.size(); ++i) { const PluginInfo& plugin = m_plugins[i]; - for (unsigned j = 0; j < plugin.mimes.size(); ++j) + for (unsigned j = 0; j < plugin.mimes.size(); ++j) { m_mimes.append(plugin.mimes[j]); + m_mimePluginIndices.append(i); + } } } @@ -52,10 +59,24 @@ String PluginData::pluginNameForMimeType(const String& mimeType) const const MimeClassInfo& info = m_mimes[i]; if (info.type == mimeType) - return m_plugins[info.pluginIndex].name; + return m_plugins[m_mimePluginIndices[i]].name; } return String(); } +#if USE(PLATFORM_STRATEGIES) +void PluginData::refresh() +{ + platformStrategies()->pluginStrategy()->refreshPlugins(); +} + +void PluginData::initPlugins() +{ + ASSERT(m_plugins.isEmpty()); + + platformStrategies()->pluginStrategy()->getPluginInfo(m_plugins); +} +#endif + } diff --git a/WebCore/plugins/PluginData.h b/WebCore/plugins/PluginData.h index 1055afb..f4cc62f 100644 --- a/WebCore/plugins/PluginData.h +++ b/WebCore/plugins/PluginData.h @@ -32,13 +32,12 @@ struct PluginInfo; struct MimeClassInfo { String type; String desc; - String suffixes; - unsigned pluginIndex; + Vector<String> extensions; }; inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b) { - return a.type == b.type && a.desc == b.desc && a.suffixes == b.suffixes && a.pluginIndex == b.pluginIndex; + return a.type == b.type && a.desc == b.desc && a.extensions == b.extensions; } struct PluginInfo { @@ -58,7 +57,8 @@ public: const Vector<PluginInfo>& plugins() const { return m_plugins; } const Vector<MimeClassInfo>& mimes() const { return m_mimes; } - + const Vector<size_t>& mimePluginIndices() const { return m_mimePluginIndices; } + bool supportsMimeType(const String& mimeType) const; String pluginNameForMimeType(const String& mimeType) const; @@ -70,6 +70,8 @@ private: Vector<PluginInfo> m_plugins; Vector<MimeClassInfo> m_mimes; + Vector<size_t> m_mimePluginIndices; + const Page* m_page; }; diff --git a/WebCore/plugins/PluginDatabase.h b/WebCore/plugins/PluginDatabase.h index ed714aa..ea3559d 100644 --- a/WebCore/plugins/PluginDatabase.h +++ b/WebCore/plugins/PluginDatabase.h @@ -25,8 +25,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PluginDatabase_H -#define PluginDatabase_H +#ifndef PluginDatabase_h +#define PluginDatabase_h #include "PlatformString.h" #include "PluginPackage.h" diff --git a/WebCore/plugins/PluginPackage.h b/WebCore/plugins/PluginPackage.h index 4fc9341..659f5ff 100644 --- a/WebCore/plugins/PluginPackage.h +++ b/WebCore/plugins/PluginPackage.h @@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PluginPackage_H -#define PluginPackage_H +#ifndef PluginPackage_h +#define PluginPackage_h #include "FileSystem.h" #include "PlatformString.h" diff --git a/WebCore/plugins/PluginStrategy.h b/WebCore/plugins/PluginStrategy.h new file mode 100644 index 0000000..7e92196 --- /dev/null +++ b/WebCore/plugins/PluginStrategy.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PluginStrategy_h +#define PluginStrategy_h + +#if USE(PLATFORM_STRATEGIES) + +#include "PluginData.h" + +namespace WebCore { + +class PluginStrategy { +public: + virtual void refreshPlugins() = 0; + virtual void getPluginInfo(Vector<PluginInfo>&) = 0; + +protected: + virtual ~PluginStrategy() { } +}; + +} // namespace WebCore + +#endif // USE(PLATFORM_STRATEGIES) + +#endif // PluginStrategy_h diff --git a/WebCore/plugins/PluginStream.h b/WebCore/plugins/PluginStream.h index b937ff0..f9f927e 100644 --- a/WebCore/plugins/PluginStream.h +++ b/WebCore/plugins/PluginStream.h @@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PluginStream_H -#define PluginStream_H +#ifndef PluginStream_h +#define PluginStream_h #include "FileSystem.h" #include "KURL.h" diff --git a/WebCore/plugins/PluginViewNone.cpp b/WebCore/plugins/PluginViewNone.cpp index d7b03ca..a4cc358 100644 --- a/WebCore/plugins/PluginViewNone.cpp +++ b/WebCore/plugins/PluginViewNone.cpp @@ -120,28 +120,33 @@ void PluginView::restart() { } -#if ENABLE(NETSCAPE_PLUGIN_API) -void PluginView::keepAlive(NPP) +#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) +void PluginView::handleFocusInEvent() { } -#endif -#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(EFL) -void PluginView::privateBrowsingStateChanged(bool) +void PluginView::handleFocusOutEvent() { } +#endif -void PluginView::setJavaScriptPaused(bool) +// The functions below are for platforms that do not use PluginView for plugins +// due to architectural differences. The plan is to eventually have all +// ports using PluginView, but until then, if new functions like this are +// added, please make sure they have the proper platform #ifs so that changes +// do not break ports who compile both this file and PluginView.cpp. +#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(EFL) +#if ENABLE(NETSCAPE_PLUGIN_API) +void PluginView::keepAlive(NPP) { } #endif -#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) -void PluginView::handleFocusInEvent() +void PluginView::privateBrowsingStateChanged(bool) { } -void PluginView::handleFocusOutEvent() +void PluginView::setJavaScriptPaused(bool) { } #endif diff --git a/WebCore/plugins/chromium/PluginDataChromium.cpp b/WebCore/plugins/chromium/PluginDataChromium.cpp index a106bc0..378fccb 100644 --- a/WebCore/plugins/chromium/PluginDataChromium.cpp +++ b/WebCore/plugins/chromium/PluginDataChromium.cpp @@ -84,8 +84,7 @@ String getPluginMimeTypeFromExtension(const String& extension) for (size_t i = 0; i < plugins.size(); ++i) { for (size_t j = 0; j < plugins[i].mimes.size(); ++j) { const MimeClassInfo& mime = plugins[i].mimes[j]; - Vector<String> extensions; - mime.suffixes.split(",", extensions); + const Vector<String>& extensions = mime.extensions; for (size_t k = 0; k < extensions.size(); ++k) { if (extension == extensions[k]) return mime.type; diff --git a/WebCore/plugins/gtk/PluginDataGtk.cpp b/WebCore/plugins/gtk/PluginDataGtk.cpp index ca6584b..ae4d98b 100644 --- a/WebCore/plugins/gtk/PluginDataGtk.cpp +++ b/WebCore/plugins/gtk/PluginDataGtk.cpp @@ -47,17 +47,8 @@ void PluginData::initPlugins() mime.type = it->first; mime.desc = it->second; - mime.pluginIndex = m_plugins.size(); + mime.extensions = package->mimeToExtensions().get(mime.type); - Vector<String> extensions = package->mimeToExtensions().get(mime.type); - - for (unsigned i = 0; i < extensions.size(); i++) { - if (i > 0) - mime.suffixes += ","; - - mime.suffixes += extensions[i]; - } - info.mimes.append(mime); } diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp index 400ba6f..dca7dad 100644 --- a/WebCore/plugins/gtk/PluginViewGtk.cpp +++ b/WebCore/plugins/gtk/PluginViewGtk.cpp @@ -39,6 +39,7 @@ #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "GtkVersioning.h" #include "HTMLNames.h" #include "HTMLPlugInElement.h" #include "HostWindow.h" @@ -214,7 +215,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) GdkDrawable* gdkBackingStore = 0; gint xoff = 0, yoff = 0; - gdk_window_get_internal_paint_info(widget->window, &gdkBackingStore, &xoff, &yoff); + gdk_window_get_internal_paint_info(gtk_widget_get_window(widget), &gdkBackingStore, &xoff, &yoff); GC gc = XDefaultGC(GDK_DISPLAY(), gdk_screen_get_number(gdk_screen_get_default())); if (gdkBackingStore) { @@ -348,7 +349,7 @@ void PluginView::initXEvent(XEvent* xEvent) // but does in the case of KeyPress, KeyRelease, ButtonPress, ButtonRelease, and MotionNotify // events; thus, this is right: GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient(); - xEvent->xany.window = widget ? GDK_WINDOW_XWINDOW(widget->window) : 0; + xEvent->xany.window = widget ? GDK_WINDOW_XWINDOW(gtk_widget_get_window(widget)) : 0; } static void setXButtonEventSpecificFields(XEvent* xEvent, MouseEvent* event, const IntPoint& postZoomPos, Frame* parentFrame) @@ -656,11 +657,13 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re case NPNVnetscapeWindow: { #if defined(XP_UNIX) void* w = reinterpret_cast<void*>(value); - *((XID *)w) = GDK_WINDOW_XWINDOW(m_parentFrame->view()->hostWindow()->platformPageClient()->window); + GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient(); + *((XID *)w) = GDK_WINDOW_XWINDOW(gtk_widget_get_window(widget)); #endif #ifdef GDK_WINDOWING_WIN32 HGDIOBJ* w = reinterpret_cast<HGDIOBJ*>(value); - *w = GDK_WINDOW_HWND(m_parentFrame->view()->hostWindow()->platformPageClient()->window); + GtkWidget* widget = m_parentFrame->view()->hostWindow()->platformPageClient(); + *w = GDK_WINDOW_HWND(gtk_widget_get_window(widget)); #endif *result = NPERR_NO_ERROR; return true; @@ -810,7 +813,7 @@ bool PluginView::platformStart() g_signal_connect(platformPluginWidget(), "plug-added", G_CALLBACK(plugAddedCallback), this); g_signal_connect(platformPluginWidget(), "plug-removed", G_CALLBACK(plugRemovedCallback), NULL); } else - setPlatformWidget(gtk_xtbin_new(pageClient->window, 0)); + setPlatformWidget(gtk_xtbin_new(gtk_widget_get_window(pageClient), 0)); #else setPlatformWidget(gtk_socket_new()); gtk_container_add(GTK_CONTAINER(pageClient), platformPluginWidget()); @@ -831,12 +834,14 @@ bool PluginView::platformStart() m_npWindow.type = NPWindowTypeWindow; #if defined(XP_UNIX) if (m_needsXEmbed) { - gtk_widget_realize(platformPluginWidget()); + GtkWidget* widget = platformPluginWidget(); + gtk_widget_realize(widget); m_npWindow.window = (void*)gtk_socket_get_id(GTK_SOCKET(platformPluginWidget())); - ws->display = GDK_WINDOW_XDISPLAY(platformPluginWidget()->window); - ws->visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(GDK_DRAWABLE(platformPluginWidget()->window))); - ws->depth = gdk_drawable_get_visual(GDK_DRAWABLE(platformPluginWidget()->window))->depth; - ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(GDK_DRAWABLE(platformPluginWidget()->window))); + GdkWindow* window = gtk_widget_get_window(widget); + ws->display = GDK_WINDOW_XDISPLAY(window); + ws->visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(GDK_DRAWABLE(window))); + ws->depth = gdk_visual_get_depth(gdk_drawable_get_visual(GDK_DRAWABLE(window))); + ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(GDK_DRAWABLE(window))); } else { m_npWindow.window = (void*)GTK_XTBIN(platformPluginWidget())->xtwindow; ws->display = GTK_XTBIN(platformPluginWidget())->xtdisplay; @@ -846,7 +851,7 @@ bool PluginView::platformStart() } XFlush (ws->display); #elif defined(GDK_WINDOWING_WIN32) - m_npWindow.window = (void*)GDK_WINDOW_HWND(platformPluginWidget()->window); + m_npWindow.window = (void*)GDK_WINDOW_HWND(gtk_widget_get_window(platformPluginWidget())); #endif } else { m_npWindow.type = NPWindowTypeDrawable; @@ -856,14 +861,14 @@ bool PluginView::platformStart() GdkScreen* gscreen = gdk_screen_get_default(); GdkVisual* gvisual = gdk_screen_get_system_visual(gscreen); - if (gvisual->depth == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) { + if (gdk_visual_get_depth(gvisual) == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) { getVisualAndColormap(32, &m_visual, &m_colormap); ws->depth = 32; } if (!m_visual) { - getVisualAndColormap(gvisual->depth, &m_visual, &m_colormap); - ws->depth = gvisual->depth; + getVisualAndColormap(gdk_visual_get_depth(gvisual), &m_visual, &m_colormap); + ws->depth = gdk_visual_get_depth(gvisual); } ws->display = GDK_DISPLAY(); diff --git a/WebCore/plugins/gtk/gtk2xtbin.c b/WebCore/plugins/gtk/gtk2xtbin.c index 28388cf..b7fd3f0 100644 --- a/WebCore/plugins/gtk/gtk2xtbin.c +++ b/WebCore/plugins/gtk/gtk2xtbin.c @@ -271,6 +271,9 @@ gtk_xtbin_realize (GtkWidget *widget) { GtkXtBin *xtbin; GtkAllocation allocation = { 0, 0, 200, 200 }; +#if GTK_CHECK_VERSION(2, 18, 0) + GtkAllocation widget_allocation; +#endif gint x, y, w, h, d; /* geometry of window */ #ifdef DEBUG_XTBIN @@ -291,8 +294,14 @@ gtk_xtbin_realize (GtkWidget *widget) printf("initial allocation %d %d %d %d\n", x, y, w, h); #endif +#if GTK_CHECK_VERSION(2, 18, 0) + gtk_widget_get_allocation(widget, &widget_allocation); + xtbin->width = widget_allocation.width; + xtbin->height = widget_allocation.height; +#else xtbin->width = widget->allocation.width; xtbin->height = widget->allocation.height; +#endif /* use GtkSocket's realize */ (*GTK_WIDGET_CLASS(parent_class)->realize)(widget); @@ -333,7 +342,7 @@ gtk_xtbin_new (GdkWindow *parent_window, String * f) xt_client_init(&(xtbin->xtclient), GDK_VISUAL_XVISUAL(gdk_rgb_get_visual()), GDK_COLORMAP_XCOLORMAP(gdk_rgb_get_colormap()), - gdk_rgb_get_visual()->depth); + gdk_visual_get_depth(gdk_rgb_get_visual())); if (!xtbin->xtclient.xtdisplay) { /* If XtOpenDisplay failed, we can't go any further. @@ -404,7 +413,7 @@ gtk_xtbin_set_position (GtkXtBin *xtbin, xtbin->y = y; if (gtk_widget_get_realized (GTK_WIDGET(xtbin))) - gdk_window_move (GTK_WIDGET (xtbin)->window, x, y); + gdk_window_move (gtk_widget_get_window(GTK_WIDGET (xtbin)), x, y); } void @@ -457,7 +466,7 @@ gtk_xtbin_unrealize (GtkWidget *object) xtbin = GTK_XTBIN(object); widget = GTK_WIDGET(object); - GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE); + gtk_widget_set_visible(widget, FALSE); if (gtk_widget_get_realized (widget)) { xt_client_unrealize(&(xtbin->xtclient)); } diff --git a/WebCore/plugins/mac/PluginDataMac.mm b/WebCore/plugins/mac/PluginDataMac.mm deleted file mode 100644 index dcdf22d..0000000 --- a/WebCore/plugins/mac/PluginDataMac.mm +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "config.h" -#import "PluginData.h" - -#import "BlockExceptions.h" -#import "Logging.h" -#import "WebCoreViewFactory.h" - -namespace WebCore { - -void PluginData::initPlugins() -{ - BEGIN_BLOCK_OBJC_EXCEPTIONS; - - NSArray* plugins = [[WebCoreViewFactory sharedFactory] pluginsInfo]; - for (unsigned int i = 0; i < [plugins count]; ++i) { - PluginInfo pluginInfo; - - id <WebCorePluginInfo> plugin = [plugins objectAtIndex:i]; - - pluginInfo.name = [plugin name]; - pluginInfo.file = [plugin filename]; - pluginInfo.desc = [plugin pluginDescription]; - - NSEnumerator* MIMETypeEnumerator = [plugin MIMETypeEnumerator]; - while (NSString* MIME = [MIMETypeEnumerator nextObject]) { - MimeClassInfo mime; - - mime.type = String(MIME).lower(); - mime.suffixes = [[plugin extensionsForMIMEType:MIME] componentsJoinedByString:@","]; - mime.desc = [plugin descriptionForMIMEType:MIME]; - mime.pluginIndex = m_plugins.size(); - - pluginInfo.mimes.append(mime); - } - - m_plugins.append(pluginInfo); - } - - END_BLOCK_OBJC_EXCEPTIONS; - - return; -} - -void PluginData::refresh() -{ - BEGIN_BLOCK_OBJC_EXCEPTIONS; - [[WebCoreViewFactory sharedFactory] refreshPlugins]; - END_BLOCK_OBJC_EXCEPTIONS; -} - -} - diff --git a/WebCore/plugins/qt/PluginContainerQt.h b/WebCore/plugins/qt/PluginContainerQt.h index 624654c..3a2896d 100644 --- a/WebCore/plugins/qt/PluginContainerQt.h +++ b/WebCore/plugins/qt/PluginContainerQt.h @@ -16,8 +16,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef PluginContainerQt_H -#define PluginContainerQt_H +#ifndef PluginContainerQt_h +#define PluginContainerQt_h #include <QX11EmbedContainer> @@ -60,4 +60,4 @@ namespace WebCore { }; } -#endif // PluginContainerQt_H +#endif // PluginContainerQt_h diff --git a/WebCore/plugins/qt/PluginDataQt.cpp b/WebCore/plugins/qt/PluginDataQt.cpp index 8d4968b..3dc86d0 100644 --- a/WebCore/plugins/qt/PluginDataQt.cpp +++ b/WebCore/plugins/qt/PluginDataQt.cpp @@ -52,8 +52,8 @@ void PluginData::initPlugins() MimeClassInfo mimeInfo; mimeInfo.type = mimeType.name; mimeInfo.desc = mimeType.description; - mimeInfo.suffixes = mimeType.fileExtensions.join(QLatin1String("; ")); - mimeInfo.pluginIndex = m_plugins.size(); + for (int k = 0; k < mimeType.fileExtensions.count(); ++k) + mimeInfo.extensions.append(mimeType.fileExtensions.at(k)); info.mimes.append(mimeInfo); } @@ -80,16 +80,7 @@ void PluginData::initPlugins() mime.type = it->first; mime.desc = it->second; - mime.pluginIndex = m_plugins.size(); - - Vector<String> extensions = package->mimeToExtensions().get(mime.type); - - for (unsigned i = 0; i < extensions.size(); i++) { - if (i > 0) - mime.suffixes += ","; - - mime.suffixes += extensions[i]; - } + mime.extensions = package->mimeToExtensions().get(mime.type); info.mimes.append(mime); } diff --git a/WebCore/plugins/qt/PluginPackageQt.cpp b/WebCore/plugins/qt/PluginPackageQt.cpp index 5694148..07149f3 100644 --- a/WebCore/plugins/qt/PluginPackageQt.cpp +++ b/WebCore/plugins/qt/PluginPackageQt.cpp @@ -35,6 +35,8 @@ namespace WebCore { +typedef void gtkInitFunc(int *argc, char ***argv); + bool PluginPackage::fetchInfo() { if (!load()) @@ -109,6 +111,7 @@ bool PluginPackage::load() NP_InitializeFuncPtr NP_Initialize; NPError npErr; + gtkInitFunc* gtkInit; NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize"); m_NPP_Shutdown = (NPP_ShutdownProcPtr)m_module->resolve("NP_Shutdown"); @@ -127,6 +130,26 @@ bool PluginPackage::load() m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue; } + // WORKAROUND: Prevent gtk based plugin crashes such as BR# 40567 by + // explicitly forcing the initializing of Gtk, i.e. calling gtk_init, + // whenver the symbol is present in the plugin library loaded above. + // Note that this workaround is based on code from the NSPluginClass ctor + // in KDE's kdebase/apps/nsplugins/viewer/nsplugin.cpp file. + gtkInit = (gtkInitFunc*)m_module->resolve("gtk_init"); + if (gtkInit) { + // Prevent gtk_init() from replacing the X error handlers, since the Gtk + // handlers abort when they receive an X error, thus killing the viewer. +#ifdef Q_WS_X11 + int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0); + int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0); +#endif + gtkInit(0, 0); +#ifdef Q_WS_X11 + XSetErrorHandler(old_error_handler); + XSetIOErrorHandler(old_io_error_handler); +#endif + } + #if defined(XP_UNIX) npErr = NP_Initialize(&m_browserFuncs, &m_pluginFuncs); #else diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp index ff52070..6a0fa39 100644 --- a/WebCore/plugins/qt/PluginViewQt.cpp +++ b/WebCore/plugins/qt/PluginViewQt.cpp @@ -60,6 +60,7 @@ #include "ScriptController.h" #include "Settings.h" #include "npruntime_impl.h" +#include "qwebpage_p.h" #include "runtime_root.h" #include <QApplication> @@ -121,12 +122,15 @@ void PluginView::updatePluginWidget() // do not call setNPWindowIfNeeded immediately, will be called on paint() m_hasPendingGeometryChange = true; - // in order to move/resize the plugin window at the same time as the + // (i) in order to move/resize the plugin window at the same time as the // rest of frame during e.g. scrolling, we set the window geometry // in the paint() function, but as paint() isn't called when the // plugin window is outside the frame which can be caused by a // scroll, we need to move/resize immediately. - if (!m_windowRect.intersects(frameView->frameRect())) + // (ii) if we are running layout tests from DRT, paint() won't ever get called + // so we need to call setNPWindowIfNeeded() if window geometry has changed + if (!m_windowRect.intersects(frameView->frameRect()) + || (QWebPagePrivate::drtRun && platformPluginWidget() && (m_windowRect != oldWindowRect || m_clipRect != oldClipRect))) setNPWindowIfNeeded(); // Make sure we get repainted afterwards. This is necessary for downward diff --git a/WebCore/plugins/symbian/npinterface.h b/WebCore/plugins/symbian/npinterface.h index 0f0b6ca..e296127 100644 --- a/WebCore/plugins/symbian/npinterface.h +++ b/WebCore/plugins/symbian/npinterface.h @@ -16,8 +16,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef npinterface_H -#define npinterface_H +#ifndef npinterface_h +#define npinterface_h #include "npfunctions.h" #include <QtPlugin> @@ -34,4 +34,4 @@ QT_BEGIN_NAMESPACE Q_DECLARE_INTERFACE(NPInterface, "com.nokia.qts60.webplugin/1.0"); QT_END_NAMESPACE -#endif // npinterface_H +#endif // npinterface_h diff --git a/WebCore/plugins/win/PluginDataWin.cpp b/WebCore/plugins/win/PluginDataWin.cpp index 59bd40b..41fe073 100644 --- a/WebCore/plugins/win/PluginDataWin.cpp +++ b/WebCore/plugins/win/PluginDataWin.cpp @@ -46,16 +46,7 @@ void PluginData::initPlugins() mime.type = it->first; mime.desc = it->second; - mime.pluginIndex = m_plugins.size(); - - Vector<String> extensions = package->mimeToExtensions().get(mime.type); - - for (unsigned i = 0; i < extensions.size(); i++) { - if (i > 0) - mime.suffixes += ","; - - mime.suffixes += extensions[i]; - } + mime.extensions = package->mimeToExtensions().get(mime.type); info.mimes.append(mime); } diff --git a/WebCore/plugins/wx/PluginDataWx.cpp b/WebCore/plugins/wx/PluginDataWx.cpp index 747c11a..a595c82 100644 --- a/WebCore/plugins/wx/PluginDataWx.cpp +++ b/WebCore/plugins/wx/PluginDataWx.cpp @@ -53,17 +53,8 @@ void PluginData::initPlugins() mime.type = it->first; mime.desc = it->second; - mime.pluginIndex = m_plugins.size(); + mime.extensions = package->mimeToExtensions().get(mime.type); - Vector<String> extensions = package->mimeToExtensions().get(mime.type); - - for (unsigned i = 0; i < extensions.size(); i++) { - if (i > 0) - mime.suffixes += ","; - - mime.suffixes += extensions[i]; - } - info.mimes.append(mime); } diff --git a/WebCore/rendering/BidiRun.h b/WebCore/rendering/BidiRun.h index 542081a..5dbb07b 100644 --- a/WebCore/rendering/BidiRun.h +++ b/WebCore/rendering/BidiRun.h @@ -38,6 +38,7 @@ struct BidiRun : BidiCharacterRun { : BidiCharacterRun(start, stop, context, dir) , m_object(object) , m_box(0) + , m_hasHyphen(false) { } @@ -58,6 +59,7 @@ private: public: RenderObject* m_object; InlineBox* m_box; + bool m_hasHyphen; }; } diff --git a/WebCore/rendering/InlineBox.h b/WebCore/rendering/InlineBox.h index e165f0c..eec9c1b 100644 --- a/WebCore/rendering/InlineBox.h +++ b/WebCore/rendering/InlineBox.h @@ -53,7 +53,7 @@ public: #endif , m_endsWithBreak(false) , m_hasSelectedChildren(false) - , m_hasEllipsisBox(false) + , m_hasEllipsisBoxOrHyphen(false) , m_dirOverride(false) , m_isText(false) , m_determinedIfNextOnLineExists(false) @@ -86,7 +86,7 @@ public: #endif , m_endsWithBreak(false) , m_hasSelectedChildren(false) - , m_hasEllipsisBox(false) + , m_hasEllipsisBoxOrHyphen(false) , m_dirOverride(false) , m_isText(false) , m_determinedIfNextOnLineExists(false) @@ -133,18 +133,28 @@ public: bool isText() const { return m_isText; } void setIsText(bool b) { m_isText = b; } - virtual bool isInlineBox() { return false; } virtual bool isInlineFlowBox() const { return false; } - virtual bool isInlineTextBox() { return false; } + virtual bool isInlineTextBox() const { return false; } virtual bool isRootInlineBox() const { return false; } -#if ENABLE(SVG) - virtual bool isSVGRootInlineBox() { return false; } +#if ENABLE(SVG) + virtual bool isSVGInlineTextBox() const { return false; } + virtual bool isSVGRootInlineBox() const { return false; } bool hasVirtualHeight() const { return m_hasVirtualHeight; } void setHasVirtualHeight() { m_hasVirtualHeight = true; } - virtual int virtualHeight() const { ASSERT_NOT_REACHED(); return 0; } + virtual int virtualHeight() const + { + ASSERT_NOT_REACHED(); + return 0; + } #endif - + + virtual IntRect calculateBoundaries() const + { + ASSERT_NOT_REACHED(); + return IntRect(); + } + bool isConstructed() { return m_constructed; } virtual void setConstructed() { @@ -274,7 +284,7 @@ protected: // for RootInlineBox bool m_endsWithBreak : 1; // Whether the line ends with a <br>. bool m_hasSelectedChildren : 1; // Whether we have any children selected (this bit will also be set if the <br> that terminates our line is selected). - bool m_hasEllipsisBox : 1; + bool m_hasEllipsisBoxOrHyphen : 1; // for InlineTextBox public: diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h index e939fb4..b933c09 100644 --- a/WebCore/rendering/InlineFlowBox.h +++ b/WebCore/rendering/InlineFlowBox.h @@ -127,7 +127,7 @@ public: void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject); int getFlowSpacingWidth(); bool onEndChain(RenderObject* endObject); - virtual int placeBoxesHorizontally(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); + int placeBoxesHorizontally(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom, int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&); void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index 2fc5823..09825b6 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -1,7 +1,7 @@ /* * (C) 1999 Lars Knoll (knoll@kde.org) * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 @@ -103,6 +103,18 @@ RenderObject::SelectionState InlineTextBox::selectionState() return state; } +typedef Vector<UChar, 256> BufferForAppendingHyphen; + +static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, RenderStyle* style, const UChar*& characters, int& length) +{ + const AtomicString& hyphenString = style->hyphenString(); + charactersWithHyphen.reserveCapacity(length + hyphenString.length()); + charactersWithHyphen.append(characters, length); + charactersWithHyphen.append(hyphenString.characters(), hyphenString.length()); + characters = charactersWithHyphen.data(); + length += hyphenString.length(); +} + IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos) { int sPos = max(startPos - m_start, 0); @@ -114,9 +126,18 @@ IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos) RenderText* textObj = textRenderer(); int selTop = selectionTop(); int selHeight = selectionHeight(); - const Font& f = textObj->style(m_firstLine)->font(); + RenderStyle* styleToUse = textObj->style(m_firstLine); + const Font& f = styleToUse->font(); + + const UChar* characters = textObj->text()->characters() + m_start; + int len = m_len; + BufferForAppendingHyphen charactersWithHyphen; + if (ePos == len && hasHyphen()) { + adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, len); + ePos = len; + } - IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(textObj->text()->characters() + m_start, m_len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride), + IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride), IntPoint(tx + m_x, ty + selTop), selHeight, sPos, ePos)); if (r.x() > tx + m_x + m_width) r.setWidth(0); @@ -476,16 +497,21 @@ void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) } } + const UChar* characters = textRenderer()->text()->characters() + m_start; + int length = m_len; + BufferForAppendingHyphen charactersWithHyphen; + if (hasHyphen()) + adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, length); + int baseline = renderer()->style(m_firstLine)->font().ascent(); IntPoint textOrigin(m_x + tx, m_y + ty + baseline); - TextRun textRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || styleToUse->visuallyOrdered()); + TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || styleToUse->visuallyOrdered()); int sPos = 0; int ePos = 0; if (paintSelectedTextOnly || paintSelectedTextSeparately) selectionStartEnd(sPos, ePos); - int length = m_len; if (m_truncation != cNoTruncation) { sPos = min<int>(sPos, m_truncation); ePos = min<int>(ePos, m_truncation); @@ -600,8 +626,16 @@ void InlineTextBox::paintSelection(GraphicsContext* context, int tx, int ty, Ren // If the text is truncated, let the thing being painted in the truncation // draw its own highlight. int length = m_truncation != cNoTruncation ? m_truncation : m_len; + const UChar* characters = textRenderer()->text()->characters() + m_start; + + BufferForAppendingHyphen charactersWithHyphen; + if (ePos == length && hasHyphen()) { + adjustCharactersAndLengthForHyphen(charactersWithHyphen, style, characters, length); + ePos = length; + } + context->clip(IntRect(m_x + tx, y + ty, m_width, h)); - context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, length, textRenderer()->allowTabs(), textPos(), m_toAdd, + context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || style->visuallyOrdered()), IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos); context->restore(); diff --git a/WebCore/rendering/InlineTextBox.h b/WebCore/rendering/InlineTextBox.h index d03de85..2ef5ec9 100644 --- a/WebCore/rendering/InlineTextBox.h +++ b/WebCore/rendering/InlineTextBox.h @@ -65,16 +65,21 @@ public: unsigned short truncation() { return m_truncation; } + bool hasHyphen() const { return m_hasEllipsisBoxOrHyphen; } + void setHasHyphen(bool hasHyphen) { m_hasEllipsisBoxOrHyphen = hasHyphen; } + private: virtual int selectionTop(); virtual int selectionHeight(); public: + virtual IntRect calculateBoundaries() const { return IntRect(x(), y(), width(), height()); } + virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos); bool isSelected(int startPos, int endPos) const; - void selectionStartEnd(int& sPos, int& ePos); + virtual void selectionStartEnd(int& sPos, int& ePos); -private: +protected: virtual void paint(RenderObject::PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); @@ -99,7 +104,7 @@ public: void setSpaceAdd(int add) { m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd; } private: - virtual bool isInlineTextBox() { return true; } + virtual bool isInlineTextBox() const { return true; } public: virtual int caretMinOffset() const; diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 3413b02..383a8cf 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -70,7 +70,7 @@ inline MediaControlShadowRootElement::MediaControlShadowRootElement(HTMLMediaEle PassRefPtr<MediaControlShadowRootElement> MediaControlShadowRootElement::create(HTMLMediaElement* mediaElement) { - RefPtr<MediaControlShadowRootElement> element = new MediaControlShadowRootElement(mediaElement); + RefPtr<MediaControlShadowRootElement> element = adoptRef(new MediaControlShadowRootElement(mediaElement)); RefPtr<RenderStyle> rootStyle = RenderStyle::create(); rootStyle->inheritFrom(mediaElement->renderer()->style()); @@ -130,7 +130,7 @@ MediaControlElement::MediaControlElement(HTMLMediaElement* mediaElement, PseudoI PassRefPtr<MediaControlElement> MediaControlElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId) { - return new MediaControlElement(mediaElement, pseudoStyleId); + return adoptRef(new MediaControlElement(mediaElement, pseudoStyleId)); } void MediaControlElement::attachToParent(Element* parent) @@ -222,7 +222,7 @@ inline MediaControlTimelineContainerElement::MediaControlTimelineContainerElemen PassRefPtr<MediaControlTimelineContainerElement> MediaControlTimelineContainerElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlTimelineContainerElement(mediaElement); + return adoptRef(new MediaControlTimelineContainerElement(mediaElement)); } bool MediaControlTimelineContainerElement::rendererIsNeeded(RenderStyle* style) @@ -252,7 +252,7 @@ inline MediaControlVolumeSliderContainerElement::MediaControlVolumeSliderContain PassRefPtr<MediaControlVolumeSliderContainerElement> MediaControlVolumeSliderContainerElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlVolumeSliderContainerElement(mediaElement); + return adoptRef(new MediaControlVolumeSliderContainerElement(mediaElement)); } PassRefPtr<RenderStyle> MediaControlVolumeSliderContainerElement::styleForElement() @@ -298,7 +298,7 @@ inline MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(HTMLMe PassRefPtr<MediaControlStatusDisplayElement> MediaControlStatusDisplayElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlStatusDisplayElement(mediaElement); + return adoptRef(new MediaControlStatusDisplayElement(mediaElement)); } void MediaControlStatusDisplayElement::update() @@ -482,7 +482,7 @@ inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaEle PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlMuteButtonElement(mediaElement); + return adoptRef(new MediaControlMuteButtonElement(mediaElement)); } void MediaControlMuteButtonElement::defaultEventHandler(Event* event) @@ -508,7 +508,7 @@ inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(HTMLMediaEle PassRefPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlPlayButtonElement(mediaElement); + return adoptRef(new MediaControlPlayButtonElement(mediaElement)); } void MediaControlPlayButtonElement::defaultEventHandler(Event* event) @@ -537,7 +537,7 @@ inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaEle PassRefPtr<MediaControlSeekButtonElement> MediaControlSeekButtonElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId) { - return new MediaControlSeekButtonElement(mediaElement, pseudoStyleId); + return adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId)); } inline bool MediaControlSeekButtonElement::isForwardButton() const @@ -601,7 +601,7 @@ inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(HTMLMedi PassRefPtr<MediaControlRewindButtonElement> MediaControlRewindButtonElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlRewindButtonElement(mediaElement); + return adoptRef(new MediaControlRewindButtonElement(mediaElement)); } void MediaControlRewindButtonElement::defaultEventHandler(Event* event) @@ -623,7 +623,7 @@ inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeBu PassRefPtr<MediaControlReturnToRealtimeButtonElement> MediaControlReturnToRealtimeButtonElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlReturnToRealtimeButtonElement(mediaElement); + return adoptRef(new MediaControlReturnToRealtimeButtonElement(mediaElement)); } void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event) @@ -645,7 +645,7 @@ inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCa PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> MediaControlToggleClosedCaptionsButtonElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlToggleClosedCaptionsButtonElement(mediaElement); + return adoptRef(new MediaControlToggleClosedCaptionsButtonElement(mediaElement)); } void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* event) @@ -672,7 +672,7 @@ MediaControlTimelineElement::MediaControlTimelineElement(HTMLMediaElement* media PassRefPtr<MediaControlTimelineElement> MediaControlTimelineElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlTimelineElement(mediaElement); + return adoptRef(new MediaControlTimelineElement(mediaElement)); } void MediaControlTimelineElement::defaultEventHandler(Event* event) @@ -725,7 +725,7 @@ inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(HTMLMedi PassRefPtr<MediaControlVolumeSliderElement> MediaControlVolumeSliderElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlVolumeSliderElement(mediaElement); + return adoptRef(new MediaControlVolumeSliderElement(mediaElement)); } void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) @@ -767,7 +767,7 @@ inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement( PassRefPtr<MediaControlFullscreenButtonElement> MediaControlFullscreenButtonElement::create(HTMLMediaElement* mediaElement) { - return new MediaControlFullscreenButtonElement(mediaElement); + return adoptRef(new MediaControlFullscreenButtonElement(mediaElement)); } void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) @@ -790,7 +790,7 @@ inline MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(HTMLMediaE PassRefPtr<MediaControlTimeDisplayElement> MediaControlTimeDisplayElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId) { - return new MediaControlTimeDisplayElement(mediaElement, pseudoStyleId); + return adoptRef(new MediaControlTimeDisplayElement(mediaElement, pseudoStyleId)); } PassRefPtr<RenderStyle> MediaControlTimeDisplayElement::styleForElement() diff --git a/WebCore/rendering/RenderApplet.cpp b/WebCore/rendering/RenderApplet.cpp index a1689a5..12eb4fb 100644 --- a/WebCore/rendering/RenderApplet.cpp +++ b/WebCore/rendering/RenderApplet.cpp @@ -72,7 +72,7 @@ void RenderApplet::createWidgetIfNecessary() Frame* frame = this->frame(); ASSERT(frame); - setWidget(frame->loader()->createJavaAppletWidget(IntSize(contentWidth, contentHeight), element, m_args)); + setWidget(frame->loader()->subframeLoader()->createJavaAppletWidget(IntSize(contentWidth, contentHeight), element, m_args)); } void RenderApplet::layout() diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index 8c61e2c..e3a11c8 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -38,7 +38,7 @@ class RenderInline; struct BidiRun; template <class Iterator, class Run> class BidiResolver; -template <class Iterator> class MidpointState; +template <class Iterator> struct MidpointState; typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver; typedef MidpointState<InlineIterator> LineMidpointState; @@ -227,7 +227,19 @@ protected: virtual bool hasLineIfEmpty() const; bool layoutOnlyPositionedObjects(); - + +#if ENABLE(SVG) +protected: + + // Only used by RenderSVGText, which explicitely overrides RenderBlock::layoutBlock(), do NOT use for anything else. + void forceLayoutInlineChildren() + { + int repaintTop = 0; + int repaintBottom = 0; + layoutInlineChildren(true, repaintTop, repaintBottom); + } +#endif + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } @@ -295,7 +307,7 @@ private: void skipTrailingWhitespace(InlineIterator&, bool isLineEmpty, bool previousLineBrokeCleanly); int skipLeadingWhitespace(InlineBidiResolver&, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly); void fitBelowFloats(int widthToFit, bool firstLine, int& availableWidth); - InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, EClear* clear = 0); + InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, bool& hyphenated, EClear* = 0); RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject); InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine); void computeHorizontalPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&); diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index be7c76b..097b661 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -24,6 +24,7 @@ #include "BidiResolver.h" #include "CharacterNames.h" +#include "Hyphenation.h" #include "InlineIterator.h" #include "InlineTextBox.h" #include "Logging.h" @@ -46,6 +47,10 @@ #include "HTMLNames.h" #endif // ANDROID_LAYOUT +#if ENABLE(SVG) +#include "SVGRootInlineBox.h" +#endif + using namespace std; using namespace WTF; using namespace Unicode; @@ -298,6 +303,8 @@ RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun, text->setStart(r->m_start); text->setLen(r->m_stop - r->m_start); text->m_dirOverride = r->dirOverride(visuallyOrdered); + if (r->m_hasHyphen) + text->setHasHyphen(true); } } @@ -351,22 +358,19 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool } HashSet<const SimpleFontData*> fallbackFonts; GlyphOverflow glyphOverflow; - r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow)); - if (!fallbackFonts.isEmpty() -#if ENABLE(SVG) - && !isSVGText() -#endif - ) { + int hyphenWidth = 0; + if (static_cast<InlineTextBox*>(r->m_box)->hasHyphen()) { + const AtomicString& hyphenString = rt->style()->hyphenString(); + hyphenWidth = rt->style(firstLine)->font().width(TextRun(hyphenString.characters(), hyphenString.length())); + } + r->m_box->setWidth(rt->width(r->m_start, r->m_stop - r->m_start, totWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth); + if (!fallbackFonts.isEmpty()) { ASSERT(r->m_box->isText()); GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(static_cast<InlineTextBox*>(r->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).first; ASSERT(it->second.first.isEmpty()); copyToVector(fallbackFonts, it->second.first); } - if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyphOverflow.right) -#if ENABLE(SVG) - && !isSVGText() -#endif - ) { + if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyphOverflow.right)) { ASSERT(r->m_box->isText()); GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(static_cast<InlineTextBox*>(r->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).first; it->second.second = glyphOverflow; @@ -795,7 +799,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i isLineEmpty = true; EClear clear = CNONE; - end = findNextLineBreak(resolver, firstLine, isLineEmpty, previousLineBrokeCleanly, &clear); + bool hyphenated; + end = findNextLineBreak(resolver, firstLine, isLineEmpty, previousLineBrokeCleanly, hyphenated, &clear); if (resolver.position().atEnd()) { resolver.deleteRuns(); checkForFloatsFromLastLine = true; @@ -861,20 +866,37 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i RootInlineBox* lineBox = 0; if (resolver.runCount()) { + if (hyphenated) + resolver.logicallyLastRun()->m_hasHyphen = true; lineBox = constructLine(resolver.runCount(), resolver.firstRun(), resolver.lastRun(), firstLine, !end.obj, end.obj && !end.pos ? end.obj : 0); if (lineBox) { lineBox->setEndsWithBreak(previousLineBrokeCleanly); - // Now we position all of our text runs horizontally. +#if ENABLE(SVG) + bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox(); +#else + bool isSVGRootInlineBox = false; +#endif + GlyphOverflowAndFallbackFontsMap textBoxDataMap; - computeHorizontalPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap); + + // Now we position all of our text runs horizontally. + if (!isSVGRootInlineBox) + computeHorizontalPositionsForLine(lineBox, firstLine, resolver.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap); // Now position our text runs vertically. computeVerticalPositionsForLine(lineBox, resolver.firstRun(), textBoxDataMap); #if ENABLE(SVG) - // Special SVG text layout code - lineBox->computePerCharacterLayoutInformation(); + // SVG text layout code computes vertical & horizontal positions on its own. + // Note that we still need to execute computeVerticalPositionsForLine() as + // it calls InlineTextBox::positionLineBox(), which tracks whether the box + // contains reversed text or not. If we wouldn't do that editing and thus + // text selection in RTL boxes would not work as expected. + if (isSVGRootInlineBox) { + ASSERT(isSVGText()); + static_cast<SVGRootInlineBox*>(lineBox)->computePerCharacterLayoutInformation(); + } #endif #if PLATFORM(MAC) @@ -1262,7 +1284,7 @@ static inline bool shouldCollapseWhiteSpace(const RenderStyle* style, bool isLin static inline bool shouldPreserveNewline(RenderObject* object) { #if ENABLE(SVG) - if (object->isSVGText()) + if (object->isSVGInlineText()) return false; #endif @@ -1429,8 +1451,34 @@ static inline unsigned textWidth(RenderText* text, unsigned from, unsigned len, return font.width(TextRun(text->characters() + from, len, !collapseWhiteSpace, xPos)); } +static void tryHyphenating(RenderText* text, const Font& font, int lastSpace, int pos, int xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated) +{ + const AtomicString& hyphenString = text->style()->hyphenString(); + int hyphenWidth = font.width(TextRun(hyphenString.characters(), hyphenString.length())); + + unsigned prefixLength = font.offsetForPosition(TextRun(text->characters() + lastSpace, pos - lastSpace, !collapseWhiteSpace, xPos + lastSpaceWordSpacing), availableWidth - xPos - hyphenWidth - lastSpaceWordSpacing, false); + if (!prefixLength) + return; + + prefixLength = 1 + lastHyphenLocation(text->characters() + lastSpace + 1, pos - lastSpace - 1, prefixLength - 1); + if (prefixLength <= 1) + return; + +#if !ASSERT_DISABLED + int prefixWidth = hyphenWidth + textWidth(text, lastSpace, prefixLength, font, xPos, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing; + ASSERT(xPos + prefixWidth <= availableWidth); +#else + UNUSED_PARAM(isFixedPitch); +#endif + + lineBreak.obj = text; + lineBreak.pos = lastSpace + prefixLength; + lineBreak.nextBreakablePosition = nextBreakable; + hyphenated = true; +} + InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, - EClear* clear) + bool& hyphenated, EClear* clear) { ASSERT(resolver.position().block == this); @@ -1468,6 +1516,8 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool bool prevLineBrokeCleanly = previousLineBrokeCleanly; previousLineBrokeCleanly = false; + hyphenated = false; + bool autoWrapWasEverTrueOnLine = false; bool floatsFitOnLine = true; @@ -1486,7 +1536,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool autoWrapWasEverTrueOnLine = autoWrapWasEverTrueOnLine || autoWrap; #if ENABLE(SVG) - bool preserveNewline = o->isSVGText() ? false : RenderStyle::preserveNewline(currWS); + bool preserveNewline = o->isSVGInlineText() ? false : RenderStyle::preserveNewline(currWS); #else bool preserveNewline = RenderStyle::preserveNewline(currWS); #endif @@ -1641,8 +1691,10 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool int len = strlen - pos; const UChar* str = t->characters(); - const Font& f = t->style(firstLine)->font(); + RenderStyle* style = t->style(firstLine); + const Font& f = style->font(); bool isFixedPitch = f.isFixedPitch(); + bool canHyphenate = style->hyphens() == HyphensAuto; int lastSpace = pos; int wordSpacing = o->style()->wordSpacing(); @@ -1712,6 +1764,11 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool len--; lastSpaceWordSpacing = 0; lastSpace = pos; // Cheesy hack to prevent adding in widths of the run twice. + if (style->hyphens() == HyphensNone) { + // Prevent a line break at the soft hyphen by ensuring that betweenWords is false + // in the next iteration. + atStart = true; + } continue; } @@ -1782,6 +1839,11 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool } } if (lineWasTooWide || w + tmpW > width) { + if (canHyphenate && w + tmpW > width) { + tryHyphenating(t, f, lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated); + if (hyphenated) + goto end; + } if (lBreak.obj && shouldPreserveNewline(lBreak.obj) && lBreak.obj->isText() && toRenderText(lBreak.obj)->textLength() && !toRenderText(lBreak.obj)->isWordBreak() && toRenderText(lBreak.obj)->characters()[lBreak.pos] == '\n') { if (!stoppedIgnoringSpaces && pos > 0) { // We need to stop right before the newline and then start up again. @@ -1887,9 +1949,15 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool } // IMPORTANT: pos is > length here! - if (!ignoringSpaces) - tmpW += textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing; + int additionalTmpW = ignoringSpaces ? 0 : textWidth(t, lastSpace, pos - lastSpace, f, w + tmpW, isFixedPitch, collapseWhiteSpace) + lastSpaceWordSpacing; + tmpW += additionalTmpW; tmpW += inlineWidth(o, !appliedStartWidth, true); + + if (canHyphenate && w + tmpW > width) { + tryHyphenating(t, f, lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated); + if (hyphenated) + goto end; + } } else ASSERT_NOT_REACHED(); diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp index 196e8c5..3f1b5ae 100644 --- a/WebCore/rendering/RenderBoxModelObject.cpp +++ b/WebCore/rendering/RenderBoxModelObject.cpp @@ -4,6 +4,7 @@ * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google 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 @@ -48,77 +49,57 @@ bool RenderBoxModelObject::s_layerWasSelfPainting = false; static const double cInterpolationCutoff = 800. * 800.; static const double cLowQualityTimeThreshold = 0.500; // 500 ms -class RenderBoxModelScaleData : public Noncopyable { -public: - RenderBoxModelScaleData(RenderBoxModelObject* object, const IntSize& size, const AffineTransform& transform, double time, bool lowQualityScale) - : m_size(size) - , m_transform(transform) - , m_lastPaintTime(time) - , m_lowQualityScale(lowQualityScale) - , m_highQualityRepaintTimer(object, &RenderBoxModelObject::highQualityRepaintTimerFired) - { - } +typedef HashMap<RenderBoxModelObject*, IntSize> LastPaintSizeMap; - ~RenderBoxModelScaleData() - { - m_highQualityRepaintTimer.stop(); - } - - Timer<RenderBoxModelObject>& hiqhQualityRepaintTimer() { return m_highQualityRepaintTimer; } - - const IntSize& size() const { return m_size; } - void setSize(const IntSize& s) { m_size = s; } - double lastPaintTime() const { return m_lastPaintTime; } - void setLastPaintTime(double t) { m_lastPaintTime = t; } - bool useLowQualityScale() const { return m_lowQualityScale; } - const AffineTransform& transform() const { return m_transform; } - void setTransform(const AffineTransform& transform) { m_transform = transform; } - void setUseLowQualityScale(bool b) - { - m_highQualityRepaintTimer.stop(); - m_lowQualityScale = b; - if (b) - m_highQualityRepaintTimer.startOneShot(cLowQualityTimeThreshold); - } +class ImageQualityController : public Noncopyable { +public: + ImageQualityController(); + bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const IntSize&); + void objectDestroyed(RenderBoxModelObject*); private: - IntSize m_size; - AffineTransform m_transform; - double m_lastPaintTime; - bool m_lowQualityScale; - Timer<RenderBoxModelObject> m_highQualityRepaintTimer; + void highQualityRepaintTimerFired(Timer<ImageQualityController>*); + void restartTimer(); + + LastPaintSizeMap m_lastPaintSizeMap; + Timer<ImageQualityController> m_timer; + bool m_animatedResizeIsActive; }; -class RenderBoxModelScaleObserver { -public: - static bool shouldPaintBackgroundAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const IntSize&); - - static void boxModelObjectDestroyed(RenderBoxModelObject* object) - { - if (gBoxModelObjects) { - RenderBoxModelScaleData* data = gBoxModelObjects->take(object); - delete data; - if (!gBoxModelObjects->size()) { - delete gBoxModelObjects; - gBoxModelObjects = 0; - } - } - } +ImageQualityController::ImageQualityController() + : m_timer(this, &ImageQualityController::highQualityRepaintTimerFired) + , m_animatedResizeIsActive(false) +{ +} - static void highQualityRepaintTimerFired(RenderBoxModelObject* object) - { - RenderBoxModelScaleObserver::boxModelObjectDestroyed(object); - object->repaint(); +void ImageQualityController::objectDestroyed(RenderBoxModelObject* object) +{ + m_lastPaintSizeMap.remove(object); + if (m_lastPaintSizeMap.isEmpty()) { + m_animatedResizeIsActive = false; + m_timer.stop(); + } +} + +void ImageQualityController::highQualityRepaintTimerFired(Timer<ImageQualityController>*) +{ + if (m_animatedResizeIsActive) { + m_animatedResizeIsActive = false; + for (LastPaintSizeMap::iterator it = m_lastPaintSizeMap.begin(); it != m_lastPaintSizeMap.end(); ++it) + it->first->repaint(); } +} - static HashMap<RenderBoxModelObject*, RenderBoxModelScaleData*>* gBoxModelObjects; -}; +void ImageQualityController::restartTimer() +{ + m_timer.startOneShot(cLowQualityTimeThreshold); +} -bool RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const IntSize& size) +bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const IntSize& size) { // If the image is not a bitmap image, then none of this is relevant and we just paint at high // quality. - if (!image || !image->isBitmapImage()) + if (!image || !image->isBitmapImage() || context->paintingDisabled()) return false; // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image @@ -126,59 +107,57 @@ bool RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality(GraphicsCont IntSize imageSize(image->width(), image->height()); // Look ourselves up in the hashtable. - RenderBoxModelScaleData* data = 0; - if (gBoxModelObjects) - data = gBoxModelObjects->get(object); + LastPaintSizeMap::iterator i = m_lastPaintSizeMap.find(object); const AffineTransform& currentTransform = context->getCTM(); bool contextIsScaled = !currentTransform.isIdentityOrTranslationOrFlipped(); if (!contextIsScaled && imageSize == size) { - // There is no scale in effect. If we had a scale in effect before, we can just delete this data. - if (data) { - gBoxModelObjects->remove(object); - delete data; - } + // There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list. + if (i != m_lastPaintSizeMap.end()) + m_lastPaintSizeMap.remove(object); + return false; } - // There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case. + // There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case. if (object->document()->page()->inLowQualityImageInterpolationMode()) { double totalPixels = static_cast<double>(image->width()) * static_cast<double>(image->height()); if (totalPixels > cInterpolationCutoff) return true; } - - // If there is no data yet, we will paint the first scale at high quality and record the paint time in case a second scale happens - // very soon. - if (!data) { - data = new RenderBoxModelScaleData(object, size, currentTransform, currentTime(), false); - if (!gBoxModelObjects) - gBoxModelObjects = new HashMap<RenderBoxModelObject*, RenderBoxModelScaleData*>; - gBoxModelObjects->set(object, data); + // If an animated resize is active, paint in low quality and kick the timer ahead. + if (m_animatedResizeIsActive) { + m_lastPaintSizeMap.set(object, size); + restartTimer(); + return true; + } + // If this is the first time resizing this image, or its size is the + // same as the last resize, draw at high res, but record the paint + // size and set the timer. + if (i == m_lastPaintSizeMap.end() || size == i->second) { + restartTimer(); + m_lastPaintSizeMap.set(object, size); return false; } - - const AffineTransform& tr = data->transform(); - bool scaleUnchanged = tr.a() == currentTransform.a() && tr.b() == currentTransform.b() && tr.c() == currentTransform.c() && tr.d() == currentTransform.d(); - // We are scaled, but we painted already at this size, so just keep using whatever mode we last painted with. - if ((!contextIsScaled || scaleUnchanged) && data->size() == size) - return data->useLowQualityScale(); - - // We have data and our size just changed. If this change happened quickly, go into low quality mode and then set a repaint - // timer to paint in high quality mode. Otherwise it is ok to just paint in high quality mode. - double newTime = currentTime(); - data->setUseLowQualityScale(newTime - data->lastPaintTime() < cLowQualityTimeThreshold); - data->setLastPaintTime(newTime); - data->setTransform(currentTransform); - data->setSize(size); - return data->useLowQualityScale(); + // If the timer is no longer active, draw at high quality and don't + // set the timer. + if (!m_timer.isActive()) { + objectDestroyed(object); + return false; + } + // This object has been resized to two different sizes while the timer + // is active, so draw at low quality, set the flag for animated resizes and + // the object to the list for high quality redraw. + m_lastPaintSizeMap.set(object, size); + m_animatedResizeIsActive = true; + restartTimer(); + return true; } -HashMap<RenderBoxModelObject*, RenderBoxModelScaleData*>* RenderBoxModelScaleObserver::gBoxModelObjects = 0; - -void RenderBoxModelObject::highQualityRepaintTimerFired(Timer<RenderBoxModelObject>*) +static ImageQualityController* imageQualityController() { - RenderBoxModelScaleObserver::highQualityRepaintTimerFired(this); + static ImageQualityController* controller = new ImageQualityController; + return controller; } void RenderBoxModelObject::setSelectionState(SelectionState s) @@ -203,6 +182,10 @@ void RenderBoxModelObject::setSelectionState(SelectionState s) cb->setSelectionState(s); } +bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const IntSize& size) +{ + return imageQualityController()->shouldPaintAtLowQuality(context, this, image, size); +} RenderBoxModelObject::RenderBoxModelObject(Node* node) : RenderObject(node) @@ -215,7 +198,7 @@ RenderBoxModelObject::~RenderBoxModelObject() // Our layer should have been destroyed and cleared by now ASSERT(!hasLayer()); ASSERT(!m_layer); - RenderBoxModelScaleObserver::boxModelObjectDestroyed(this); + imageQualityController()->objectDestroyed(this); } void RenderBoxModelObject::destroyLayer() @@ -464,7 +447,6 @@ int RenderBoxModelObject::paddingRight(bool) const return padding.calcMinValue(w); } - void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& c, const FillLayer* bgLayer, int tx, int ty, int w, int h, InlineFlowBox* box, CompositeOperator op, RenderObject* backgroundObject) { GraphicsContext* context = paintInfo.context; @@ -631,7 +613,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op; RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject : this; Image* image = bg->image(clientForBackgroundImage, tileSize); - bool useLowQualityScaling = RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality(context, this, image, tileSize); + bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, tileSize); context->drawTiledImage(image, style()->colorSpace(), destRect, phase, tileSize, compositeOp, useLowQualityScaling); } } diff --git a/WebCore/rendering/RenderBoxModelObject.h b/WebCore/rendering/RenderBoxModelObject.h index dc2cf18..f022495 100644 --- a/WebCore/rendering/RenderBoxModelObject.h +++ b/WebCore/rendering/RenderBoxModelObject.h @@ -2,6 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google 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 @@ -107,6 +108,8 @@ public: protected: void calculateBackgroundImageGeometry(const FillLayer*, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize); + bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const IntSize&); + private: virtual bool isBoxModelObject() const { return true; } diff --git a/WebCore/rendering/RenderEmbeddedObject.cpp b/WebCore/rendering/RenderEmbeddedObject.cpp index 3d3278a..7ab12a1 100644 --- a/WebCore/rendering/RenderEmbeddedObject.cpp +++ b/WebCore/rendering/RenderEmbeddedObject.cpp @@ -165,7 +165,7 @@ void RenderEmbeddedObject::updateWidget(bool onlyCreateNonNetscapePlugins) Vector<String> paramValues; Frame* frame = frameView()->frame(); - // The calls to FrameLoader::requestObject within this function can result in a plug-in being initialized. + // The calls to SubframeLoader::requestObject within this function can result in a plug-in being initialized. // This can run cause arbitrary JavaScript to run and may result in this RenderObject being detached from // the render tree and destroyed, causing a crash like <rdar://problem/6954546>. By extending our lifetime // artifically to ensure that we remain alive for the duration of plug-in initialization. @@ -284,7 +284,16 @@ void RenderEmbeddedObject::updateWidget(bool onlyCreateNonNetscapePlugins) return; } - bool success = objectElement->dispatchBeforeLoadEvent(url) && frame->loader()->requestObject(this, url, objectElement->getAttribute(nameAttr), serviceType, paramNames, paramValues); + bool beforeLoadAllowedLoad = objectElement->dispatchBeforeLoadEvent(url); + + // beforeload events can modify the DOM, potentially causing + // RenderWidget::destroy() to be called. Ensure we haven't been + // destroyed before continuing. + if (!node()) + return; + + bool success = beforeLoadAllowedLoad && frame->loader()->subframeLoader()->requestObject(this, url, objectElement->getAttribute(nameAttr), serviceType, paramNames, paramValues); + if (!success && m_hasFallbackContent) objectElement->renderFallbackContent(); @@ -319,7 +328,7 @@ void RenderEmbeddedObject::updateWidget(bool onlyCreateNonNetscapePlugins) } if (embedElement->dispatchBeforeLoadEvent(url)) - frame->loader()->requestObject(this, url, embedElement->getAttribute(nameAttr), serviceType, paramNames, paramValues); + frame->loader()->subframeLoader()->requestObject(this, url, embedElement->getAttribute(nameAttr), serviceType, paramNames, paramValues); } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) else if (node()->hasTagName(videoTag) || node()->hasTagName(audioTag)) { @@ -328,7 +337,7 @@ void RenderEmbeddedObject::updateWidget(bool onlyCreateNonNetscapePlugins) mediaElement->getPluginProxyParams(kurl, paramNames, paramValues); mediaElement->setNeedWidgetUpdate(false); - frame->loader()->loadMediaPlayerProxyPlugin(node(), kurl, paramNames, paramValues); + frame->loader()->subframeLoader()->loadMediaPlayerProxyPlugin(node(), kurl, paramNames, paramValues); } #endif } diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp index f42a657..c652276 100644 --- a/WebCore/rendering/RenderFileUploadControl.cpp +++ b/WebCore/rendering/RenderFileUploadControl.cpp @@ -53,7 +53,6 @@ const int buttonShadowHeight = 2; RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input) : RenderBlock(input) - , m_button(0) { FileList* list = input->files(); Vector<String> filenames; diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 98b0f47..643fac9 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -5,6 +5,7 @@ * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google 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 @@ -56,133 +57,6 @@ using namespace std; namespace WebCore { -static const double cInterpolationCutoff = 800. * 800.; -static const double cLowQualityTimeThreshold = 0.050; // 50 ms - -class RenderImageScaleData : public Noncopyable { -public: - RenderImageScaleData(RenderImage* image, const IntSize& size, double time, bool lowQualityScale) - : m_size(size) - , m_time(time) - , m_lowQualityScale(lowQualityScale) - , m_highQualityRepaintTimer(image, &RenderImage::highQualityRepaintTimerFired) - { - } - - ~RenderImageScaleData() - { - m_highQualityRepaintTimer.stop(); - } - - const IntSize& size() const { return m_size; } - double time() const { return m_time; } - bool useLowQualityScale() const { return m_lowQualityScale; } - Timer<RenderImage>& hiqhQualityRepaintTimer() { return m_highQualityRepaintTimer; } - - void setSize(const IntSize& s) { m_size = s; } - void setTime(double t) { m_time = t; } - void setUseLowQualityScale(bool b) - { - m_highQualityRepaintTimer.stop(); - m_lowQualityScale = b; - if (b) - m_highQualityRepaintTimer.startOneShot(cLowQualityTimeThreshold); - } - -private: - IntSize m_size; - double m_time; - bool m_lowQualityScale; - Timer<RenderImage> m_highQualityRepaintTimer; -}; - -class RenderImageScaleObserver { -public: - static bool shouldImagePaintAtLowQuality(RenderImage*, const IntSize&); - - static void imageDestroyed(RenderImage* image) - { - if (gImages) { - RenderImageScaleData* data = gImages->take(image); - delete data; - if (gImages->size() == 0) { - delete gImages; - gImages = 0; - } - } - } - - static void highQualityRepaintTimerFired(RenderImage* image) - { - RenderImageScaleObserver::imageDestroyed(image); - image->repaint(); - } - - static HashMap<RenderImage*, RenderImageScaleData*>* gImages; -}; - -bool RenderImageScaleObserver::shouldImagePaintAtLowQuality(RenderImage* image, const IntSize& size) -{ - // If the image is not a bitmap image, then none of this is relevant and we just paint at high - // quality. - if (!image->image() || !image->image()->isBitmapImage()) - return false; - - // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image - // is actually being scaled. - IntSize imageSize(image->image()->width(), image->image()->height()); - - // Look ourselves up in the hashtable. - RenderImageScaleData* data = 0; - if (gImages) - data = gImages->get(image); - - if (imageSize == size) { - // There is no scale in effect. If we had a scale in effect before, we can just delete this data. - if (data) { - gImages->remove(image); - delete data; - } - return false; - } - - // There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case. - if (image->document()->page()->inLowQualityImageInterpolationMode()) { - double totalPixels = static_cast<double>(image->image()->width()) * static_cast<double>(image->image()->height()); - if (totalPixels > cInterpolationCutoff) - return true; - } - - // If there is no data yet, we will paint the first scale at high quality and record the paint time in case a second scale happens - // very soon. - if (!data) { - data = new RenderImageScaleData(image, size, currentTime(), false); - if (!gImages) - gImages = new HashMap<RenderImage*, RenderImageScaleData*>; - gImages->set(image, data); - return false; - } - - // We are scaled, but we painted already at this size, so just keep using whatever mode we last painted with. - if (data->size() == size) - return data->useLowQualityScale(); - - // We have data and our size just changed. If this change happened quickly, go into low quality mode and then set a repaint - // timer to paint in high quality mode. Otherwise it is ok to just paint in high quality mode. - double newTime = currentTime(); - data->setUseLowQualityScale(newTime - data->time() < cLowQualityTimeThreshold); - data->setTime(newTime); - data->setSize(size); - return data->useLowQualityScale(); -} - -HashMap<RenderImage*, RenderImageScaleData*>* RenderImageScaleObserver::gImages = 0; - -void RenderImage::highQualityRepaintTimerFired(Timer<RenderImage>*) -{ - RenderImageScaleObserver::highQualityRepaintTimerFired(this); -} - using namespace HTMLNames; RenderImage::RenderImage(Node* node) @@ -198,7 +72,6 @@ RenderImage::~RenderImage() { if (m_cachedImage) m_cachedImage->removeClient(this); - RenderImageScaleObserver::imageDestroyed(this); } void RenderImage::setCachedImage(CachedImage* newImage) @@ -497,7 +370,7 @@ void RenderImage::paintIntoRect(GraphicsContext* context, const IntRect& rect) HTMLImageElement* imageElt = (node() && node()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(node()) : 0; CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver; - bool useLowQualityScaling = RenderImageScaleObserver::shouldImagePaintAtLowQuality(this, rect.size()); + bool useLowQualityScaling = shouldPaintAtLowQuality(context, this->image(), rect.size()); context->drawImage(image(rect.width(), rect.height()), style()->colorSpace(), rect, compositeOperator, useLowQualityScaling); } diff --git a/WebCore/rendering/RenderIndicator.cpp b/WebCore/rendering/RenderIndicator.cpp new file mode 100644 index 0000000..afff9c2 --- /dev/null +++ b/WebCore/rendering/RenderIndicator.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#if ENABLE(PROGRESS_TAG) || ENABLE(METER_TAG) + +#include "RenderIndicator.h" + +#include "RenderTheme.h" + +using namespace std; + +namespace WebCore { + +RenderIndicator::RenderIndicator(Node* node) + : RenderBlock(node) +{ +} + +RenderIndicator::~RenderIndicator() +{ +} + +void RenderIndicator::layout() +{ + ASSERT(needsLayout()); + + LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); + calcWidth(); + calcHeight(); + layoutParts(); + repainter.repaintAfterLayout(); + setNeedsLayout(false); +} + +void RenderIndicator::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBlock::styleDidChange(diff, oldStyle); + requestLayoutForParts(); +} + +void RenderIndicator::updateFromElement() +{ + requestLayoutForParts(); + repaint(); +} + +bool RenderIndicator::hasParts() const +{ + if (RenderObject* last = lastChild()) + return last->isRenderBlock(); + return false; +} + +void RenderIndicator::requestLayoutForParts() +{ + if (shouldHaveParts() || hasParts()) + setNeedsLayout(true); +} + +} // namespace WebCore + +#endif diff --git a/WebCore/rendering/RenderIndicator.h b/WebCore/rendering/RenderIndicator.h new file mode 100644 index 0000000..2d82a09 --- /dev/null +++ b/WebCore/rendering/RenderIndicator.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef RenderIndicator_h +#define RenderIndicator_h + +#if ENABLE(PROGRESS_TAG) || ENABLE(METER_TAG) +#include "RenderBlock.h" + +namespace WebCore { + +class RenderIndicator : public RenderBlock { +public: + RenderIndicator(Node*); + virtual ~RenderIndicator(); + +protected: + virtual void layout(); + virtual void updateFromElement(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual bool requiresForcedStyleRecalcPropagation() const { return true; } + + virtual void layoutParts() = 0; + virtual bool shouldHaveParts() const = 0; + +private: + void requestLayoutForParts(); + bool hasParts() const; +}; + +} // namespace WebCore + +#endif + +#endif // RenderIndicator_h + diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 5d206dd..fcb9c07 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -376,6 +376,14 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags, IntPoint *cachedOffset = oldCachedOffset; } +IntRect RenderLayer::repaintRectIncludingDescendants() const +{ + IntRect repaintRect = m_repaintRect; + for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) + repaintRect.unite(child->repaintRectIncludingDescendants()); + return repaintRect; +} + void RenderLayer::computeRepaintRects() { RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h index f300d76..45b64e0 100644 --- a/WebCore/rendering/RenderLayer.h +++ b/WebCore/rendering/RenderLayer.h @@ -403,6 +403,7 @@ public: // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint. IntRect repaintRect() const { return m_repaintRect; } + IntRect repaintRectIncludingDescendants() const; void computeRepaintRects(); void updateRepaintRectsAfterScroll(bool fixed = false); void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; } diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index b55a474..794b55a 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -216,8 +216,8 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration() else if (is3DCanvas(renderer())) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer()->node()); WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(canvas->renderingContext()); - if (context->graphicsContext3D()->platformGraphicsContext3D()) - m_graphicsLayer->setContentsToGraphicsContext3D(context->graphicsContext3D()); + if (context->graphicsContext3D()->platformLayer()) + m_graphicsLayer->setContentsToWebGL(context->graphicsContext3D()->platformLayer()); } #endif @@ -227,6 +227,18 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration() return layerConfigChanged; } +static IntRect clipBox(RenderBox* renderer) +{ + IntRect result = ClipRects::infiniteRect(); + if (renderer->hasOverflowClip()) + result = renderer->overflowClipRect(0, 0); + + if (renderer->hasClip()) + result.intersect(renderer->clipRect(0, 0)); + + return result; +} + void RenderLayerBacking::updateGraphicsLayerGeometry() { // If we haven't built z-order lists yet, wait until later. @@ -266,7 +278,8 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() if (compAncestor && compAncestor->backing()->hasClippingLayer()) { // If the compositing ancestor has a layer to clip children, we parent in that, and therefore // position relative to it. - graphicsLayerParentLocation = toRenderBox(compAncestor->renderer())->overflowClipRect(0, 0).location(); + IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); + graphicsLayerParentLocation = clippingBox.location(); } else graphicsLayerParentLocation = ancestorCompositingBounds.location(); @@ -302,7 +315,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() // If we have a layer that clips children, position it. IntRect clippingBox; if (m_clippingLayer) { - clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0); + clippingBox = clipBox(toRenderBox(renderer())); m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location())); m_clippingLayer->setSize(clippingBox.size()); m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint()); @@ -714,7 +727,7 @@ bool RenderLayerBacking::containsPaintedContent() const bool RenderLayerBacking::isDirectlyCompositedImage() const { RenderObject* renderObject = renderer(); - return renderObject->isImage() && !hasBoxDecorationsOrBackground(renderObject); + return renderObject->isImage() && !hasBoxDecorationsOrBackground(renderObject) && !renderObject->hasClip(); } void RenderLayerBacking::rendererContentChanged() @@ -726,7 +739,7 @@ void RenderLayerBacking::rendererContentChanged() #if ENABLE(3D_CANVAS) if (is3DCanvas(renderer())) { - m_graphicsLayer->setGraphicsContext3DNeedsDisplay(); + m_graphicsLayer->setContentsNeedsDisplay(); return; } #endif diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index f68623b..f2c0dc4 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -469,7 +469,7 @@ RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend if (curr->isStackingContext()) return 0; - if (curr->renderer()->hasOverflowClip()) + if (curr->renderer()->hasOverflowClip() || curr->renderer()->hasClip()) return curr; } return 0; @@ -1229,9 +1229,8 @@ bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const // into the hierarchy between this layer and its children in the z-order hierarchy. bool RenderLayerCompositor::clipsCompositingDescendants(const RenderLayer* layer) const { - // FIXME: need to look at hasClip() too eventually return layer->hasCompositingDescendant() && - layer->renderer()->hasOverflowClip(); + (layer->renderer()->hasOverflowClip() || layer->renderer()->hasClip()); } bool RenderLayerCompositor::requiresCompositingForTransform(RenderObject* renderer) const diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp index 871c10f..77fe3c2 100644 --- a/WebCore/rendering/RenderMenuList.cpp +++ b/WebCore/rendering/RenderMenuList.cpp @@ -314,7 +314,7 @@ void RenderMenuList::valueChanged(unsigned listIndex, bool fireOnChange) void RenderMenuList::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow) { SelectElement* select = toSelectElement(static_cast<Element*>(node())); - select->listBoxSelectItem(select->listToOptionIndex(listIndex), allowMultiplySelections, shift, fireOnChangeNow); + select->listBoxSelectItem(listIndex, allowMultiplySelections, shift, fireOnChangeNow); } bool RenderMenuList::multiple() diff --git a/WebCore/rendering/RenderMeter.cpp b/WebCore/rendering/RenderMeter.cpp index d443ceb..cfa7cba 100644 --- a/WebCore/rendering/RenderMeter.cpp +++ b/WebCore/rendering/RenderMeter.cpp @@ -27,6 +27,7 @@ #include "HTMLMeterElement.h" #include "HTMLNames.h" #include "RenderTheme.h" +#include "ShadowElement.h" using namespace std; @@ -35,10 +36,18 @@ namespace WebCore { using namespace HTMLNames; RenderMeter::RenderMeter(HTMLMeterElement* element) - : RenderBlock(element) + : RenderIndicator(element) { } +RenderMeter::~RenderMeter() +{ + if (m_valuePart) + m_valuePart->detach(); + if (m_barPart) + m_barPart->detach(); +} + void RenderMeter::calcWidth() { RenderBox::calcWidth(); @@ -51,25 +60,125 @@ void RenderMeter::calcHeight() setHeight(theme()->meterSizeForBounds(this, frameRect()).height()); } -void RenderMeter::layout() +void RenderMeter::layoutParts() { - ASSERT(needsLayout()); + // We refresh shadow node here because the state can depend + // on the frame size of this render object. + updatePartsState(); + if (m_valuePart) + m_valuePart->layoutAsPart(valuePartRect()); + if (m_barPart) + m_barPart->layoutAsPart(barPartRect()); +} - LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); +bool RenderMeter::shouldHaveParts() const +{ + bool hasTheme = theme()->supportsMeter(style()->appearance(), isHorizontal()); + if (!hasTheme) + return true; + bool shadowsHaveStyle = ShadowBlockElement::partShouldHaveStyle(this, barPseudoId()) || ShadowBlockElement::partShouldHaveStyle(this, valuePseudoId()); + if (shadowsHaveStyle) + return true; + return false; +} - calcWidth(); - calcHeight(); +double RenderMeter::valueRatio() const +{ + HTMLMeterElement* element = static_cast<HTMLMeterElement*>(node()); + double min = element->min(); + double max = element->max(); + double value = element->value(); + + if (max <= min) + return 0; + return (value - min) / (max - min); +} - m_overflow.clear(); +IntRect RenderMeter::barPartRect() const +{ + return IntRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround(width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()), height() - borderTop() - paddingTop() - borderBottom() - paddingBottom()); +} - repainter.repaintAfterLayout(); +IntRect RenderMeter::valuePartRect() const +{ + IntRect rect = barPartRect(); + + if (rect.height() <= rect.width()) { + int width = static_cast<int>(rect.width()*valueRatio()); + if (style()->direction() == RTL) { + rect.setX(rect.x() + (rect.width() - width)); + rect.setWidth(width); + } else + rect.setWidth(width); + } else { + int height = static_cast<int>(rect.height()*valueRatio()); + rect.setY(rect.y() + (rect.height() - height)); + rect.setHeight(height); + } + + return rect; +} + +bool RenderMeter::isHorizontal() const +{ + IntRect rect = barPartRect(); + return rect.height() <= rect.width(); +} - setNeedsLayout(false); +PseudoId RenderMeter::valuePseudoId() const +{ + HTMLMeterElement* element = static_cast<HTMLMeterElement*>(node()); + + if (isHorizontal()) { + switch (element->gaugeRegion()) { + case HTMLMeterElement::GaugeRegionOptimum: + return METER_HORIZONTAL_OPTIMUM; + case HTMLMeterElement::GaugeRegionSuboptimal: + return METER_HORIZONTAL_SUBOPTIMAL; + case HTMLMeterElement::GaugeRegionEvenLessGood: + return METER_HORIZONTAL_EVEN_LESS_GOOD; + } + } else { + switch (element->gaugeRegion()) { + case HTMLMeterElement::GaugeRegionOptimum: + return METER_VERTICAL_OPTIMUM; + case HTMLMeterElement::GaugeRegionSuboptimal: + return METER_VERTICAL_SUBOPTIMAL; + case HTMLMeterElement::GaugeRegionEvenLessGood: + return METER_VERTICAL_EVEN_LESS_GOOD; + } + } + + ASSERT_NOT_REACHED(); + return NOPSEUDO; +} + +PseudoId RenderMeter::barPseudoId() const +{ + return isHorizontal() ? METER_HORIZONTAL_BAR : METER_VERTICAL_BAR; } -void RenderMeter::updateFromElement() +void RenderMeter::updatePartsState() { - repaint(); + if (shouldHaveParts() && !m_barPart) { + ASSERT(!m_valuePart); + m_barPart = ShadowBlockElement::createForPart(this->node(), barPseudoId()); + addChild(m_barPart->renderer()); + m_valuePart = ShadowBlockElement::createForPart(this->node(), valuePseudoId()); + addChild(m_valuePart->renderer()); + } else if (!shouldHaveParts() && m_barPart) { + ASSERT(m_valuePart); + m_barPart->detach(); + m_barPart = 0; + m_valuePart->detach(); + m_valuePart = 0; + } + + if (m_barPart) { + ASSERT(m_valuePart); + m_barPart->updateStyleForPart(barPseudoId()); + m_valuePart->updateStyleForPart(valuePseudoId()); + } } } // namespace WebCore diff --git a/WebCore/rendering/RenderMeter.h b/WebCore/rendering/RenderMeter.h index fd95adb..0e73e40 100644 --- a/WebCore/rendering/RenderMeter.h +++ b/WebCore/rendering/RenderMeter.h @@ -23,23 +23,39 @@ #if ENABLE(METER_TAG) #include "RenderBlock.h" +#include "RenderProgress.h" #include "RenderWidget.h" + namespace WebCore { class HTMLMeterElement; +class ShadowBlockElement; -class RenderMeter : public RenderBlock { +class RenderMeter : public RenderIndicator { public: RenderMeter(HTMLMeterElement*); + virtual ~RenderMeter(); private: virtual const char* renderName() const { return "RenderMeter"; } virtual bool isMeter() const { return true; } - virtual void layout(); - virtual void updateFromElement(); virtual void calcWidth(); virtual void calcHeight(); + + virtual void layoutParts(); + virtual bool shouldHaveParts() const; + + bool isHorizontal() const; + void updatePartsState(); + IntRect valuePartRect() const; + PseudoId valuePseudoId() const; + IntRect barPartRect() const; + PseudoId barPseudoId() const; + double valueRatio() const; + + RefPtr<ShadowBlockElement> m_barPart; + RefPtr<ShadowBlockElement> m_valuePart; }; inline RenderMeter* toRenderMeter(RenderObject* object) diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index e9e9ffc..143e2c0 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -1633,9 +1633,6 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS s_affectsParentBlock = false; if (view()->frameView()) { - // FIXME: A better solution would be to only invalidate the fixed regions when scrolling. It's overkill to - // prevent the entire view from blitting on a scroll. - bool shouldBlitOnFixedBackgroundImage = false; #if ENABLE(FAST_MOBILE_SCROLLING) // On low-powered/mobile devices, preventing blitting on a scroll can cause noticeable delays @@ -1645,11 +1642,8 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS shouldBlitOnFixedBackgroundImage = true; #endif - bool newStyleSlowScroll = newStyle && (newStyle->position() == FixedPosition - || (!shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage())); - bool oldStyleSlowScroll = m_style && (m_style->position() == FixedPosition - || (!shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage())); - + bool newStyleSlowScroll = newStyle && !shouldBlitOnFixedBackgroundImage && newStyle->hasFixedBackgroundImage(); + bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage && m_style->hasFixedBackgroundImage(); if (oldStyleSlowScroll != newStyleSlowScroll) { if (oldStyleSlowScroll) view()->frameView()->removeSlowRepaintObject(); diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 9f1e8dd..3446a00 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -341,6 +341,7 @@ public: virtual bool isSVGHiddenContainer() const { return false; } virtual bool isRenderPath() const { return false; } virtual bool isSVGText() const { return false; } + virtual bool isSVGInlineText() const { return false; } virtual bool isSVGImage() const { return false; } virtual bool isSVGForeignObject() const { return false; } virtual bool isSVGResourceContainer() const { return false; } diff --git a/WebCore/rendering/RenderProgress.cpp b/WebCore/rendering/RenderProgress.cpp index e4e045d..2587e4b 100644 --- a/WebCore/rendering/RenderProgress.cpp +++ b/WebCore/rendering/RenderProgress.cpp @@ -23,11 +23,11 @@ #if ENABLE(PROGRESS_TAG) #include "RenderProgress.h" -#include "ShadowElement.h" + #include "HTMLNames.h" #include "HTMLProgressElement.h" #include "RenderTheme.h" -#include "RenderView.h" +#include "ShadowElement.h" #include <wtf/CurrentTime.h> #include <wtf/RefPtr.h> @@ -36,14 +36,13 @@ using namespace std; namespace WebCore { RenderProgress::RenderProgress(HTMLProgressElement* element) - : RenderBlock(element) + : RenderIndicator(element) , m_position(-1) , m_animationStartTime(0) , m_animationRepeatInterval(0) , m_animationDuration(0) , m_animating(false) , m_animationTimer(this, &RenderProgress::animationTimerFired) - , m_valuePart(0) { } @@ -53,53 +52,6 @@ RenderProgress::~RenderProgress() m_valuePart->detach(); } -void RenderProgress::layout() -{ - ASSERT(needsLayout()); - - LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); - - IntSize oldSize = size(); - - calcWidth(); - calcHeight(); - if (m_valuePart) { - IntRect valuePartRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround((width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()) * position()), height() - borderTop() - paddingTop() - borderBottom() - paddingBottom()); - if (style()->direction() == RTL) - valuePartRect.setX(width() - borderRight() - paddingRight() - valuePartRect.width()); - toRenderBox(m_valuePart->renderer())->setFrameRect(valuePartRect); - - if (oldSize != size()) - m_valuePart->renderer()->setChildNeedsLayout(true, false); - - LayoutStateMaintainer statePusher(view(), this, size()); - - IntRect oldRect = toRenderBox(m_valuePart->renderer())->frameRect(); - - m_valuePart->renderer()->layoutIfNeeded(); - - toRenderBox(m_valuePart->renderer())->setFrameRect(valuePartRect); - if (m_valuePart->renderer()->checkForRepaintDuringLayout()) - m_valuePart->renderer()->repaintDuringLayoutIfMoved(oldRect); - - statePusher.pop(); - addOverflowFromChild(toRenderBox(m_valuePart->renderer())); - } - - updateAnimationState(); - - repainter.repaintAfterLayout(); - - setNeedsLayout(false); -} - -void RenderProgress::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) -{ - RenderBlock::styleDidChange(diff, oldStyle); - - updateValuePartState(); -} - void RenderProgress::updateFromElement() { HTMLProgressElement* element = progressElement(); @@ -108,45 +60,7 @@ void RenderProgress::updateFromElement() m_position = element->position(); updateAnimationState(); - - updateValuePartState(); - - repaint(); -} - -void RenderProgress::updateValuePartState() -{ - bool needLayout = !style()->hasAppearance() || m_valuePart; - if (!style()->hasAppearance() && !m_valuePart) { - m_valuePart = ShadowBlockElement::create(node()); - RefPtr<RenderStyle> styleForValuePart = createStyleForValuePart(style()); - m_valuePart->setRenderer(m_valuePart->createRenderer(renderArena(), styleForValuePart.get())); - m_valuePart->renderer()->setStyle(styleForValuePart.release()); - m_valuePart->setAttached(); - m_valuePart->setInDocument(); - addChild(m_valuePart->renderer()); - } else if (style()->hasAppearance() && m_valuePart) { - m_valuePart->detach(); - m_valuePart = 0; - } - if (needLayout) - setNeedsLayout(true); -} - -PassRefPtr<RenderStyle> RenderProgress::createStyleForValuePart(RenderStyle* parentStyle) -{ - RefPtr<RenderStyle> styleForValuePart; - RenderStyle* pseudoStyle = getCachedPseudoStyle(PROGRESS_BAR_VALUE); - if (pseudoStyle) - styleForValuePart = RenderStyle::clone(pseudoStyle); - else - styleForValuePart = RenderStyle::create(); - - if (parentStyle) - styleForValuePart->inheritFrom(parentStyle); - styleForValuePart->setDisplay(BLOCK); - styleForValuePart->setAppearance(ProgressBarValuePart); - return styleForValuePart.release(); + RenderIndicator::updateFromElement(); } double RenderProgress::animationProgress() const @@ -171,7 +85,31 @@ void RenderProgress::paint(PaintInfo& paintInfo, int tx, int ty) m_animationTimer.startOneShot(m_animationRepeatInterval); } - RenderBlock::paint(paintInfo, tx, ty); + RenderIndicator::paint(paintInfo, tx, ty); +} + +void RenderProgress::layoutParts() +{ + updatePartsState(); + if (m_valuePart) + m_valuePart->layoutAsPart(valuePartRect()); + updateAnimationState(); +} + +bool RenderProgress::shouldHaveParts() const +{ + return !style()->hasAppearance(); +} + +void RenderProgress::updatePartsState() +{ + if (shouldHaveParts() && !m_valuePart) { + m_valuePart = ShadowBlockElement::createForPart(this->node(), PROGRESS_BAR_VALUE); + addChild(m_valuePart->renderer()); + } else if (!shouldHaveParts() && m_valuePart) { + m_valuePart->detach(); + m_valuePart = 0; + } } void RenderProgress::updateAnimationState() @@ -191,6 +129,14 @@ void RenderProgress::updateAnimationState() m_animationTimer.stop(); } +IntRect RenderProgress::valuePartRect() const +{ + IntRect rect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround((width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()) * position()), height() - borderTop() - paddingTop() - borderBottom() - paddingBottom()); + if (style()->direction() == RTL) + rect.setX(width() - borderRight() - paddingRight() - rect.width()); + return rect; +} + HTMLProgressElement* RenderProgress::progressElement() const { return static_cast<HTMLProgressElement*>(node()); diff --git a/WebCore/rendering/RenderProgress.h b/WebCore/rendering/RenderProgress.h index 4d1a88f..bd979e8 100644 --- a/WebCore/rendering/RenderProgress.h +++ b/WebCore/rendering/RenderProgress.h @@ -23,13 +23,14 @@ #if ENABLE(PROGRESS_TAG) #include "RenderBlock.h" +#include "RenderIndicator.h" namespace WebCore { class HTMLProgressElement; class ShadowBlockElement; -class RenderProgress : public RenderBlock { +class RenderProgress : public RenderIndicator { public: RenderProgress(HTMLProgressElement*); virtual ~RenderProgress(); @@ -45,17 +46,17 @@ public: private: virtual const char* renderName() const { return "RenderProgress"; } virtual bool isProgress() const { return true; } - virtual void layout(); virtual void updateFromElement(); virtual void paint(PaintInfo&, int tx, int ty); - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); - virtual bool requiresForcedStyleRecalcPropagation() const { return true; } + virtual void layoutParts(); + virtual bool shouldHaveParts() const; + + IntRect valuePartRect() const; void animationTimerFired(Timer<RenderProgress>*); void updateAnimationState(); - void updateValuePartState(); - PassRefPtr<RenderStyle> createStyleForValuePart(RenderStyle*); + void updatePartsState(); double m_position; double m_animationStartTime; diff --git a/WebCore/rendering/RenderSVGBlock.cpp b/WebCore/rendering/RenderSVGBlock.cpp index 99725d6..2bae158 100644 --- a/WebCore/rendering/RenderSVGBlock.cpp +++ b/WebCore/rendering/RenderSVGBlock.cpp @@ -68,6 +68,11 @@ void RenderSVGBlock::updateBoxModelInfoFromStyle() setHasOverflowClip(false); } +void RenderSVGBlock::absoluteRects(Vector<IntRect>&, int, int) +{ + // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used. + ASSERT_NOT_REACHED(); +} } #endif diff --git a/WebCore/rendering/RenderSVGBlock.h b/WebCore/rendering/RenderSVGBlock.h index a250c00..af819fd 100644 --- a/WebCore/rendering/RenderSVGBlock.h +++ b/WebCore/rendering/RenderSVGBlock.h @@ -29,13 +29,16 @@ namespace WebCore { class SVGElement; -class RenderSVGBlock : public RenderBlock, protected SVGRenderBase { +class RenderSVGBlock : public RenderBlock + , protected SVGRenderBase { public: RenderSVGBlock(SVGElement*); private: virtual void setStyle(PassRefPtr<RenderStyle>); virtual void updateBoxModelInfoFromStyle(); + + virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); }; } diff --git a/WebCore/rendering/RenderSVGHiddenContainer.cpp b/WebCore/rendering/RenderSVGHiddenContainer.cpp index bb0a15d..5d6bd25 100644 --- a/WebCore/rendering/RenderSVGHiddenContainer.cpp +++ b/WebCore/rendering/RenderSVGHiddenContainer.cpp @@ -52,11 +52,6 @@ IntRect RenderSVGHiddenContainer::clippedOverflowRectForRepaint(RenderBoxModelOb return IntRect(); } -void RenderSVGHiddenContainer::absoluteRects(Vector<IntRect>&, int, int) -{ - // This subtree does not take up space or paint -} - void RenderSVGHiddenContainer::absoluteQuads(Vector<FloatQuad>&) { // This subtree does not take up space or paint diff --git a/WebCore/rendering/RenderSVGHiddenContainer.h b/WebCore/rendering/RenderSVGHiddenContainer.h index fdbd2bc..c446f11 100644 --- a/WebCore/rendering/RenderSVGHiddenContainer.h +++ b/WebCore/rendering/RenderSVGHiddenContainer.h @@ -48,7 +48,6 @@ namespace WebCore { virtual void paint(PaintInfo&, int parentX, int parentY); virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); - virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); virtual FloatRect objectBoundingBox() const; diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index d1a3037..45898c7 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -143,11 +143,6 @@ bool RenderSVGImage::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int return false; } -FloatRect RenderSVGImage::objectBoundingBox() const -{ - return m_localBounds; -} - FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const { // If we already have a cached repaint rect, return that @@ -195,14 +190,15 @@ void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, int, int) rects.append(contentRect); } -void RenderSVGImage::absoluteRects(Vector<IntRect>& rects, int, int) +void RenderSVGImage::absoluteRects(Vector<IntRect>&, int, int) { - rects.append(absoluteClippedOverflowRect()); + // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used. + ASSERT_NOT_REACHED(); } void RenderSVGImage::absoluteQuads(Vector<FloatQuad>& quads) { - quads.append(FloatRect(absoluteClippedOverflowRect())); + quads.append(localToAbsoluteQuad(strokeBoundingBox())); } } diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h index 512892c..37d2aee 100644 --- a/WebCore/rendering/RenderSVGImage.h +++ b/WebCore/rendering/RenderSVGImage.h @@ -34,7 +34,8 @@ namespace WebCore { class SVGImageElement; -class RenderSVGImage : public RenderImage, protected SVGRenderBase { +class RenderSVGImage : public RenderImage + , protected SVGRenderBase { public: RenderSVGImage(SVGImageElement*); @@ -46,7 +47,7 @@ private: virtual const AffineTransform& localToParentTransform() const { return m_localTransform; } - virtual FloatRect objectBoundingBox() const; + virtual FloatRect objectBoundingBox() const { return m_localBounds; } virtual FloatRect strokeBoundingBox() const { return m_localBounds; } virtual FloatRect repaintRectInLocalCoordinates() const; @@ -83,5 +84,3 @@ private: #endif // ENABLE(SVG) #endif // RenderSVGImage_h - -// vim:ts=4:noet diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp index 85d148e..ca0fdb5 100644 --- a/WebCore/rendering/RenderSVGInline.cpp +++ b/WebCore/rendering/RenderSVGInline.cpp @@ -26,11 +26,7 @@ #if ENABLE(SVG) #include "RenderSVGInline.h" -#include "FloatQuad.h" -#include "RenderBlock.h" #include "SVGInlineFlowBox.h" -#include "SVGInlineTextBox.h" -#include "SVGRootInlineBox.h" namespace WebCore { @@ -46,25 +42,6 @@ InlineFlowBox* RenderSVGInline::createInlineFlowBox() return box; } -void RenderSVGInline::absoluteRects(Vector<IntRect>& rects, int, int) -{ - InlineFlowBox* firstBox = firstLineBox(); - - RootInlineBox* rootBox = firstBox ? firstBox->root() : 0; - RenderBox* object = rootBox ? rootBox->block() : 0; - - if (!object) - return; - - int xRef = object->x(); - int yRef = object->y(); - - for (InlineFlowBox* curr = firstBox; curr; curr = curr->nextLineBox()) { - FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height()); - rects.append(enclosingIntRect(localToAbsoluteQuad(rect).boundingBox())); - } -} - FloatRect RenderSVGInline::objectBoundingBox() const { if (const RenderObject* object = findTextRootObject(this)) @@ -89,25 +66,33 @@ FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const return FloatRect(); } -void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads) +IntRect RenderSVGInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { - InlineFlowBox* firstBox = firstLineBox(); + return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer); +} - RootInlineBox* rootBox = firstBox ? firstBox->root() : 0; - RenderBox* object = rootBox ? rootBox->block() : 0; +void RenderSVGInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) +{ + SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); +} + +void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState& transformState) const +{ + SVGRenderBase::mapLocalToContainer(this, repaintContainer, useTransforms, fixed, transformState); +} +void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads) +{ + const RenderObject* object = findTextRootObject(this); if (!object) return; - int xRef = object->x(); - int yRef = object->y(); - - for (InlineFlowBox* curr = firstBox; curr; curr = curr->nextLineBox()) { - FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height()); - quads.append(localToAbsoluteQuad(rect)); - } + FloatRect textBoundingBox = object->strokeBoundingBox(); + for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) + quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->width(), box->height()))); } + } #endif // ENABLE(SVG) diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h index 1afbb97..2efb1aa 100644 --- a/WebCore/rendering/RenderSVGInline.h +++ b/WebCore/rendering/RenderSVGInline.h @@ -31,26 +31,28 @@ namespace WebCore { -class RenderSVGInline : public RenderInline, protected SVGRenderBase { +class RenderSVGInline : public RenderInline + , protected SVGRenderBase { public: RenderSVGInline(Node*); virtual const char* renderName() const { return "RenderSVGInline"; } virtual bool requiresLayer() const { return false; } - // These are shared between RenderSVGTSpan and RenderSVGTextPath - virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty); - virtual void absoluteQuads(Vector<FloatQuad>&); - // Chapter 10.4 of the SVG Specification say that we should use the // object bounding box of the parent text element. - // We search for the root text element and take it's bounding box. + // We search for the root text element and take its bounding box. // It is also necessary to take the stroke and repaint rect of // this element, since we need it for filters. virtual FloatRect objectBoundingBox() const; virtual FloatRect strokeBoundingBox() const; virtual FloatRect repaintRectInLocalCoordinates() const; - + + virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); + virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); + virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; + virtual void absoluteQuads(Vector<FloatQuad>&); + private: virtual InlineFlowBox* createInlineFlowBox(); }; diff --git a/WebCore/rendering/RenderSVGInlineText.cpp b/WebCore/rendering/RenderSVGInlineText.cpp index 48d01ae..ba99243 100644 --- a/WebCore/rendering/RenderSVGInlineText.cpp +++ b/WebCore/rendering/RenderSVGInlineText.cpp @@ -38,99 +38,21 @@ namespace WebCore { -static inline bool isChildOfHiddenContainer(RenderObject* start) -{ - while (start) { - if (start->isSVGHiddenContainer()) - return true; - - start = start->parent(); - } - - return false; -} - RenderSVGInlineText::RenderSVGInlineText(Node* n, PassRefPtr<StringImpl> str) : RenderText(n, str) { } - void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { - // Skip RenderText's possible layout scheduling on style change - RenderObject::styleDidChange(diff, oldStyle); + RenderText::styleDidChange(diff, oldStyle); - // FIXME: SVG text is apparently always transformed? + // FIXME: Should optimize this. + // SVG text is always transformed. if (RefPtr<StringImpl> textToTransform = originalText()) setText(textToTransform.release(), true); } -void RenderSVGInlineText::absoluteRects(Vector<IntRect>& rects, int, int) -{ - rects.append(computeRepaintRectForRange(0, 0, textLength())); -} - -void RenderSVGInlineText::absoluteQuads(Vector<FloatQuad>& quads) -{ - quads.append(computeRepaintQuadForRange(0, 0, textLength())); -} - -IntRect RenderSVGInlineText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool /*clipToVisibleContent*/) -{ - ASSERT(!needsLayout()); - - if (selectionState() == SelectionNone) - return IntRect(); - - // Early exit if we're ie. a <text> within a <defs> section. - if (isChildOfHiddenContainer(this)) - return IntRect(); - - // Now calculate startPos and endPos for painting selection. - // We include a selection while endPos > 0 - int startPos, endPos; - if (selectionState() == SelectionInside) { - // We are fully selected. - startPos = 0; - endPos = textLength(); - } else { - selectionStartEnd(startPos, endPos); - if (selectionState() == SelectionStart) - endPos = textLength(); - else if (selectionState() == SelectionEnd) - startPos = 0; - } - - if (startPos == endPos) - return IntRect(); - - return computeRepaintRectForRange(repaintContainer, startPos, endPos); -} - -IntRect RenderSVGInlineText::computeRepaintRectForRange(RenderBoxModelObject* repaintContainer, int startPos, int endPos) -{ - FloatQuad repaintQuad = computeRepaintQuadForRange(repaintContainer, startPos, endPos); - return enclosingIntRect(repaintQuad.boundingBox()); -} - -FloatQuad RenderSVGInlineText::computeRepaintQuadForRange(RenderBoxModelObject* repaintContainer, int startPos, int endPos) -{ - RenderBlock* cb = containingBlock(); - if (!cb || !cb->container()) - return FloatQuad(); - - RenderSVGRoot* root = findSVGRootObject(parent()); - if (!root) - return FloatQuad(); - - IntRect rect; - for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) - rect.unite(box->selectionRect(0, 0, startPos, endPos)); - - return localToContainerQuad(FloatQuad(rect), repaintContainer); -} - InlineTextBox* RenderSVGInlineText::createTextBox() { InlineTextBox* box = new (renderArena()) SVGInlineTextBox(this); @@ -140,57 +62,9 @@ InlineTextBox* RenderSVGInlineText::createTextBox() IntRect RenderSVGInlineText::localCaretRect(InlineBox*, int, int*) { - // SVG doesn't have any editable content where a caret rect would be needed. - // FIXME: That's not sufficient. The localCaretRect function is also used for selection. return IntRect(); } -VisiblePosition RenderSVGInlineText::positionForPoint(const IntPoint& point) -{ - SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(firstTextBox()); - - if (!textBox || textLength() == 0) - return createVisiblePosition(0, DOWNSTREAM); - - SVGRootInlineBox* rootBox = textBox->svgRootInlineBox(); - RenderBlock* object = rootBox ? rootBox->block() : 0; - - if (!object) - return createVisiblePosition(0, DOWNSTREAM); - - int closestOffsetInBox = 0; - - // FIXME: This approach is wrong. The correct code would first find the - // closest SVGInlineTextBox to the point, and *then* ask only that inline box - // what the closest text offset to that point is. This code instead walks - // through all boxes in order, so when you click "near" a box, you'll actually - // end up returning the nearest offset in the last box, even if the - // nearest offset to your click is contained in another box. - for (SVGInlineTextBox* box = textBox; box; box = static_cast<SVGInlineTextBox*>(box->nextTextBox())) { - if (box->svgCharacterHitsPosition(point.x() + object->x(), point.y() + object->y(), closestOffsetInBox)) { - // If we're not at the end/start of the box, stop looking for other selected boxes. - if (box->direction() == LTR) { - if (closestOffsetInBox <= (int) box->end() + 1) - break; - } else { - if (closestOffsetInBox > (int) box->start()) - break; - } - } - } - - return createVisiblePosition(closestOffsetInBox, DOWNSTREAM); -} - -void RenderSVGInlineText::destroy() -{ - if (!documentBeingDestroyed()) { - setNeedsLayoutAndPrefWidthsRecalc(); - repaint(); - } - RenderText::destroy(); -} - } #endif // ENABLE(SVG) diff --git a/WebCore/rendering/RenderSVGInlineText.h b/WebCore/rendering/RenderSVGInlineText.h index b475067..08b4a47 100644 --- a/WebCore/rendering/RenderSVGInlineText.h +++ b/WebCore/rendering/RenderSVGInlineText.h @@ -36,28 +36,19 @@ public: private: virtual const char* renderName() const { return "RenderSVGInlineText"; } - + virtual void styleDidChange(StyleDifference, const RenderStyle*); // FIXME: We need objectBoundingBox for DRT results and filters at the moment. // This should be fixed to give back the objectBoundingBox of the text root. virtual FloatRect objectBoundingBox() const { return FloatRect(); } - virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty); - virtual void absoluteQuads(Vector<FloatQuad>&); - virtual bool requiresLayer() const { return false; } - virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); - virtual bool isSVGText() const { return true; } + virtual bool isSVGInlineText() const { return true; } virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); - virtual VisiblePosition positionForPoint(const IntPoint&); - - virtual void destroy(); virtual InlineTextBox* createTextBox(); - IntRect computeRepaintRectForRange(RenderBoxModelObject* repaintContainer, int startPos, int endPos); - FloatQuad computeRepaintQuadForRange(RenderBoxModelObject* repaintContainer, int startPos, int endPos); }; } diff --git a/WebCore/rendering/RenderSVGModelObject.cpp b/WebCore/rendering/RenderSVGModelObject.cpp index 837b36a..a80a963 100644 --- a/WebCore/rendering/RenderSVGModelObject.cpp +++ b/WebCore/rendering/RenderSVGModelObject.cpp @@ -72,14 +72,15 @@ IntRect RenderSVGModelObject::outlineBoundsForRepaint(RenderBoxModelObject* repa return containerRelativeQuad.enclosingBoundingBox(); } -void RenderSVGModelObject::absoluteRects(Vector<IntRect>& rects, int, int) +void RenderSVGModelObject::absoluteRects(Vector<IntRect>&, int, int) { - rects.append(absoluteClippedOverflowRect()); + // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used. + ASSERT_NOT_REACHED(); } void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads) { - quads.append(absoluteClippedOverflowRect()); + quads.append(localToAbsoluteQuad(strokeBoundingBox())); } void RenderSVGModelObject::destroy() diff --git a/WebCore/rendering/RenderSVGModelObject.h b/WebCore/rendering/RenderSVGModelObject.h index affa18d..42ca27f 100644 --- a/WebCore/rendering/RenderSVGModelObject.h +++ b/WebCore/rendering/RenderSVGModelObject.h @@ -55,7 +55,7 @@ public: virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint*) const; - virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty); + virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); virtual void destroy(); diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index b0220a9..0062015 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -91,13 +91,13 @@ void RenderSVGResourceFilter::invalidateClient(RenderObject* object) markForLayoutAndResourceInvalidation(object); } -PassOwnPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() +PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() { SVGFilterElement* filterElement = static_cast<SVGFilterElement*>(node()); bool primitiveBoundingBoxMode = filterElement->primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; // Add effects to the builder - OwnPtr<SVGFilterBuilder> builder(new SVGFilterBuilder); + RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(); builder->clearEffects(); for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) { if (!node->isSVGElement()) diff --git a/WebCore/rendering/RenderSVGResourceFilter.h b/WebCore/rendering/RenderSVGResourceFilter.h index 105b256..7b5ab09 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.h +++ b/WebCore/rendering/RenderSVGResourceFilter.h @@ -47,7 +47,7 @@ struct FilterData { } RefPtr<SVGFilter> filter; - OwnPtr<SVGFilterBuilder> builder; + RefPtr<SVGFilterBuilder> builder; OwnPtr<ImageBuffer> sourceGraphicBuffer; GraphicsContext* savedContext; FloatRect boundaries; @@ -72,7 +72,7 @@ public: virtual FloatRect resourceBoundingBox(RenderObject*); - PassOwnPtr<SVGFilterBuilder> buildPrimitives(); + PassRefPtr<SVGFilterBuilder> buildPrimitives(); SVGUnitTypes::SVGUnitType filterUnits() const { return toUnitType(static_cast<SVGFilterElement*>(node())->filterUnits()); } SVGUnitTypes::SVGUnitType primitiveUnits() const { return toUnitType(static_cast<SVGFilterElement*>(node())->primitiveUnits()); } diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 6017513..70ff938 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -144,12 +144,16 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) if (paintInfo.context->paintingDisabled()) return; + bool isVisible = style()->visibility() == VISIBLE; IntPoint parentOriginInContainer(parentX, parentY); IntPoint borderBoxOriginInContainer = parentOriginInContainer + parentOriginToBorderBox(); - if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection)) + if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground) && isVisible) paintBoxDecorations(paintInfo, borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y()); + if (paintInfo.phase == PaintPhaseBlockBackground) + return; + // An empty viewport disables rendering. FIXME: Should we still render filters? if (m_viewportSize.isEmpty()) return; @@ -184,7 +188,7 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) childPaintInfo.context->restore(); - if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE) + if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && isVisible) paintOutline(paintInfo.context, borderBoxOriginInContainer.x(), borderBoxOriginInContainer.y(), width(), height()); } diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index 072b6d1..84f5329 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -44,6 +44,7 @@ #include "SVGTransformList.h" #include "SVGURIReference.h" #include "SimpleFontData.h" +#include "TransformState.h" namespace WebCore { @@ -63,7 +64,7 @@ void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); } -void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) const +void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const { SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); } @@ -73,18 +74,28 @@ void RenderSVGText::layout() ASSERT(needsLayout()); LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); - // Best guess for a relative starting point - SVGTextElement* text = static_cast<SVGTextElement*>(node()); - int xOffset = (int)(text->x()->getFirst().value(text)); - int yOffset = (int)(text->y()->getFirst().value(text)); - setLocation(xOffset, yOffset); - if (m_needsTransformUpdate) { + SVGTextElement* text = static_cast<SVGTextElement*>(node()); m_localTransform = text->animatedLocalTransform(); m_needsTransformUpdate = false; } - RenderBlock::layout(); + // Reduced version of RenderBlock::layoutBlock(), which only takes care of SVG text. + // All if branches that could cause early exit in RenderBlocks layoutBlock() method are turned into assertions. + ASSERT(!isInline()); + ASSERT(!layoutOnlyPositionedObjects()); + ASSERT(!scrollsOverflow()); + ASSERT(!hasControlClip()); + ASSERT(!hasColumns()); + ASSERT(!positionedObjects()); + ASSERT(!m_overflow); + ASSERT(!isAnonymousBlock()); + + if (!firstChild()) + setChildrenInline(true); + + ASSERT(childrenInline()); + forceLayoutInlineChildren(); repainter.repaintAfterLayout(); setNeedsLayout(false); @@ -128,40 +139,9 @@ bool RenderSVGText::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, return false; } -void RenderSVGText::absoluteRects(Vector<IntRect>& rects, int, int) -{ - RenderSVGRoot* root = findSVGRootObject(parent()); - if (!root) - return; - - // Don't use objectBoundingBox here, as it's unites the selection rects. Makes it hard - // to spot errors, if there are any using WebInspector. Individually feed them into 'rects'. - for (InlineFlowBox* flow = firstLineBox(); flow; flow = flow->nextLineBox()) { - for (InlineBox* box = flow->firstChild(); box; box = box->nextOnLine()) { - FloatRect boxRect(box->x(), box->y(), box->width(), box->height()); - // FIXME: crawling up the parent chain to map each rect is very inefficient - // we should compute the absoluteTransform outside this loop first. - rects.append(enclosingIntRect(localToAbsoluteQuad(boxRect).boundingBox())); - } - } -} - void RenderSVGText::absoluteQuads(Vector<FloatQuad>& quads) { - RenderSVGRoot* root = findSVGRootObject(parent()); - if (!root) - return; - - // Don't use objectBoundingBox here, as it's unites the selection rects. Makes it hard - // to spot errors, if there are any using WebInspector. Individually feed them into 'rects'. - for (InlineFlowBox* flow = firstLineBox(); flow; flow = flow->nextLineBox()) { - for (InlineBox* box = flow->firstChild(); box; box = box->nextOnLine()) { - FloatRect boxRect(box->x(), box->y(), box->width(), box->height()); - // FIXME: crawling up the parent chain to map each quad is very inefficient - // we should compute the absoluteTransform outside this loop first. - quads.append(localToAbsoluteQuad(boxRect)); - } - } + quads.append(localToAbsoluteQuad(strokeBoundingBox())); } void RenderSVGText::paint(PaintInfo& paintInfo, int, int) @@ -169,48 +149,26 @@ void RenderSVGText::paint(PaintInfo& paintInfo, int, int) if (paintInfo.context->paintingDisabled()) return; - PaintInfo pi(paintInfo); - pi.context->save(); - applyTransformToPaintInfo(pi, localToParentTransform()); - RenderBlock::paint(pi, 0, 0); - pi.context->restore(); -} - -FloatRect RenderSVGText::objectBoundingBox() const -{ - FloatRect boundingBox; + if (paintInfo.phase != PaintPhaseForeground + && paintInfo.phase != PaintPhaseSelfOutline + && paintInfo.phase != PaintPhaseSelection) + return; - for (InlineFlowBox* flow = firstLineBox(); flow; flow = flow->nextLineBox()) { - for (InlineBox* box = flow->firstChild(); box; box = box->nextOnLine()) - boundingBox.unite(FloatRect(box->x(), box->y(), box->width(), box->height())); - } - - boundingBox.move(x(), y()); - return boundingBox; + PaintInfo blockInfo(paintInfo); + blockInfo.context->save(); + applyTransformToPaintInfo(blockInfo, localToParentTransform()); + RenderBlock::paint(blockInfo, 0, 0); + blockInfo.context->restore(); } FloatRect RenderSVGText::strokeBoundingBox() const { - FloatRect strokeRect = objectBoundingBox(); - - // SVG needs to include the strokeWidth(), not the textStrokeWidth(). - if (style()->svgStyle()->hasStroke()) { - float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 1.0f); + FloatRect strokeBoundaries = objectBoundingBox(); + if (!style()->svgStyle()->hasStroke()) + return strokeBoundaries; -#if ENABLE(SVG_FONTS) - const Font& font = style()->font(); - if (font.primaryFont()->isSVGFont()) { - float scale = font.unitsPerEm() > 0 ? font.size() / font.unitsPerEm() : 0.0f; - - if (scale != 0.0f) - strokeWidth /= scale; - } -#endif - - strokeRect.inflate(strokeWidth); - } - - return strokeRect; + strokeBoundaries.inflate(SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 1.0f)); + return strokeBoundaries; } FloatRect RenderSVGText::repaintRectInLocalCoordinates() const @@ -237,5 +195,3 @@ void RenderSVGText::updateFirstLetter() } #endif // ENABLE(SVG) - -// vim:ts=4:noet diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h index 162c958..6e7d03a 100644 --- a/WebCore/rendering/RenderSVGText.h +++ b/WebCore/rendering/RenderSVGText.h @@ -38,14 +38,12 @@ public: RenderSVGText(SVGTextElement* node); virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } + virtual FloatRect repaintRectInLocalCoordinates() const; private: virtual const char* renderName() const { return "RenderSVGText"; } - virtual bool isSVGText() const { return true; } - virtual const AffineTransform& localToParentTransform() const { return m_localTransform; } - virtual void paint(PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); @@ -55,7 +53,6 @@ private: virtual void destroy(); - virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); @@ -63,12 +60,11 @@ private: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; - virtual FloatRect objectBoundingBox() const; + virtual FloatRect objectBoundingBox() const { return frameRect(); } virtual FloatRect strokeBoundingBox() const; - virtual FloatRect repaintRectInLocalCoordinates() const; + virtual const AffineTransform& localToParentTransform() const { return m_localTransform; } virtual AffineTransform localTransform() const { return m_localTransform; } - virtual RootInlineBox* createRootInlineBox(); virtual RenderBlock* firstLineBlock() const; @@ -82,5 +78,3 @@ private: #endif // ENABLE(SVG) #endif - -// vim:ts=4:noet diff --git a/WebCore/rendering/RenderSelectionInfo.h b/WebCore/rendering/RenderSelectionInfo.h index c06a9ae..a09fc1a 100644 --- a/WebCore/rendering/RenderSelectionInfo.h +++ b/WebCore/rendering/RenderSelectionInfo.h @@ -22,8 +22,8 @@ * */ -#ifndef SelectionInfo_h -#define SelectionInfo_h +#ifndef RenderSelectionInfo_h +#define RenderSelectionInfo_h #include "IntRect.h" #include "RenderBox.h" @@ -101,4 +101,4 @@ private: } // namespace WebCore -#endif // SelectionInfo_h +#endif // RenderSelectionInfo_h diff --git a/WebCore/rendering/RenderSlider.cpp b/WebCore/rendering/RenderSlider.cpp index 60b2369..591b1ac 100644 --- a/WebCore/rendering/RenderSlider.cpp +++ b/WebCore/rendering/RenderSlider.cpp @@ -29,7 +29,7 @@ #include "Frame.h" #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "LegacyHTMLTreeConstructor.h" +#include "LegacyHTMLTreeBuilder.h" #include "MediaControlElements.h" #include "MouseEvent.h" #include "RenderLayer.h" @@ -56,7 +56,6 @@ static double sliderPosition(HTMLInputElement* element) return range.proportionFromValue(range.valueFromElement(element)); } -// FIXME: Could share code with the SliderDivElement class in RenderProgress. class SliderThumbElement : public ShadowBlockElement { public: static PassRefPtr<SliderThumbElement> create(Node* shadowParent); @@ -68,7 +67,7 @@ public: private: SliderThumbElement(Node* shadowParent); - + FloatPoint m_offsetToThumb; bool m_inDragMode; }; @@ -81,7 +80,7 @@ inline SliderThumbElement::SliderThumbElement(Node* shadowParent) inline PassRefPtr<SliderThumbElement> SliderThumbElement::create(Node* shadowParent) { - return new SliderThumbElement(shadowParent); + return adoptRef(new SliderThumbElement(shadowParent)); } void SliderThumbElement::defaultEventHandler(Event* event) @@ -111,7 +110,7 @@ void SliderThumbElement::defaultEventHandler(Event* event) } m_inDragMode = true; - document()->frame()->eventHandler()->setCapturingMouseEventsNode(shadowParentNode()); + document()->frame()->eventHandler()->setCapturingMouseEventsNode(shadowParent()); event->setDefaultHandled(); return; } diff --git a/WebCore/rendering/RenderTable.h b/WebCore/rendering/RenderTable.h index 3d0714f..dace8ba 100644 --- a/WebCore/rendering/RenderTable.h +++ b/WebCore/rendering/RenderTable.h @@ -75,7 +75,7 @@ public: { } - unsigned short span; + unsigned span; unsigned width; // the calculated position of the column }; diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index 5f6c1eb..fcb6c59 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -238,7 +238,7 @@ void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row) table()->appendColumn(cSpan); currentSpan = cSpan; } else { - if (cSpan < columns[m_cCol].span) + if (cSpan < static_cast<int>(columns[m_cCol].span)) table()->splitColumn(m_cCol, cSpan); currentSpan = columns[m_cCol].span; } diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index cfd6026..c70ac58 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -314,7 +314,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u void RenderText::absoluteQuads(Vector<FloatQuad>& quads) { for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) - quads.append(localToAbsoluteQuad(FloatRect(box->x(), box->y(), box->width(), box->height()))); + quads.append(localToAbsoluteQuad(FloatRect(box->calculateBoundaries()))); } void RenderText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool useSelectionHeight) @@ -332,7 +332,7 @@ void RenderText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { // Note: box->end() returns the index of the last character, not the index past it if (start <= box->start() && box->end() < end) { - IntRect r = IntRect(box->x(), box->y(), box->width(), box->height()); + IntRect r(box->calculateBoundaries()); if (useSelectionHeight) { IntRect selectionRect = box->selectionRect(0, 0, start, end); r.setHeight(selectionRect.height()); @@ -1051,7 +1051,7 @@ void RenderText::setTextInternal(PassRefPtr<StringImpl> text) ASSERT(m_text); #if ENABLE(SVG) - if (isSVGText()) { + if (isSVGInlineText()) { if (style() && style()->whiteSpace() == PRE) { // Spec: When xml:space="preserve", the SVG user agent will do the following using a // copy of the original character data content. It will convert all newline and tab diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index d3892e9..ab56036 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -1,6 +1,7 @@ /** * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2010 Google 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 @@ -299,9 +300,13 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit // If we found a spin button, we're done. if (m_outerSpinButton && result.innerNode() == m_outerSpinButton) return true; - // If we're not a search field, or we already found the results or cancel buttons, we're done. + // If we're not a search field, or we already found the speech, results or cancel buttons, we're done. if (!m_innerBlock || result.innerNode() == m_resultsButton || result.innerNode() == m_cancelButton) return true; +#if ENABLE(INPUT_SPEECH) + if (m_innerBlock && m_speechButton && result.innerNode() == m_speechButton) + return true; +#endif Node* innerNode = 0; RenderBox* innerBlockRenderer = m_innerBlock->renderBox(); @@ -314,6 +319,19 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit if (m_resultsButton && m_resultsButton->renderer() && xPos < textLeft) innerNode = m_resultsButton.get(); +#if ENABLE(INPUT_SPEECH) + if (!innerNode && m_speechButton && m_speechButton->renderer()) { + int buttonLeft = textLeft + innerTextRenderer->width(); + if (m_cancelButton) { + RenderBox* cancelRenderer = m_cancelButton->renderBox(); + cancelRenderer->calcWidth(); + buttonLeft += cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight(); + } + if (xPos > buttonLeft) + innerNode = m_speechButton.get(); + } +#endif + if (!innerNode) { int textRight = textLeft + innerTextRenderer->width(); if (m_cancelButton && m_cancelButton->renderer() && xPos > textRight) @@ -350,8 +368,20 @@ void RenderTextControlSingleLine::forwardEvent(Event* event) FloatPoint localPoint = innerTextRenderer->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true); int textRight = innerTextRenderer->borderBoxRect().right(); +#if ENABLE(INPUT_SPEECH) + int cancelRight = textRight; + if (m_cancelButton && m_cancelButton->renderBox()) { + RenderBox* cancelRenderer = m_cancelButton->renderBox(); + cancelRight += cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight(); + } +#endif + if (m_resultsButton && localPoint.x() < innerTextRenderer->borderBoxRect().x()) m_resultsButton->defaultEventHandler(event); +#if ENABLE(INPUT_SPEECH) + else if (m_speechButton && localPoint.x() > cancelRight) + m_speechButton->defaultEventHandler(event); +#endif else if (m_cancelButton && localPoint.x() > textRight) m_cancelButton->defaultEventHandler(event); else if (m_outerSpinButton && localPoint.x() > textRight) @@ -381,6 +411,11 @@ void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren if (RenderObject* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderer() : 0) spinRenderer->setStyle(createOuterSpinButtonStyle()); +#if ENABLE(INPUT_SPEECH) + if (RenderObject* speechRenderer = m_speechButton ? m_speechButton->renderer() : 0) + speechRenderer->setStyle(createSpeechButtonStyle(style())); +#endif + setHasOverflowClip(false); } @@ -408,9 +443,19 @@ void RenderTextControlSingleLine::capsLockStateMayHaveChanged() } } +bool RenderTextControlSingleLine::hasControlClip() const +{ + bool clip = m_cancelButton; +#if ENABLE(INPUT_SPEECH) + if (m_speechButton) + clip = true; +#endif + return clip; +} + IntRect RenderTextControlSingleLine::controlClipRect(int tx, int ty) const { - // This should only get called for search inputs. + // This should only get called for search & speech inputs. ASSERT(hasControlClip()); IntRect clipRect = IntRect(m_innerBlock->renderBox()->frameRect()); @@ -432,6 +477,13 @@ int RenderTextControlSingleLine::textBlockWidth() const width -= cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight(); } +#if ENABLE(INPUT_SPEECH) + if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) { + speechRenderer->calcWidth(); + width -= speechRenderer->width() + speechRenderer->marginLeft() + speechRenderer->marginRight(); + } +#endif + return width - decorationWidthRight(); } @@ -490,6 +542,12 @@ int RenderTextControlSingleLine::preferredContentWidth(float charWidth) const result += cancelRenderer->borderLeft() + cancelRenderer->borderRight() + cancelRenderer->paddingLeft() + cancelRenderer->paddingRight(); +#if ENABLE(INPUT_SPEECH) + if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) { + result += speechRenderer->borderLeft() + speechRenderer->borderRight() + + speechRenderer->paddingLeft() + speechRenderer->paddingRight(); + } +#endif return result; } @@ -525,12 +583,28 @@ void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineH lineHeight = max(lineHeight, cancelRenderer->height()); } +#if ENABLE(INPUT_SPEECH) + if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) { + toRenderBlock(speechRenderer)->calcHeight(); + setHeight(max(height(), + speechRenderer->borderTop() + speechRenderer->borderBottom() + + speechRenderer->paddingTop() + speechRenderer->paddingBottom() + + speechRenderer->marginTop() + speechRenderer->marginBottom())); + lineHeight = max(lineHeight, speechRenderer->height()); + } +#endif + setHeight(height() + lineHeight); } void RenderTextControlSingleLine::createSubtreeIfNeeded() { - if (!inputElement()->isSearchField()) { + bool createSubtree = inputElement()->isSearchField(); +#if ENABLE(INPUT_SPEECH) + if (inputElement()->isSpeechEnabled()) + createSubtree = true; +#endif + if (!createSubtree) { RenderTextControl::createSubtreeIfNeeded(m_innerBlock.get()); if (inputElement()->hasSpinButton() && !m_outerSpinButton) { m_outerSpinButton = SpinButtonElement::create(node()); @@ -545,20 +619,31 @@ void RenderTextControlSingleLine::createSubtreeIfNeeded() m_innerBlock->attachInnerElement(node(), createInnerBlockStyle(style()), renderArena()); } - if (!m_resultsButton) { - // Create the search results button element - m_resultsButton = SearchFieldResultsButtonElement::create(document()); - m_resultsButton->attachInnerElement(m_innerBlock.get(), createResultsButtonStyle(m_innerBlock->renderer()->style()), renderArena()); + if (inputElement()->isSearchField()) { + if (!m_resultsButton) { + // Create the search results button element. + m_resultsButton = SearchFieldResultsButtonElement::create(document()); + m_resultsButton->attachInnerElement(m_innerBlock.get(), createResultsButtonStyle(m_innerBlock->renderer()->style()), renderArena()); + } } - // Create innerText element before adding the cancel button + // Create innerText element before adding the other buttons. RenderTextControl::createSubtreeIfNeeded(m_innerBlock.get()); - if (!m_cancelButton) { - // Create the cancel button element - m_cancelButton = SearchFieldCancelButtonElement::create(document()); - m_cancelButton->attachInnerElement(m_innerBlock.get(), createCancelButtonStyle(m_innerBlock->renderer()->style()), renderArena()); + if (inputElement()->isSearchField()) { + if (!m_cancelButton) { + // Create the cancel button element. + m_cancelButton = SearchFieldCancelButtonElement::create(document()); + m_cancelButton->attachInnerElement(m_innerBlock.get(), createCancelButtonStyle(m_innerBlock->renderer()->style()), renderArena()); + } } +#if ENABLE(INPUT_SPEECH) + if (inputElement()->isSpeechEnabled() && !m_speechButton) { + // Create the speech button element. + m_speechButton = InputFieldSpeechButtonElement::create(document()); + m_speechButton->attachInnerElement(m_innerBlock.get(), createSpeechButtonStyle(m_innerBlock->renderer()->style()), renderArena()); + } +#endif } void RenderTextControlSingleLine::updateFromElement() @@ -696,6 +781,19 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createOuterSpinButtonStyle( return buttonStyle.release(); } +#if ENABLE(INPUT_SPEECH) +PassRefPtr<RenderStyle> RenderTextControlSingleLine::createSpeechButtonStyle(const RenderStyle* startStyle) const +{ + ASSERT(node()->isHTMLElement()); + RefPtr<RenderStyle> buttonStyle = getCachedPseudoStyle(INPUT_SPEECH_BUTTON); + if (!buttonStyle) + buttonStyle = RenderStyle::create(); + if (startStyle) + buttonStyle->inheritFrom(startStyle); + return buttonStyle.release(); +} +#endif + void RenderTextControlSingleLine::updateCancelButtonVisibility() const { if (!m_cancelButton->renderer()) @@ -834,6 +932,10 @@ int RenderTextControlSingleLine::clientPaddingRight() const if (RenderBox* cancelRenderer = m_cancelButton ? m_cancelButton->renderBox() : 0) padding += cancelRenderer->width(); +#if ENABLE(INPUT_SPEECH) + if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) + padding += speechRenderer->width(); +#endif return padding; } diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h index dff9e5f..ab9f711 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.h +++ b/WebCore/rendering/RenderTextControlSingleLine.h @@ -29,6 +29,7 @@ namespace WebCore { class InputElement; +class InputFieldSpeechButtonElement; class SearchFieldCancelButtonElement; class SearchFieldResultsButtonElement; class SearchPopupMenu; @@ -59,7 +60,7 @@ public: private: int preferredDecorationWidthRight() const; - virtual bool hasControlClip() const { return m_cancelButton; } + virtual bool hasControlClip() const; virtual IntRect controlClipRect(int tx, int ty) const; virtual bool isTextField() const { return true; } @@ -98,6 +99,9 @@ private: PassRefPtr<RenderStyle> createResultsButtonStyle(const RenderStyle* startStyle) const; PassRefPtr<RenderStyle> createCancelButtonStyle(const RenderStyle* startStyle) const; PassRefPtr<RenderStyle> createOuterSpinButtonStyle() const; +#if ENABLE(INPUT_SPEECH) + PassRefPtr<RenderStyle> createSpeechButtonStyle(const RenderStyle* startStyle) const; +#endif void updateCancelButtonVisibility() const; EVisibility visibilityForCancelButton() const; @@ -142,6 +146,9 @@ private: RefPtr<SearchFieldResultsButtonElement> m_resultsButton; RefPtr<SearchFieldCancelButtonElement> m_cancelButton; RefPtr<TextControlInnerElement> m_outerSpinButton; +#if ENABLE(INPUT_SPEECH) + RefPtr<InputFieldSpeechButtonElement> m_speechButton; +#endif Timer<RenderTextControlSingleLine> m_searchEventTimer; RefPtr<SearchPopupMenu> m_searchPopup; diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp index 2b5efc9..407f273 100644 --- a/WebCore/rendering/RenderTheme.cpp +++ b/WebCore/rendering/RenderTheme.cpp @@ -232,6 +232,10 @@ void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, El case RatingLevelIndicatorPart: return adjustMeterStyle(selector, style, e); #endif +#if ENABLE(INPUT_SPEECH) + case InputSpeechButtonPart: + // FIXME: Adjust the speech button's style and sizes. +#endif default: break; } @@ -362,6 +366,10 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf return paintSearchFieldResultsDecoration(o, paintInfo, r); case SearchFieldResultsButtonPart: return paintSearchFieldResultsButton(o, paintInfo, r); +#if ENABLE(INPUT_SPEECH) + case InputSpeechButtonPart: + // FIXME: Add painting code to draw the speech button. +#endif default: break; } @@ -410,6 +418,9 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const RenderObject::PaintInfo case SearchFieldDecorationPart: case SearchFieldResultsDecorationPart: case SearchFieldResultsButtonPart: +#if ENABLE(INPUT_SPEECH) + case InputSpeechButtonPart: +#endif default: break; } @@ -456,6 +467,9 @@ bool RenderTheme::paintDecorations(RenderObject* o, const RenderObject::PaintInf case SearchFieldDecorationPart: case SearchFieldResultsDecorationPart: case SearchFieldResultsButtonPart: +#if ENABLE(INPUT_SPEECH) + case InputSpeechButtonPart: +#endif default: break; } @@ -655,6 +669,11 @@ bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& bo case ListboxPart: case MenulistPart: case ProgressBarPart: + case MeterPart: + case RelevancyLevelIndicatorPart: + case ContinuousCapacityLevelIndicatorPart: + case DiscreteCapacityLevelIndicatorPart: + case RatingLevelIndicatorPart: // FIXME: Uncomment this when making search fields style-able. // case SearchFieldPart: case TextFieldPart: @@ -918,56 +937,16 @@ IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bound return bounds.size(); } -bool RenderTheme::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderTheme::supportsMeter(ControlPart, bool) const { - if (!renderObject->isMeter()) - return true; - - // Some platforms do not have a native gauge widget, so we draw here a default implementation. - RenderMeter* renderMeter = toRenderMeter(renderObject); - RenderStyle* style = renderObject->style(); - int left = style->borderLeft().width() + style->paddingLeft().value(); - int top = style->borderTop().width() + style->paddingTop().value(); - int right = style->borderRight().width() + style->paddingRight().value(); - int bottom = style->borderBottom().width() + style->paddingBottom().value(); - FloatRect innerRect(rect.x() + left, rect.y() + top, rect.width() - left - right, rect.height() - top - bottom); - - HTMLMeterElement* element = static_cast<HTMLMeterElement*>(renderMeter->node()); - double min = element->min(); - double max = element->max(); - double value = element->value(); - - if (min >= max) { - paintInfo.context->fillRect(innerRect, Color::black, style->colorSpace()); - return false; - } - - // Paint the background first - paintInfo.context->fillRect(innerRect, Color::lightGray, style->colorSpace()); - - FloatRect valueRect; - - if (rect.width() < rect.height()) { - // Vertical gauge - double scale = innerRect.height() / (max - min); - valueRect.setLocation(FloatPoint(innerRect.x(), innerRect.y() + narrowPrecisionToFloat((max - value) * scale))); - valueRect.setSize(FloatSize(innerRect.width(), narrowPrecisionToFloat((value - min) * scale))); - } else if (renderMeter->style()->direction() == RTL) { - // right to left horizontal gauge - double scale = innerRect.width() / (max - min); - valueRect.setLocation(FloatPoint(innerRect.x() + narrowPrecisionToFloat((max - value) * scale), innerRect.y())); - valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min) * scale), innerRect.height())); - } else { - // left to right horizontal gauge - double scale = innerRect.width() / (max - min); - valueRect.setLocation(innerRect.location()); - valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min) * scale), innerRect.height())); - } - if (!valueRect.isEmpty()) - paintInfo.context->fillRect(valueRect, Color::black, style->colorSpace()); - return false; } + +bool RenderTheme::paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) +{ + return true; +} + #endif #if ENABLE(PROGRESS_TAG) diff --git a/WebCore/rendering/RenderTheme.h b/WebCore/rendering/RenderTheme.h index 2d196c7..72a33dc 100644 --- a/WebCore/rendering/RenderTheme.h +++ b/WebCore/rendering/RenderTheme.h @@ -195,6 +195,7 @@ public: #if ENABLE(METER_TAG) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; + virtual bool supportsMeter(ControlPart, bool isHorizontal) const; #endif protected: diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index 47a872d..e572b69 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -91,7 +91,7 @@ void RenderThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject* { NSControlTint oldTint = [cell controlTint]; NSControlTint tint = isActive(o) ? [NSColor currentControlTint] : - NSClearControlTint; + static_cast<NSControlTint>(NSClearControlTint); if (tint != oldTint) [cell setControlTint:tint]; diff --git a/WebCore/rendering/RenderThemeMac.h b/WebCore/rendering/RenderThemeMac.h index 7cb4e3b..34dbed3 100644 --- a/WebCore/rendering/RenderThemeMac.h +++ b/WebCore/rendering/RenderThemeMac.h @@ -83,6 +83,7 @@ public: #if ENABLE(METER_TAG) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; virtual bool paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool supportsMeter(ControlPart, bool isHorizontal) const; #endif #if ENABLE(PROGRESS_TAG) diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm index d0289de..9c79386 100644 --- a/WebCore/rendering/RenderThemeMac.mm +++ b/WebCore/rendering/RenderThemeMac.mm @@ -839,6 +839,20 @@ bool RenderThemeMac::paintMeter(RenderObject* renderObject, const RenderObject:: return false; } +bool RenderThemeMac::supportsMeter(ControlPart part, bool isHorizontal) const +{ + switch (part) { + case RelevancyLevelIndicatorPart: + case DiscreteCapacityLevelIndicatorPart: + case RatingLevelIndicatorPart: + case MeterPart: + case ContinuousCapacityLevelIndicatorPart: + return isHorizontal; + default: + return false; + } +} + NSLevelIndicatorStyle RenderThemeMac::levelIndicatorStyleFor(ControlPart part) const { switch (part) { diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp index b05d97a..26f40ab 100644 --- a/WebCore/rendering/RenderTreeAsText.cpp +++ b/WebCore/rendering/RenderTreeAsText.cpp @@ -416,10 +416,11 @@ void write(TextStream& ts, const RenderObject& o, int indent, RenderAsTextBehavi return; } if (o.isSVGText()) { - if (!o.isText()) - writeSVGText(ts, *toRenderBlock(&o), indent); - else - writeSVGInlineText(ts, *toRenderText(&o), indent); + writeSVGText(ts, *toRenderBlock(&o), indent); + return; + } + if (o.isSVGInlineText()) { + writeSVGInlineText(ts, *toRenderText(&o), indent); return; } if (o.isSVGImage()) { diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp index 8079760..e77f6c7 100644 --- a/WebCore/rendering/RenderView.cpp +++ b/WebCore/rendering/RenderView.cpp @@ -193,9 +193,17 @@ void RenderView::paint(PaintInfo& paintInfo, int tx, int ty) paintObject(paintInfo, tx, ty); } +static inline bool isComposited(RenderObject* object) +{ + return object->hasLayer() && toRenderBoxModelObject(object)->layer()->isComposited(); +} + static inline bool rendererObscuresBackground(RenderObject* object) { - return object && object->style()->visibility() == VISIBLE && object->style()->opacity() == 1 && !object->style()->hasTransform(); + return object && object->style()->visibility() == VISIBLE + && object->style()->opacity() == 1 + && !object->style()->hasTransform() + && !isComposited(object); } void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int, int) @@ -223,8 +231,19 @@ void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int, int) #endif } + if (document()->ownerElement() || !view()) + return; + + bool rootFillsViewport = false; + Node* documentElement = document()->documentElement(); + if (RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0) { + // The document element's renderer is currently forced to be a block, but may not always be. + RenderBox* rootBox = rootRenderer->isBox() ? toRenderBox(rootRenderer) : 0; + rootFillsViewport = rootBox && !rootBox->x() && !rootBox->y() && rootBox->width() >= width() && rootBox->height() >= height(); + } + // If painting will entirely fill the view, no need to fill the background. - if (elt || rendererObscuresBackground(firstChild()) || !view()) + if (rootFillsViewport && rendererObscuresBackground(firstChild())) return; // This code typically only executes if the root element's visibility has been set to hidden, diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp index 24e49c6..3a8a4f5 100644 --- a/WebCore/rendering/RootInlineBox.cpp +++ b/WebCore/rendering/RootInlineBox.cpp @@ -47,11 +47,11 @@ void RootInlineBox::destroy(RenderArena* arena) void RootInlineBox::detachEllipsisBox(RenderArena* arena) { - if (m_hasEllipsisBox) { + if (hasEllipsisBox()) { EllipsisBox* box = gEllipsisBoxMap->take(this); box->setParent(0); box->destroy(arena); - m_hasEllipsisBox = false; + setHasEllipsisBox(false); } } @@ -62,7 +62,7 @@ RenderLineBoxList* RootInlineBox::rendererLineBoxes() const void RootInlineBox::clearTruncation() { - if (m_hasEllipsisBox) { + if (hasEllipsisBox()) { detachEllipsisBox(renderer()->renderArena()); InlineFlowBox::clearTruncation(); } @@ -92,7 +92,7 @@ void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, in if (!gEllipsisBoxMap) gEllipsisBoxMap = new EllipsisBoxMap(); gEllipsisBoxMap->add(this, ellipsisBox); - m_hasEllipsisBox = true; + setHasEllipsisBox(true); // FIXME: Do we need an RTL version of this? if (ltr && (x() + width() + ellipsisWidth) <= blockRightEdge) { @@ -117,8 +117,8 @@ int RootInlineBox::placeEllipsisBox(bool ltr, int blockLeftEdge, int blockRightE void RootInlineBox::paintEllipsisBox(RenderObject::PaintInfo& paintInfo, int tx, int ty) const { - if (m_hasEllipsisBox && renderer()->shouldPaintWithinRoot(paintInfo) && renderer()->style()->visibility() == VISIBLE && - paintInfo.phase == PaintPhaseForeground) + if (hasEllipsisBox() && renderer()->shouldPaintWithinRoot(paintInfo) && renderer()->style()->visibility() == VISIBLE + && paintInfo.phase == PaintPhaseForeground) ellipsisBox()->paint(paintInfo, tx, ty); } @@ -174,7 +174,7 @@ void RootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty) { - if (m_hasEllipsisBox && visibleToHitTesting()) { + if (hasEllipsisBox() && visibleToHitTesting()) { if (ellipsisBox()->nodeAtPoint(request, result, x, y, tx, ty)) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); return true; @@ -204,6 +204,12 @@ void RootInlineBox::childRemoved(InlineBox* box) int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { +#if ENABLE(SVG) + // SVG will handle vertical alignment on its own. + if (isSVGRootInlineBox()) + return 0; +#endif + int maxPositionTop = 0; int maxPositionBottom = 0; int maxAscent = 0; @@ -410,8 +416,8 @@ void RootInlineBox::setLineBreakInfo(RenderObject* obj, unsigned breakPos, const EllipsisBox* RootInlineBox::ellipsisBox() const { - if (!m_hasEllipsisBox) - return false; + if (!hasEllipsisBox()) + return 0; return gEllipsisBoxMap->get(this); } diff --git a/WebCore/rendering/RootInlineBox.h b/WebCore/rendering/RootInlineBox.h index cfa550b..fa2510a 100644 --- a/WebCore/rendering/RootInlineBox.h +++ b/WebCore/rendering/RootInlineBox.h @@ -61,15 +61,11 @@ public: int selectionBottom() const { return lineBottom(); } int selectionHeight() const { return max(0, selectionBottom() - selectionTop()); } - virtual int verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&); + int verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&); void setLineTopBottomPositions(int top, int bottom); virtual RenderLineBoxList* rendererLineBoxes() const; -#if ENABLE(SVG) - virtual void computePerCharacterLayoutInformation() { } -#endif - RenderObject* lineBreakObj() const { return m_lineBreakObj; } BidiStatus lineBreakBidiStatus() const; void setLineBreakInfo(RenderObject*, unsigned breakPos, const BidiStatus&); @@ -132,7 +128,10 @@ public: virtual void attachLineBoxToRenderObject(); virtual void removeLineBoxFromRenderObject(); -protected: +private: + bool hasEllipsisBox() const { return m_hasEllipsisBoxOrHyphen; } + void setHasEllipsisBox(bool hasEllipsisBox) { m_hasEllipsisBoxOrHyphen = hasEllipsisBox; } + // Where this line ended. The exact object and the position within that object are stored so that // we can create an InlineIterator beginning just after the end of this line. RenderObject* m_lineBreakObj; diff --git a/WebCore/rendering/SVGCharacterData.h b/WebCore/rendering/SVGCharacterData.h index 68682c9..5143042 100644 --- a/WebCore/rendering/SVGCharacterData.h +++ b/WebCore/rendering/SVGCharacterData.h @@ -90,12 +90,6 @@ struct SVGChar { AffineTransform characterTransform() const; }; -struct SVGTextDecorationInfo { - // ETextDecoration is meant to be used here - HashMap<int, RenderObject*> fillServerMap; - HashMap<int, RenderObject*> strokeServerMap; -}; - } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.cpp b/WebCore/rendering/SVGCharacterLayoutInfo.cpp index 04f0067..18315df 100644 --- a/WebCore/rendering/SVGCharacterLayoutInfo.cpp +++ b/WebCore/rendering/SVGCharacterLayoutInfo.cpp @@ -67,7 +67,7 @@ static float calculateBaselineShift(RenderObject* item) return baselineShift; } -SVGCharacterLayoutInfo::SVGCharacterLayoutInfo(Vector<SVGChar>& chars) +SVGCharacterLayoutInfo::SVGCharacterLayoutInfo() : curx(0.0f) , cury(0.0f) , angle(0.0f) @@ -78,7 +78,6 @@ SVGCharacterLayoutInfo::SVGCharacterLayoutInfo(Vector<SVGChar>& chars) , pathExtraAdvance(0.0f) , pathTextLength(0.0f) , pathChunkLength(0.0f) - , svgChars(chars) , nextDrawnSeperated(false) , xStackChanged(false) , yStackChanged(false) diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.h b/WebCore/rendering/SVGCharacterLayoutInfo.h index 16fd740..7549283 100644 --- a/WebCore/rendering/SVGCharacterLayoutInfo.h +++ b/WebCore/rendering/SVGCharacterLayoutInfo.h @@ -67,7 +67,7 @@ class PositionedFloatVector : public PositionedVector<float> { }; struct SVGChar; struct SVGCharacterLayoutInfo { - SVGCharacterLayoutInfo(Vector<SVGChar>&); + SVGCharacterLayoutInfo(); enum StackType { XStack, YStack, DxStack, DyStack, AngleStack, BaselineShiftStack }; @@ -120,7 +120,7 @@ struct SVGCharacterLayoutInfo { float pathChunkLength; // Result vector - Vector<SVGChar>& svgChars; + Vector<SVGChar> svgChars; bool nextDrawnSeperated : 1; private: diff --git a/WebCore/rendering/SVGInlineFlowBox.cpp b/WebCore/rendering/SVGInlineFlowBox.cpp index bbd61b3..1cd938a 100644 --- a/WebCore/rendering/SVGInlineFlowBox.cpp +++ b/WebCore/rendering/SVGInlineFlowBox.cpp @@ -1,9 +1,8 @@ /* - * This file is part of the WebKit project. - * * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> * (C) 2006 Apple Computer Inc. * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 @@ -23,24 +22,43 @@ */ #include "config.h" +#include "SVGInlineFlowBox.h" #if ENABLE(SVG) -#include "SVGInlineFlowBox.h" -#include "SVGNames.h" +#include "GraphicsContext.h" +#include "SVGRenderSupport.h" namespace WebCore { -using namespace SVGNames; - -void SVGInlineFlowBox::paint(RenderObject::PaintInfo&, int, int) +void SVGInlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int, int) { - ASSERT_NOT_REACHED(); + ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); + ASSERT(!paintInfo.context->paintingDisabled()); + + RenderObject* boxRenderer = renderer(); + ASSERT(boxRenderer); + + RenderObject::PaintInfo childPaintInfo(paintInfo); + childPaintInfo.context->save(); + + RenderSVGResourceFilter* filter = 0; + FloatRect repaintRect = boxRenderer->repaintRectInLocalCoordinates(); + + if (SVGRenderBase::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) { + for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) + child->paint(childPaintInfo, 0, 0); + } + + SVGRenderBase::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context); + childPaintInfo.context->restore(); } -int SVGInlineFlowBox::placeBoxesHorizontally(int, int&, int&, bool&, GlyphOverflowAndFallbackFontsMap&) +IntRect SVGInlineFlowBox::calculateBoundaries() const { - // no-op - return 0; + IntRect childRect; + for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) + childRect.unite(child->calculateBoundaries()); + return childRect; } } // namespace WebCore diff --git a/WebCore/rendering/SVGInlineFlowBox.h b/WebCore/rendering/SVGInlineFlowBox.h index 17ad528..ba4c5b2 100644 --- a/WebCore/rendering/SVGInlineFlowBox.h +++ b/WebCore/rendering/SVGInlineFlowBox.h @@ -41,8 +41,10 @@ public: void setHeight(int h) { m_height = h; } virtual void paint(RenderObject::PaintInfo&, int tx, int ty); - virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); - + + virtual IntRect calculateBoundaries() const; + void layoutFlowBox(); + private: int m_height; }; diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index 8bd7fef..68b4fd0 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -21,25 +21,28 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGInlineTextBox.h" -#include "Frame.h" +#if ENABLE(SVG) +#include "FloatConversion.h" #include "GraphicsContext.h" #include "InlineFlowBox.h" +#include "RenderBlock.h" #include "RenderSVGResource.h" #include "SVGRootInlineBox.h" #include "SVGTextLayoutUtilities.h" -#include "Text.h" #include <float.h> +using namespace std; + namespace WebCore { -SVGInlineTextBox::SVGInlineTextBox(RenderObject* obj) - : InlineTextBox(obj) +SVGInlineTextBox::SVGInlineTextBox(RenderObject* object) + : InlineTextBox(object) , m_height(0) + , m_paintingResource(0) + , m_paintingResourceMode(ApplyToDefaultMode) { } @@ -60,522 +63,550 @@ SVGRootInlineBox* SVGInlineTextBox::svgRootInlineBox() const return static_cast<SVGRootInlineBox*>(parentBox); } -float SVGInlineTextBox::calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const +void SVGInlineTextBox::measureCharacter(RenderStyle* style, int position, int& charsConsumed, String& glyphName, String& unicodeString, float& glyphWidth, float& glyphHeight) const { ASSERT(style); - return style->font().floatWidth(svgTextRunForInlineTextBox(textRenderer()->characters() + offset, 1, style, this, 0), extraCharsAvailable, charsConsumed, glyphName); -} -float SVGInlineTextBox::calculateGlyphHeight(RenderStyle* style, int, int) const -{ - // This is just a guess, and the only purpose of this function is to centralize this hack. - // In real-life top-top-bottom scripts this won't be enough, I fear. - return style->font().ascent() + style->font().descent(); + int offset = direction() == RTL ? end() - position : start() + position; + int extraCharsAvailable = len() - position - 1; + const UChar* characters = textRenderer()->characters(); + + const Font& font = style->font(); + glyphWidth = font.floatWidth(svgTextRunForInlineTextBox(characters + offset, 1, style, this), extraCharsAvailable, charsConsumed, glyphName); + glyphHeight = font.height(); + + // The unicodeString / glyphName pair is needed for kerning calculations. + unicodeString = String(characters + offset, charsConsumed); } -FloatRect SVGInlineTextBox::calculateGlyphBoundaries(RenderStyle* style, int offset, const SVGChar& svgChar) const +int SVGInlineTextBox::offsetForPosition(int xCoordinate, bool includePartialGlyphs) const { - const Font& font = style->font(); + ASSERT(!m_currentChunkPart.isValid()); + float x = xCoordinate; - // Take RTL text into account and pick right glyph width/height. - float glyphWidth = 0.0f; + RenderText* textRenderer = this->textRenderer(); + ASSERT(textRenderer); - // FIXME: account for multi-character glyphs - int charsConsumed; - String glyphName; - if (direction() == LTR) - glyphWidth = calculateGlyphWidth(style, offset, 0, charsConsumed, glyphName); - else - glyphWidth = calculateGlyphWidth(style, start() + end() - offset, 0, charsConsumed, glyphName); + RenderStyle* style = textRenderer->style(); + ASSERT(style); - float x1 = svgChar.x; - float x2 = svgChar.x + glyphWidth; + RenderBlock* containingBlock = textRenderer->containingBlock(); + ASSERT(containingBlock); - float y1 = svgChar.y - font.ascent(); - float y2 = svgChar.y + font.descent(); + // Move incoming relative x position to absolute position, as the character origins stored in the chunk parts use absolute coordinates + x += containingBlock->x(); - FloatRect glyphRect(x1, y1, x2 - x1, y2 - y1); + // Figure out which text chunk part is hit + SVGTextChunkPart hitPart; - // Take per-character transformations into account - glyphRect = svgChar.characterTransform().mapRect(glyphRect); + const Vector<SVGTextChunkPart>::const_iterator end = m_svgTextChunkParts.end(); + for (Vector<SVGTextChunkPart>::const_iterator it = m_svgTextChunkParts.begin(); it != end; ++it) { + const SVGTextChunkPart& part = *it; - return glyphRect; -} + // Check whether we're past the hit part. + if (x < part.firstCharacter->x) + break; -// Helper class for closestCharacterToPosition() -struct SVGInlineTextBoxClosestCharacterToPositionWalker { - SVGInlineTextBoxClosestCharacterToPositionWalker(int x, int y) - : m_character(0) - , m_distance(FLT_MAX) - , m_x(x) - , m_y(y) - , m_offsetOfHitCharacter(0) - { + hitPart = part; } - void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - RenderStyle* style = textBox->textRenderer()->style(); + // If we did not hit anything, just exit. + if (!hitPart.isValid()) + return 0; - Vector<SVGChar>::iterator closestCharacter = 0; - unsigned int closestOffset = UINT_MAX; + // Before calling Font::offsetForPosition(), subtract the start position of the first character + // in the hit text chunk part, to pass in coordinates, which are relative to the text chunk part, as + // constructTextRun() only builds a TextRun for the current chunk part, not the whole inline text box. + x -= hitPart.firstCharacter->x; - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (it->isHidden()) - continue; + m_currentChunkPart = hitPart; + TextRun textRun(constructTextRun(style)); + m_currentChunkPart = SVGTextChunkPart(); - unsigned int newOffset = textBox->start() + (it - start) + startOffset; - FloatRect glyphRect = chunkCtm.mapRect(textBox->calculateGlyphBoundaries(style, newOffset, *it)); + // Eventually handle lengthAdjust="spacingAndGlyphs". + if (!m_chunkTransformation.isIdentity()) + textRun.setGlyphScale(narrowPrecisionToFloat(isVerticalWritingMode(style->svgStyle()) ? m_chunkTransformation.d() : m_chunkTransformation.a())); - // Take RTL text into account and pick right glyph width/height. - // NOTE: This offset has to be corrected _after_ calling calculateGlyphBoundaries - if (textBox->direction() == RTL) - newOffset = textBox->start() + textBox->end() - newOffset; + return hitPart.offset + style->font().offsetForPosition(textRun, x, includePartialGlyphs); +} - // Calculate distances relative to the glyph mid-point. I hope this is accurate enough. - float xDistance = glyphRect.x() + glyphRect.width() / 2.0f - m_x; - float yDistance = glyphRect.y() - glyphRect.height() / 2.0f - m_y; +int SVGInlineTextBox::positionForOffset(int) const +{ + // SVG doesn't use the offset <-> position selection system. + ASSERT_NOT_REACHED(); + return 0; +} - float newDistance = sqrtf(xDistance * xDistance + yDistance * yDistance); - if (newDistance <= m_distance) { - m_distance = newDistance; - closestOffset = newOffset; - closestCharacter = it; - } - } +FloatRect SVGInlineTextBox::selectionRectForTextChunkPart(const SVGTextChunkPart& part, int partStartPos, int partEndPos, RenderStyle* style) +{ + // Map startPos/endPos positions into chunk part + mapStartEndPositionsIntoChunkPartCoordinates(partStartPos, partEndPos, part); - if (closestOffset != UINT_MAX) { - // Record current chunk, if it contains the current closest character next to the mouse. - m_character = closestCharacter; - m_offsetOfHitCharacter = closestOffset; - } - } + if (partStartPos >= partEndPos) + return FloatRect(); - SVGChar* character() const - { - return m_character; - } + // Set current chunk part, so constructTextRun() works properly. + m_currentChunkPart = part; - int offsetOfHitCharacter() const - { - if (!m_character) - return 0; + const Font& font = style->font(); + Vector<SVGChar>::const_iterator character = part.firstCharacter; + FloatPoint textOrigin(character->x, character->y - font.ascent()); - return m_offsetOfHitCharacter; - } + FloatRect partRect(font.selectionRectForText(constructTextRun(style), textOrigin, part.height, partStartPos, partEndPos)); + m_currentChunkPart = SVGTextChunkPart(); -private: - Vector<SVGChar>::iterator m_character; - float m_distance; + return character->characterTransform().mapRect(partRect); +} - int m_x; - int m_y; - int m_offsetOfHitCharacter; -}; +IntRect SVGInlineTextBox::selectionRect(int, int, int startPos, int endPos) +{ + ASSERT(!m_currentChunkPart.isValid()); -// Helper class for selectionRect() -struct SVGInlineTextBoxSelectionRectWalker { - SVGInlineTextBoxSelectionRectWalker() - { - } + int boxStart = start(); + startPos = max(startPos - boxStart, 0); + endPos = min(endPos - boxStart, static_cast<int>(len())); - void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - RenderStyle* style = textBox->textRenderer()->style(); + if (startPos >= endPos) + return IntRect(); - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (it->isHidden()) - continue; + RenderText* text = textRenderer(); + ASSERT(text); - unsigned int newOffset = textBox->start() + (it - start) + startOffset; - m_selectionRect.unite(textBox->calculateGlyphBoundaries(style, newOffset, *it)); - } + RenderStyle* style = text->style(); + ASSERT(style); - m_selectionRect = chunkCtm.mapRect(m_selectionRect); - } + FloatRect selectionRect; - FloatRect selectionRect() const - { - return m_selectionRect; - } + // Figure out which text chunk part is hit + const Vector<SVGTextChunkPart>::const_iterator end = m_svgTextChunkParts.end(); + for (Vector<SVGTextChunkPart>::const_iterator it = m_svgTextChunkParts.begin(); it != end; ++it) + selectionRect.unite(selectionRectForTextChunkPart(*it, startPos, endPos, style)); + + // Resepect possible chunk transformation + if (m_chunkTransformation.isIdentity()) + return enclosingIntRect(selectionRect); -private: - FloatRect m_selectionRect; -}; + return enclosingIntRect(m_chunkTransformation.mapRect(selectionRect)); +} -SVGChar* SVGInlineTextBox::closestCharacterToPosition(int x, int y, int& offsetOfHitCharacter) const +void SVGInlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int, int) { - SVGRootInlineBox* rootBox = svgRootInlineBox(); - if (!rootBox) - return 0; + ASSERT(renderer()->shouldPaintWithinRoot(paintInfo)); + ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); + ASSERT(truncation() == cNoTruncation); - SVGInlineTextBoxClosestCharacterToPositionWalker walkerCallback(x, y); - SVGTextChunkWalker<SVGInlineTextBoxClosestCharacterToPositionWalker> walker(&walkerCallback, &SVGInlineTextBoxClosestCharacterToPositionWalker::chunkPortionCallback); + if (renderer()->style()->visibility() != VISIBLE) + return; - rootBox->walkTextChunks(&walker, this); + // Note: We're explicitely not supporting composition & custom underlines and custom highlighters - unlike InlineTextBox. + // If we ever need that for SVG, it's very easy to refactor and reuse the code. - offsetOfHitCharacter = walkerCallback.offsetOfHitCharacter(); - return walkerCallback.character(); -} + RenderObject* parentRenderer = parent()->renderer(); + ASSERT(parentRenderer); -bool SVGInlineTextBox::svgCharacterHitsPosition(int x, int y, int& closestOffsetInBox) const -{ - int offsetOfHitCharacter = 0; - SVGChar* charAtPosPtr = closestCharacterToPosition(x, y, offsetOfHitCharacter); - if (!charAtPosPtr) - return false; + RenderStyle* style = parentRenderer->style(); + ASSERT(style); - SVGChar& charAtPos = *charAtPosPtr; - RenderStyle* style = textRenderer()->style(m_firstLine); - FloatRect glyphRect = calculateGlyphBoundaries(style, offsetOfHitCharacter, charAtPos); + const SVGRenderStyle* svgStyle = style->svgStyle(); + ASSERT(svgStyle); - // FIXME: Why? - if (direction() == RTL) - offsetOfHitCharacter++; + bool hasFill = svgStyle->hasFill(); + bool hasStroke = svgStyle->hasStroke(); + bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection; - // The caller actually the closest offset before/after the hit char - // closestCharacterToPosition returns us offsetOfHitCharacter. - closestOffsetInBox = offsetOfHitCharacter; + // Determine whether or not we're selected. + bool isPrinting = parentRenderer->document()->printing(); + bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone; + if (!hasSelection && paintSelectedTextOnly) + return; - // FIXME: (bug 13910) This code does not handle bottom-to-top/top-to-bottom vertical text. + RenderStyle* selectionStyle = style; + if (hasSelection) { + selectionStyle = parentRenderer->getCachedPseudoStyle(SELECTION); + if (selectionStyle) { + const SVGRenderStyle* svgSelectionStyle = selectionStyle->svgStyle(); + ASSERT(svgSelectionStyle); + + if (!hasFill) + hasFill = svgSelectionStyle->hasFill(); + if (!hasStroke) + hasStroke = svgSelectionStyle->hasStroke(); + } else + selectionStyle = style; + } - // Check whether y position hits the current character - if (y < charAtPos.y - glyphRect.height() || y > charAtPos.y) - return false; + // Compute text match marker rects. It needs to traverse all text chunk parts to figure + // out the union selection rect of all text chunk parts that contribute to the selection. + computeTextMatchMarkerRect(style); + ASSERT(!m_currentChunkPart.isValid()); + + const Vector<SVGTextChunkPart>::const_iterator end = m_svgTextChunkParts.end(); + for (Vector<SVGTextChunkPart>::const_iterator it = m_svgTextChunkParts.begin(); it != end; ++it) { + ASSERT(!m_paintingResource); + + // constructTextRun() uses the current chunk part to figure out what text to render. + m_currentChunkPart = *it; + paintInfo.context->save(); + + // Prepare context and draw text + if (!m_chunkTransformation.isIdentity()) + paintInfo.context->concatCTM(m_chunkTransformation); + + Vector<SVGChar>::const_iterator firstCharacter = m_currentChunkPart.firstCharacter; + AffineTransform characterTransform = firstCharacter->characterTransform(); + if (!characterTransform.isIdentity()) + paintInfo.context->concatCTM(characterTransform); + + FloatPoint textOrigin(firstCharacter->x, firstCharacter->y); + + // Draw background once (not in both fill/stroke phases) + if (!isPrinting && !paintSelectedTextOnly && hasSelection) + paintSelection(paintInfo.context, textOrigin, style); + + // Spec: All text decorations except line-through should be drawn before the text is filled and stroked; thus, the text is rendered on top of these decorations. + int decorations = style->textDecorationsInEffect(); + if (decorations & UNDERLINE) + paintDecoration(paintInfo.context, textOrigin, UNDERLINE, hasSelection); + if (decorations & OVERLINE) + paintDecoration(paintInfo.context, textOrigin, OVERLINE, hasSelection); + + // Fill text + if (hasFill) { + m_paintingResourceMode = ApplyToFillMode | ApplyToTextMode; + paintText(paintInfo.context, textOrigin, style, selectionStyle, hasSelection, paintSelectedTextOnly); + } - // Check whether x position hits the current character - if (x < charAtPos.x) { - if (closestOffsetInBox > 0 && direction() == LTR) - return true; - if (closestOffsetInBox < static_cast<int>(end()) && direction() == RTL) - return true; + // Stroke text + if (hasStroke) { + m_paintingResourceMode = ApplyToStrokeMode | ApplyToTextMode; + paintText(paintInfo.context, textOrigin, style, selectionStyle, hasSelection, paintSelectedTextOnly); + } - return false; + // Spec: Line-through should be drawn after the text is filled and stroked; thus, the line-through is rendered on top of the text. + if (decorations & LINE_THROUGH) + paintDecoration(paintInfo.context, textOrigin, LINE_THROUGH, hasSelection); + + m_paintingResourceMode = ApplyToDefaultMode; + paintInfo.context->restore(); } - // Adjust the closest offset to after the char if x was after the char midpoint - if (x >= charAtPos.x + glyphRect.width() / 2.0) - closestOffsetInBox += direction() == RTL ? -1 : 1; + m_currentChunkPart = SVGTextChunkPart(); + ASSERT(!m_paintingResource); +} + +bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderStyle* style) +{ + ASSERT(m_paintingResourceMode != ApplyToDefaultMode); + + RenderObject* parentRenderer = parent()->renderer(); + ASSERT(parentRenderer); + + if (m_paintingResourceMode & ApplyToFillMode) + m_paintingResource = RenderSVGResource::fillPaintingResource(parentRenderer, style); + else if (m_paintingResourceMode & ApplyToStrokeMode) + m_paintingResource = RenderSVGResource::strokePaintingResource(parentRenderer, style); + else { + // We're either called for stroking or filling. + ASSERT_NOT_REACHED(); + } - // If we are past the last glyph of this box, don't mark it as 'hit' - if (x >= charAtPos.x + glyphRect.width() && closestOffsetInBox == (int) end()) + if (!m_paintingResource) return false; + m_paintingResource->applyResource(parentRenderer, style, context, m_paintingResourceMode); return true; } -int SVGInlineTextBox::offsetForPosition(int, bool) const +void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context) { - // SVG doesn't use the offset <-> position selection system. - ASSERT_NOT_REACHED(); - return 0; + ASSERT(m_paintingResource); + + RenderObject* parentRenderer = parent()->renderer(); + ASSERT(parentRenderer); + + m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode); + m_paintingResource = 0; } -int SVGInlineTextBox::positionForOffset(int) const +bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& context, TextRun& textRun, RenderStyle* style) { - // SVG doesn't use the offset <-> position selection system. - ASSERT_NOT_REACHED(); - return 0; + bool acquiredResource = acquirePaintingResource(context, style); + +#if ENABLE(SVG_FONTS) + // SVG Fonts need access to the painting resource used to draw the current text chunk. + if (acquiredResource) + textRun.setActivePaintingResource(m_paintingResource); +#endif + + return acquiredResource; } -bool SVGInlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, int x, int y, int tx, int ty) +void SVGInlineTextBox::restoreGraphicsContextAfterTextPainting(GraphicsContext*& context, TextRun& textRun) { - ASSERT(!isLineBreak()); + releasePaintingResource(context); - IntRect rect = selectionRect(0, 0, 0, len()); - if (renderer()->style()->visibility() == VISIBLE && rect.contains(x, y)) { - renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); - return true; - } +#if ENABLE(SVG_FONTS) + textRun.setActivePaintingResource(0); +#endif +} - return false; +TextRun SVGInlineTextBox::constructTextRun(RenderStyle* style) const +{ + ASSERT(m_currentChunkPart.isValid()); + return svgTextRunForInlineTextBox(textRenderer()->text()->characters() + start() + m_currentChunkPart.offset, m_currentChunkPart.length, style, this); } -IntRect SVGInlineTextBox::selectionRect(int, int, int startPos, int endPos) +void SVGInlineTextBox::mapStartEndPositionsIntoChunkPartCoordinates(int& startPos, int& endPos, const SVGTextChunkPart& part) const { if (startPos >= endPos) - return IntRect(); + return; - // TODO: Actually respect startPos/endPos - we're returning the _full_ selectionRect - // here. This won't lead to visible bugs, but to extra work being done. Investigate. - SVGRootInlineBox* rootBox = svgRootInlineBox(); - if (!rootBox) - return IntRect(); + // Take <text x="10 50 100">ABC</text> as example. We're called three times from paint(), because all absolute positioned + // characters are drawn on their own. For each of them we want to find out whehter it's selected. startPos=0, endPos=1 + // could mean A, B or C is hit, depending on which chunk part is processed at the moment. With the offset & length values + // of each chunk part we can easily find out which one is meant to be selected. Bail out for the other chunk parts. + // If starPos is behind the current chunk or the endPos ends before this text chunk part, we're not meant to be selected. + if (startPos >= part.offset + part.length || endPos <= part.offset) { + startPos = 0; + endPos = -1; + return; + } + + // The current processed chunk part is hit. When painting the selection, constructTextRun() builds + // a TextRun object whose startPos is 0 and endPos is chunk part length. The code below maps the incoming + // startPos/endPos range into a [0, part length] coordinate system, relative to the current chunk part. + if (startPos < part.offset) + startPos = 0; + else + startPos -= part.offset; - SVGInlineTextBoxSelectionRectWalker walkerCallback; - SVGTextChunkWalker<SVGInlineTextBoxSelectionRectWalker> walker(&walkerCallback, &SVGInlineTextBoxSelectionRectWalker::chunkPortionCallback); + if (endPos > part.offset + part.length) + endPos = part.length; + else { + ASSERT(endPos >= part.offset); + endPos -= part.offset; + } - rootBox->walkTextChunks(&walker, this); - return enclosingIntRect(walkerCallback.selectionRect()); + ASSERT(startPos < endPos); } -bool SVGInlineTextBox::chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd) +void SVGInlineTextBox::selectionStartEnd(int& startPos, int& endPos) { - // NOTE: We ignore SVGInlineTextBox::m_start here because it is always 0. - // Curently SVG doesn't use HTML block-level layout, in which m_start would be set. - - int chunkStart = chunk - textRenderer()->characters(); - ASSERT(0 <= chunkStart); + InlineTextBox::selectionStartEnd(startPos, endPos); - selectionStartEnd(selectionStart, selectionEnd); - if (selectionEnd <= chunkStart) - return false; - if (chunkStart + chunkLength <= selectionStart) - return false; - - // Map indices from view-global to chunk-local. - selectionStart -= chunkStart; - selectionEnd -= chunkStart; - // Then clamp with chunk range - if (selectionStart < 0) - selectionStart = 0; - if (chunkLength < selectionEnd) - selectionEnd = chunkLength; + if (!m_currentChunkPart.isValid()) + return; - return selectionStart < selectionEnd; + mapStartEndPositionsIntoChunkPartCoordinates(startPos, endPos, m_currentChunkPart); } -void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int tx, int ty, const SVGChar& svgChar, const UChar* chars, int length, SVGTextPaintInfo& textPaintInfo) +void SVGInlineTextBox::computeTextMatchMarkerRect(RenderStyle* style) { - if (renderer()->style()->visibility() != VISIBLE || paintInfo.phase == PaintPhaseOutline) + ASSERT(!m_currentChunkPart.isValid()); + Node* node = renderer()->node(); + if (!node || !node->inDocument()) return; - ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines); + Document* document = renderer()->document(); + Vector<DocumentMarker> markers = document->markersForNode(renderer()->node()); - RenderText* text = textRenderer(); - ASSERT(text); + Vector<DocumentMarker>::iterator markerEnd = markers.end(); + for (Vector<DocumentMarker>::iterator markerIt = markers.begin(); markerIt != markerEnd; ++markerIt) { + const DocumentMarker& marker = *markerIt; - bool isPrinting = text->document()->printing(); + // SVG is only interessted in the TextMatch marker, for now. + if (marker.type != DocumentMarker::TextMatch) + continue; - // Determine whether or not we're selected. - bool haveSelection = !isPrinting && selectionState() != RenderObject::SelectionNone; - if (!haveSelection && paintInfo.phase == PaintPhaseSelection) - // When only painting the selection, don't bother to paint if there is none. - return; + FloatRect markerRect; + int partStartPos = max(marker.startOffset - start(), static_cast<unsigned>(0)); + int partEndPos = min(marker.endOffset - start(), static_cast<unsigned>(len())); - // Determine whether or not we have a composition. - bool containsComposition = text->document()->frame()->editor()->compositionNode() == text->node(); - bool useCustomUnderlines = containsComposition && text->document()->frame()->editor()->compositionUsesCustomUnderlines(); - - // Set our font - RenderStyle* styleToUse = text->style(isFirstLineStyle()); - const Font& font = styleToUse->font(); - - AffineTransform ctm = svgChar.characterTransform(); - if (!ctm.isIdentity()) - paintInfo.context->concatCTM(ctm); - - // 1. Paint backgrounds behind text if needed. Examples of such backgrounds include selection - // and marked text. - if (paintInfo.phase != PaintPhaseSelection && !isPrinting && textPaintInfo.subphase == SVGTextPaintSubphaseBackground) { -#if PLATFORM(MAC) - // Custom highlighters go behind everything else. - if (styleToUse->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) - paintCustomHighlight(tx, ty, styleToUse->highlight()); -#endif + // Iterate over all text chunk parts, to see which ones have to be highlighted + const Vector<SVGTextChunkPart>::const_iterator end = m_svgTextChunkParts.end(); + for (Vector<SVGTextChunkPart>::const_iterator it = m_svgTextChunkParts.begin(); it != end; ++it) + markerRect.unite(selectionRectForTextChunkPart(*it, partStartPos, partEndPos, style)); - if (containsComposition && !useCustomUnderlines) - paintCompositionBackground(paintInfo.context, tx, ty, styleToUse, font, - text->document()->frame()->editor()->compositionStart(), - text->document()->frame()->editor()->compositionEnd()); - - paintDocumentMarkers(paintInfo.context, tx, ty, styleToUse, font, true); + if (!m_chunkTransformation.isIdentity()) + markerRect = m_chunkTransformation.mapRect(markerRect); - if (haveSelection && !useCustomUnderlines) { - int boxStartOffset = chars - text->characters() - start(); - paintSelection(boxStartOffset, svgChar, chars, length, paintInfo.context, styleToUse, font); - } + document->setRenderedRectForMarker(node, marker, renderer()->localToAbsoluteQuad(markerRect).enclosingBoundingBox()); } +} - bool isGlyphPhase = textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFill || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStroke; - bool isSelectionGlyphPhase = textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFillSelection || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStrokeSelection; - - if (isGlyphPhase || isSelectionGlyphPhase) { - // Set a text shadow if we have one. - // FIXME: Support multiple shadow effects. See how it's done in InlineTextBox.cpp. - bool setShadow = false; - if (styleToUse->textShadow()) { - paintInfo.context->setShadow(IntSize(styleToUse->textShadow()->x(), styleToUse->textShadow()->y()), - styleToUse->textShadow()->blur(), styleToUse->textShadow()->color(), - styleToUse->colorSpace()); - setShadow = true; - } - - IntPoint origin((int) svgChar.x, (int) svgChar.y); - TextRun run = svgTextRunForInlineTextBox(chars, length, styleToUse, this, svgChar.x); +static inline float positionOffsetForDecoration(ETextDecoration decoration, const Font& font, float thickness) +{ + // FIXME: For SVG Fonts we need to use the attributes defined in the <font-face> if specified. + // Compatible with Batik/Opera. + if (decoration == UNDERLINE) + return font.ascent() + thickness * 1.5f; + if (decoration == OVERLINE) + return thickness; + if (decoration == LINE_THROUGH) + return font.ascent() * 5.0f / 8.0f; -#if ENABLE(SVG_FONTS) - // SVG Fonts need access to the painting resource used to draw the current text chunk. - ASSERT(textPaintInfo.activePaintingResource); - run.setActivePaintingResource(textPaintInfo.activePaintingResource); -#endif + ASSERT_NOT_REACHED(); + return 0.0f; +} - int selectionStart = 0; - int selectionEnd = 0; - bool haveSelectedRange = haveSelection && chunkSelectionStartEnd(chars, length, selectionStart, selectionEnd); - - if (isGlyphPhase) { - if (haveSelectedRange) { - paintInfo.context->drawText(font, run, origin, 0, selectionStart); - paintInfo.context->drawText(font, run, origin, selectionEnd, run.length()); - } else - paintInfo.context->drawText(font, run, origin); - } else { - ASSERT(isSelectionGlyphPhase); - if (haveSelectedRange) - paintInfo.context->drawText(font, run, origin, selectionStart, selectionEnd); - } +static inline float thicknessForDecoration(ETextDecoration, const Font& font) +{ + // FIXME: For SVG Fonts we need to use the attributes defined in the <font-face> if specified. + // Compatible with Batik/Opera + return font.size() / 20.0f; +} + +static inline RenderObject* findRenderObjectDefininingTextDecoration(InlineFlowBox* parentBox, ETextDecoration decoration) +{ + // Lookup render object which has text-decoration set. + RenderObject* renderer = 0; + while (parentBox) { + renderer = parentBox->renderer(); - if (setShadow) - paintInfo.context->clearShadow(); - } + // Explicitely check textDecoration() not textDecorationsInEffect(), which is inherited to + // children, as we want to lookup the render object whose style defined the text-decoration. + if (renderer->style() && renderer->style()->textDecoration() & decoration) + break; - if (paintInfo.phase != PaintPhaseSelection && textPaintInfo.subphase == SVGTextPaintSubphaseForeground) { - paintDocumentMarkers(paintInfo.context, tx, ty, styleToUse, font, false); - - if (useCustomUnderlines) { - const Vector<CompositionUnderline>& underlines = text->document()->frame()->editor()->customCompositionUnderlines(); - size_t numUnderlines = underlines.size(); - - for (size_t index = 0; index < numUnderlines; ++index) { - const CompositionUnderline& underline = underlines[index]; - - if (underline.endOffset <= start()) - // underline is completely before this run. This might be an underline that sits - // before the first run we draw, or underlines that were within runs we skipped - // due to truncation. - continue; - - if (underline.startOffset <= end()) { - // underline intersects this run. Paint it. - paintCompositionUnderline(paintInfo.context, tx, ty, underline); - if (underline.endOffset > end() + 1) - // underline also runs into the next run. Bail now, no more marker advancement. - break; - } else - // underline is completely after this run, bail. A later run will paint it. - break; - } - } - + parentBox = parentBox->parent(); } - if (!ctm.isIdentity()) - paintInfo.context->concatCTM(ctm.inverse()); + ASSERT(renderer); + return renderer; } -void SVGInlineTextBox::paintSelection(int boxStartOffset, const SVGChar& svgChar, const UChar*, int length, GraphicsContext* p, RenderStyle* style, const Font& font) +void SVGInlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& textOrigin, ETextDecoration decoration, bool hasSelection) { - if (selectionState() == RenderObject::SelectionNone) - return; - - int startPos, endPos; - selectionStartEnd(startPos, endPos); - - if (startPos >= endPos) - return; - - Color textColor = style->visitedDependentColor(CSSPropertyColor); - Color color = renderer()->selectionBackgroundColor(); - if (!color.isValid() || !color.alpha()) - return; + // Find out which render style defined the text-decoration, as its fill/stroke properties have to be used for drawing instead of ours. + RenderObject* decorationRenderer = findRenderObjectDefininingTextDecoration(parent(), decoration); + RenderStyle* decorationStyle = decorationRenderer->style(); + ASSERT(decorationStyle); - // If the text color ends up being the same as the selection background, invert the selection - // background. This should basically never happen, since the selection has transparency. - if (textColor == color) - color = Color(0xff - color.red(), 0xff - color.green(), 0xff - color.blue()); + const SVGRenderStyle* svgDecorationStyle = decorationStyle->svgStyle(); + ASSERT(svgDecorationStyle); - // Map from text box positions and a given start offset to chunk positions - // 'boxStartOffset' represents the beginning of the text chunk. - if ((startPos > boxStartOffset && endPos > boxStartOffset + length) || boxStartOffset >= endPos) - return; + bool hasDecorationFill = svgDecorationStyle->hasFill(); + bool hasDecorationStroke = svgDecorationStyle->hasStroke(); - if (endPos > boxStartOffset + length) - endPos = boxStartOffset + length; + if (hasSelection) { + if (RenderStyle* pseudoStyle = decorationRenderer->getCachedPseudoStyle(SELECTION)) { + decorationStyle = pseudoStyle; - if (startPos < boxStartOffset) - startPos = boxStartOffset; + svgDecorationStyle = decorationStyle->svgStyle(); + ASSERT(svgDecorationStyle); - ASSERT(startPos >= boxStartOffset); - ASSERT(endPos <= boxStartOffset + length); - ASSERT(startPos < endPos); + if (!hasDecorationFill) + hasDecorationFill = svgDecorationStyle->hasFill(); + if (!hasDecorationStroke) + hasDecorationStroke = svgDecorationStyle->hasStroke(); + } + } - p->save(); + if (decorationStyle->visibility() == HIDDEN) + return; - int adjust = startPos >= boxStartOffset ? boxStartOffset : 0; - p->drawHighlightForText(font, svgTextRunForInlineTextBox(textRenderer()->characters() + start() + boxStartOffset, length, style, this, svgChar.x), - IntPoint((int) svgChar.x, (int) svgChar.y - font.ascent()), - font.ascent() + font.descent(), color, style->colorSpace(), startPos - adjust, endPos - adjust); + if (hasDecorationFill) { + m_paintingResourceMode = ApplyToFillMode; + paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + } - p->restore(); + if (hasDecorationStroke) { + m_paintingResourceMode = ApplyToStrokeMode; + paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + } } -static inline Path pathForDecoration(ETextDecoration decoration, RenderObject* object, float x, float y, float width) +void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* decorationStyle, ETextDecoration decoration) { - float thickness = SVGRenderStyle::cssPrimitiveToLength(object, object->style()->svgStyle()->strokeWidth(), 1.0f); + ASSERT(!m_paintingResource); + ASSERT(m_paintingResourceMode != ApplyToDefaultMode); + ASSERT(m_currentChunkPart.isValid()); - const Font& font = object->style()->font(); - thickness = max(thickness * powf(font.size(), 2.0f) / font.unitsPerEm(), 1.0f); + const Font& font = decorationStyle->font(); - if (decoration == UNDERLINE) - y += thickness * 1.5f; // For compatibility with Batik/Opera - else if (decoration == OVERLINE) - y += thickness; + // The initial y value refers to overline position. + float thickness = thicknessForDecoration(decoration, font); + float x = textOrigin.x(); + float y = textOrigin.y() - font.ascent() + positionOffsetForDecoration(decoration, font, thickness); + + context->save(); + context->beginPath(); + context->addPath(Path::createRectangle(FloatRect(x, y, m_currentChunkPart.width, thickness))); - float halfThickness = thickness / 2.0f; - return Path::createRectangle(FloatRect(x + halfThickness, y, width - 2.0f * halfThickness, thickness)); + if (acquirePaintingResource(context, decorationStyle)) + releasePaintingResource(context); + + context->restore(); } -void SVGInlineTextBox::paintDecoration(ETextDecoration decoration, GraphicsContext* context, int tx, int ty, int width, const SVGChar& svgChar, const SVGTextDecorationInfo& info) +void SVGInlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* style) { - if (renderer()->style()->visibility() != VISIBLE) + // See if we have a selection to paint at all. + int startPos, endPos; + selectionStartEnd(startPos, endPos); + if (startPos >= endPos) return; - // This function does NOT accept combinated text decorations. It's meant to be invoked for just one. - ASSERT(decoration == TDNONE || decoration == UNDERLINE || decoration == OVERLINE || decoration == LINE_THROUGH || decoration == BLINK); - - bool isFilled = info.fillServerMap.contains(decoration); - bool isStroked = info.strokeServerMap.contains(decoration); - - if (!isFilled && !isStroked) + Color backgroundColor = renderer()->selectionBackgroundColor(); + if (!backgroundColor.isValid() || !backgroundColor.alpha()) return; - int baseline = renderer()->style(m_firstLine)->font().ascent(); - if (decoration == UNDERLINE) - ty += baseline; - else if (decoration == LINE_THROUGH) - ty += 2 * baseline / 3; + const Font& font = style->font(); + + FloatPoint selectionOrigin = textOrigin; + selectionOrigin.move(0, -font.ascent()); context->save(); - context->beginPath(); + context->setFillColor(backgroundColor, style->colorSpace()); + context->fillRect(font.selectionRectForText(constructTextRun(style), selectionOrigin, m_currentChunkPart.height, startPos, endPos), backgroundColor, style->colorSpace()); + context->restore(); +} - AffineTransform ctm = svgChar.characterTransform(); - if (!ctm.isIdentity()) - context->concatCTM(ctm); +void SVGInlineTextBox::paintText(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* style, RenderStyle* selectionStyle, bool hasSelection, bool paintSelectedTextOnly) +{ + ASSERT(style); + ASSERT(selectionStyle); + ASSERT(m_currentChunkPart.isValid()); - if (isFilled) { - if (RenderObject* fillObject = info.fillServerMap.get(decoration)) { - if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(fillObject, fillObject->style())) { - context->addPath(pathForDecoration(decoration, fillObject, tx, ty, width)); - if (fillPaintingResource->applyResource(fillObject, fillObject->style(), context, ApplyToFillMode)) - fillPaintingResource->postApplyResource(fillObject, context, ApplyToFillMode); - } + int startPos = 0; + int endPos = 0; + selectionStartEnd(startPos, endPos); + + const Font& font = style->font(); + TextRun textRun(constructTextRun(style)); + + // Fast path if there is no selection, just draw the whole chunk part using the regular style + if (!hasSelection || startPos >= endPos) { + if (prepareGraphicsContextForTextPainting(context, textRun, style)) { + font.drawText(context, textRun, textOrigin, 0, m_currentChunkPart.length); + restoreGraphicsContextAfterTextPainting(context, textRun); } + + return; } - if (isStroked) { - if (RenderObject* strokeObject = info.strokeServerMap.get(decoration)) { - if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(strokeObject, strokeObject->style())) { - context->addPath(pathForDecoration(decoration, strokeObject, tx, ty, width)); - if (strokePaintingResource->applyResource(strokeObject, strokeObject->style(), context, ApplyToStrokeMode)) - strokePaintingResource->postApplyResource(strokeObject, context, ApplyToStrokeMode); - } + // Eventually draw text using regular style until the start position of the selection + if (startPos > 0 && !paintSelectedTextOnly) { + if (prepareGraphicsContextForTextPainting(context, textRun, style)) { + font.drawText(context, textRun, textOrigin, 0, startPos); + restoreGraphicsContextAfterTextPainting(context, textRun); } } - context->restore(); + // Draw text using selection style from the start to the end position of the selection + TextRun selectionTextRun(constructTextRun(selectionStyle)); + if (prepareGraphicsContextForTextPainting(context, selectionTextRun, selectionStyle)) { + selectionStyle->font().drawText(context, selectionTextRun, textOrigin, startPos, endPos); + restoreGraphicsContextAfterTextPainting(context, selectionTextRun); + } + + // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part + if (endPos < m_currentChunkPart.length && !paintSelectedTextOnly) { + if (prepareGraphicsContextForTextPainting(context, textRun, style)) { + font.drawText(context, textRun, textOrigin, endPos, m_currentChunkPart.length); + restoreGraphicsContextAfterTextPainting(context, textRun); + } + } } void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGLastGlyphInfo& lastGlyph) @@ -583,7 +614,7 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL RenderText* textRenderer = this->textRenderer(); ASSERT(textRenderer); - RenderStyle* style = textRenderer->style(isFirstLineStyle()); + RenderStyle* style = textRenderer->style(); ASSERT(style); const Font& font = style->font(); @@ -606,20 +637,9 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL float glyphWidth = 0.0f; float glyphHeight = 0.0f; - - int extraCharsAvailable = length - i - 1; - - String unicodeStr; String glyphName; - if (textDirection == RTL) { - glyphWidth = calculateGlyphWidth(style, endPosition - i, extraCharsAvailable, charsConsumed, glyphName); - glyphHeight = calculateGlyphHeight(style, endPosition - i, extraCharsAvailable); - unicodeStr = String(characters + endPosition - i, charsConsumed); - } else { - glyphWidth = calculateGlyphWidth(style, startPosition + i, extraCharsAvailable, charsConsumed, glyphName); - glyphHeight = calculateGlyphHeight(style, startPosition + i, extraCharsAvailable); - unicodeStr = String(characters + startPosition + i, charsConsumed); - } + String unicodeString; + measureCharacter(style, i, charsConsumed, glyphName, unicodeString, glyphWidth, glyphHeight); bool assignedX = false; bool assignedY = false; @@ -682,7 +702,7 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL } // FIXME: SVG Kerning doesn't get applied on texts on path. - bool appliedSVGKerning = applySVGKerning(info, style, lastGlyph, unicodeStr, glyphName, isVerticalText); + bool appliedSVGKerning = applySVGKerning(info, style, lastGlyph, unicodeString, glyphName, isVerticalText); if (info.nextDrawnSeperated || spacing != 0.0f || appliedSVGKerning) { info.nextDrawnSeperated = false; svgChar.drawnSeperated = true; @@ -805,6 +825,38 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL } } +FloatRect SVGInlineTextBox::calculateGlyphBoundaries(RenderStyle* style, int position, const SVGChar& character) const +{ + int charsConsumed = 0; + String glyphName; + String unicodeString; + float glyphWidth = 0.0f; + float glyphHeight = 0.0f; + measureCharacter(style, position, charsConsumed, glyphName, unicodeString, glyphWidth, glyphHeight); + + FloatRect glyphRect(character.x, character.y - style->font().ascent(), glyphWidth, glyphHeight); + glyphRect = character.characterTransform().mapRect(glyphRect); + if (m_chunkTransformation.isIdentity()) + return glyphRect; + + return m_chunkTransformation.mapRect(glyphRect); +} + +IntRect SVGInlineTextBox::calculateBoundaries() const +{ + FloatRect textRect; + int baseline = baselinePosition(true); + + const Vector<SVGTextChunkPart>::const_iterator end = m_svgTextChunkParts.end(); + for (Vector<SVGTextChunkPart>::const_iterator it = m_svgTextChunkParts.begin(); it != end; ++it) + textRect.unite(it->firstCharacter->characterTransform().mapRect(FloatRect(it->firstCharacter->x, it->firstCharacter->y - baseline, it->width, it->height))); + + if (m_chunkTransformation.isIdentity()) + return enclosingIntRect(textRect); + + return enclosingIntRect(m_chunkTransformation.mapRect(textRect)); +} + } // namespace WebCore #endif diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index 77b6498..704b1f5 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 Rob Buis <buis@kde.org> * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 @@ -24,60 +25,77 @@ #if ENABLE(SVG) #include "InlineTextBox.h" -#include "RenderSVGResource.h" +#include "SVGTextChunkLayoutInfo.h" +#include "SVGTextLayoutUtilities.h" namespace WebCore { +class RenderSVGResource; class SVGRootInlineBox; -struct SVGChar; struct SVGCharacterLayoutInfo; struct SVGLastGlyphInfo; -struct SVGTextDecorationInfo; -struct SVGTextPaintInfo; class SVGInlineTextBox : public InlineTextBox { public: - SVGInlineTextBox(RenderObject* obj); + SVGInlineTextBox(RenderObject*); + + virtual bool isSVGInlineTextBox() const { return true; } virtual int virtualHeight() const { return m_height; } - void setHeight(int h) { m_height = h; } + void setHeight(int height) { m_height = height; } virtual int selectionTop() { return m_y; } virtual int selectionHeight() { return m_height; } - virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const; virtual int positionForOffset(int offset) const; - virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); + virtual void paint(RenderObject::PaintInfo&, int tx, int ty); virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos); - // SVGs custom paint text method - void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGTextPaintInfo&); - - // SVGs custom paint selection method - void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font&); + virtual void selectionStartEnd(int& startPos, int& endPos); + void mapStartEndPositionsIntoChunkPartCoordinates(int& startPos, int& endPos, const SVGTextChunkPart&) const; - // SVGs custom paint decoration method - void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&); - SVGRootInlineBox* svgRootInlineBox() const; // Helper functions shared with SVGRootInlineBox - float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; - float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const; - - FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const; - SVGChar* closestCharacterToPosition(int x, int y, int& offset) const; + void measureCharacter(RenderStyle*, int position, int& charsConsumed, String& glyphName, String& unicodeString, float& glyphWidth, float& glyphHeight) const; + FloatRect calculateGlyphBoundaries(RenderStyle*, int position, const SVGChar&) const; void buildLayoutInformation(SVGCharacterLayoutInfo&, SVGLastGlyphInfo&); + const AffineTransform& chunkTransformation() const { return m_chunkTransformation; } + void setChunkTransformation(const AffineTransform& transform) { m_chunkTransformation = transform; } + void addChunkPartInformation(const SVGTextChunkPart& part) { m_svgTextChunkParts.append(part); } + const Vector<SVGTextChunkPart>& svgTextChunkParts() const { return m_svgTextChunkParts; } + + virtual IntRect calculateBoundaries() const; + +private: + TextRun constructTextRun(RenderStyle*) const; + AffineTransform buildChunkTransformation(SVGChar& firstCharacter) const; + + bool acquirePaintingResource(GraphicsContext*&, RenderStyle*); + void releasePaintingResource(GraphicsContext*&); + + bool prepareGraphicsContextForTextPainting(GraphicsContext*&, TextRun&, RenderStyle*); + void restoreGraphicsContextAfterTextPainting(GraphicsContext*&, TextRun&); + + void computeTextMatchMarkerRect(RenderStyle*); + void paintDecoration(GraphicsContext*, const FloatPoint& textOrigin, ETextDecoration, bool hasSelection); + void paintDecorationWithStyle(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, ETextDecoration); + void paintSelection(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*); + void paintText(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, RenderStyle* selectionStyle, bool hasSelection, bool paintSelectedTextOnly); + + FloatRect selectionRectForTextChunkPart(const SVGTextChunkPart&, int partStartPos, int partEndPos, RenderStyle*); + private: - friend class RenderSVGInlineText; - bool svgCharacterHitsPosition(int x, int y, int& offset) const; - bool chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd); - int m_height; + AffineTransform m_chunkTransformation; + Vector<SVGTextChunkPart> m_svgTextChunkParts; + mutable SVGTextChunkPart m_currentChunkPart; + RenderSVGResource* m_paintingResource; + int m_paintingResourceMode; }; } // namespace WebCore diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h index e961c73..dce8b8f 100644 --- a/WebCore/rendering/SVGRenderSupport.h +++ b/WebCore/rendering/SVGRenderSupport.h @@ -21,8 +21,8 @@ * */ -#ifndef SVGRenderBase_h -#define SVGRenderBase_h +#ifndef SVGRenderSupport_h +#define SVGRenderSupport_h #if ENABLE(SVG) #include "DashArray.h" @@ -55,9 +55,6 @@ public: // Helper function determining wheter overflow is hidden static bool isOverflowHidden(const RenderObject*); - // strokeBoundingBox() includes the marker boundaries for a RenderPath object - virtual FloatRect strokeBoundingBox() const { return FloatRect(); } - // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates. void intersectRepaintRectWithResources(const RenderObject*, FloatRect&) const; @@ -93,4 +90,4 @@ const RenderObject* findTextRootObject(const RenderObject* start); #endif // ENABLE(SVG) -#endif // SVGRenderBase_h +#endif // SVGRenderSupport_h diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index 2a71dee..e110ce6 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -598,7 +598,7 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i writeNameValuePair(ts, "filterUnits", filter->filterUnits()); writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); ts << "\n"; - if (OwnPtr<SVGFilterBuilder> builder = filter->buildPrimitives()) { + if (RefPtr<SVGFilterBuilder> builder = filter->buildPrimitives()) { if (FilterEffect* lastEffect = builder->lastEffect()) lastEffect->externalRepresentation(ts, indent + 1); } diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp index 6b750be..8fd71ea 100644 --- a/WebCore/rendering/SVGRootInlineBox.cpp +++ b/WebCore/rendering/SVGRootInlineBox.cpp @@ -22,643 +22,44 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGRootInlineBox.h" +#if ENABLE(SVG) #include "GraphicsContext.h" #include "RenderBlock.h" #include "RenderSVGResourceFilter.h" -#include "RenderSVGRoot.h" #include "SVGInlineFlowBox.h" #include "SVGInlineTextBox.h" #include "SVGRenderSupport.h" #include "SVGTextLayoutUtilities.h" #include "SVGTextPositioningElement.h" -// Text chunk creation is complex and the whole process -// can easily be traced by setting this variable > 0. -#define DEBUG_CHUNK_BUILDING 0 +// Text chunk part propagation can be traced by setting this variable > 0. +#define DEBUG_CHUNK_PART_PROPAGATION 0 namespace WebCore { -static inline void startTextChunk(SVGTextChunkLayoutInfo& info) +void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int, int) { - info.chunk.boxes.clear(); - info.chunk.boxes.append(SVGInlineBoxCharacterRange()); - - info.chunk.start = info.it; - info.assignChunkProperties = true; -} - -static inline void closeTextChunk(SVGTextChunkLayoutInfo& info) -{ - ASSERT(!info.chunk.boxes.last().isOpen()); - ASSERT(info.chunk.boxes.last().isClosed()); - - info.chunk.end = info.it; - ASSERT(info.chunk.end >= info.chunk.start); - - info.svgTextChunks.append(info.chunk); -} - -RenderSVGRoot* findSVGRootObject(RenderObject* start) -{ - // Find associated root inline box. - while (start && !start->isSVGRoot()) - start = start->parent(); - ASSERT(start); - return toRenderSVGRoot(start); -} - -// Helper class for paint() -struct SVGRootInlineBoxPaintWalker { - SVGRootInlineBoxPaintWalker(SVGRootInlineBox* rootBox, RenderObject::PaintInfo paintInfo, int tx, int ty) - : m_rootBox(rootBox) - , m_chunkStarted(false) - , m_paintInfo(paintInfo) - , m_savedInfo(paintInfo) - , m_boundingBox(tx + rootBox->x(), ty + rootBox->y(), rootBox->width(), rootBox->height()) - , m_filter(0) - , m_fillPaintingResource(0) - , m_strokePaintingResource(0) - , m_fillPaintingResourceObject(0) - , m_strokePaintingResourceObject(0) - , m_tx(tx) - , m_ty(ty) - { - } - - ~SVGRootInlineBoxPaintWalker() - { - ASSERT(!m_filter); - ASSERT(!m_fillPaintingResource); - ASSERT(!m_fillPaintingResourceObject); - ASSERT(!m_strokePaintingResource); - ASSERT(!m_strokePaintingResourceObject); - ASSERT(!m_chunkStarted); - } - - bool mayHaveSelection(SVGInlineTextBox* box) const - { - int selectionStart = 0, selectionEnd = 0; - box->selectionStartEnd(selectionStart, selectionEnd); - return selectionStart < selectionEnd; - } - - void teardownFillPaintServer() - { - if (!m_fillPaintingResource) - return; - - m_fillPaintingResource->postApplyResource(m_fillPaintingResourceObject, m_paintInfo.context, ApplyToFillMode | ApplyToTextMode); - m_fillPaintingResource = 0; - m_fillPaintingResourceObject = 0; - } - - void teardownStrokePaintServer() - { - if (!m_strokePaintingResource) - return; - - m_strokePaintingResource->postApplyResource(m_strokePaintingResourceObject, m_paintInfo.context, ApplyToStrokeMode | ApplyToTextMode); - m_strokePaintingResource = 0; - m_strokePaintingResourceObject = 0; - } - - void chunkStartCallback(InlineBox* box) - { - ASSERT(!m_chunkStarted); - m_chunkStarted = true; - - InlineFlowBox* flowBox = box->parent(); - - // Initialize text rendering - RenderObject* object = flowBox->renderer(); - ASSERT(object); - - m_savedInfo = m_paintInfo; - m_paintInfo.context->save(); - - // FIXME: Why is this done here instead of in RenderSVGText? - if (!flowBox->isRootInlineBox()) - SVGRenderBase::prepareToRenderSVGContent(object, m_paintInfo, m_boundingBox, m_filter); - } - - void chunkEndCallback(InlineBox* box) - { - ASSERT(m_chunkStarted); - m_chunkStarted = false; - - InlineFlowBox* flowBox = box->parent(); - - RenderObject* object = flowBox->renderer(); - ASSERT(object); - - // Clean up last used paint server - teardownFillPaintServer(); - teardownStrokePaintServer(); - - // Finalize text rendering - if (!flowBox->isRootInlineBox()) { - SVGRenderBase::finishRenderSVGContent(object, m_paintInfo, m_filter, m_savedInfo.context); - m_filter = 0; - } - - // Restore context & repaint rect - m_paintInfo.context->restore(); - m_paintInfo.rect = m_savedInfo.rect; - } - - bool setupBackground(SVGInlineTextBox*) - { - m_textPaintInfo.subphase = SVGTextPaintSubphaseBackground; - return true; - } - - bool setupFill(SVGInlineTextBox* box) - { - InlineFlowBox* flowBox = box->parent(); - - // Setup fill paint server - RenderObject* object = flowBox->renderer(); - ASSERT(object); - - ASSERT(!m_strokePaintingResource); - teardownFillPaintServer(); - - m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFill; - m_fillPaintingResource = RenderSVGResource::fillPaintingResource(object, object->style()); - if (m_fillPaintingResource) { - m_fillPaintingResource->applyResource(object, object->style(), m_paintInfo.context, ApplyToFillMode | ApplyToTextMode); - m_fillPaintingResourceObject = object; - return true; - } - - return false; - } - - bool setupFillSelection(SVGInlineTextBox* box) - { - InlineFlowBox* flowBox = box->parent(); - - // Setup fill paint server - RenderObject* object = flowBox->renderer(); - ASSERT(object); - RenderStyle* style = object->getCachedPseudoStyle(SELECTION); - if (!style) - style = object->style(); - - ASSERT(!m_strokePaintingResource); - teardownFillPaintServer(); - - if (!mayHaveSelection(box)) - return false; - - m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFillSelection; - m_fillPaintingResource = RenderSVGResource::fillPaintingResource(object, style); - if (m_fillPaintingResource) { - m_fillPaintingResource->applyResource(object, style, m_paintInfo.context, ApplyToFillMode | ApplyToTextMode); - m_fillPaintingResourceObject = object; - return true; - } - - return false; - } - - bool setupStroke(SVGInlineTextBox* box) - { - InlineFlowBox* flowBox = box->parent(); - - // Setup stroke paint server - RenderObject* object = flowBox->renderer(); - ASSERT(object); - - // If we're both stroked & filled, teardown fill paint server before stroking. - teardownFillPaintServer(); - teardownStrokePaintServer(); - - m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStroke; - m_strokePaintingResource = RenderSVGResource::strokePaintingResource(object, object->style()); - if (m_strokePaintingResource) { - m_strokePaintingResource->applyResource(object, object->style(), m_paintInfo.context, ApplyToStrokeMode | ApplyToTextMode); - m_strokePaintingResourceObject = object; - return true; - } - - return false; - } - - bool setupStrokeSelection(SVGInlineTextBox* box) - { - InlineFlowBox* flowBox = box->parent(); - - // Setup stroke paint server - RenderObject* object = flowBox->renderer(); - ASSERT(object); - RenderStyle* style = object->getCachedPseudoStyle(SELECTION); - if (!style) - style = object->style(); - - // If we're both stroked & filled, teardown fill paint server before stroking. - teardownFillPaintServer(); - teardownStrokePaintServer(); - - if (!mayHaveSelection(box)) - return false; - - m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStrokeSelection; - m_strokePaintingResource = RenderSVGResource::strokePaintingResource(object, style); - if (m_strokePaintingResource) { - m_strokePaintingResource->applyResource(object, style, m_paintInfo.context, ApplyToStrokeMode | ApplyToTextMode); - m_strokePaintingResourceObject = object; - return true; - } - - return false; - } - - bool setupForeground(SVGInlineTextBox*) - { - teardownFillPaintServer(); - teardownStrokePaintServer(); - - m_textPaintInfo.subphase = SVGTextPaintSubphaseForeground; - - return true; - } - - RenderSVGResource* activePaintingResource() const - { - switch (m_textPaintInfo.subphase) { - case SVGTextPaintSubphaseGlyphFill: - case SVGTextPaintSubphaseGlyphFillSelection: - ASSERT(m_fillPaintingResource); - return m_fillPaintingResource; - case SVGTextPaintSubphaseGlyphStroke: - case SVGTextPaintSubphaseGlyphStrokeSelection: - ASSERT(m_strokePaintingResource); - return m_strokePaintingResource; - case SVGTextPaintSubphaseBackground: - case SVGTextPaintSubphaseForeground: - default: - return 0; - } - } - - void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - if (setupBackground(textBox)) - paintChunk(textBox, startOffset, chunkCtm, start, end); - - if (setupFill(textBox)) - paintChunk(textBox, startOffset, chunkCtm, start, end); - - if (setupFillSelection(textBox)) - paintChunk(textBox, startOffset, chunkCtm, start, end); + ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); + ASSERT(!paintInfo.context->paintingDisabled()); - if (setupStroke(textBox)) - paintChunk(textBox, startOffset, chunkCtm, start, end); + RenderObject* boxRenderer = renderer(); + ASSERT(boxRenderer); - if (setupStrokeSelection(textBox)) - paintChunk(textBox, startOffset, chunkCtm, start, end); + RenderObject::PaintInfo childPaintInfo(paintInfo); + childPaintInfo.context->save(); - if (setupForeground(textBox)) - paintChunk(textBox, startOffset, chunkCtm, start, end); - } - - void paintChunk(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - RenderText* text = textBox->textRenderer(); - ASSERT(text); - - RenderStyle* styleToUse = text->style(textBox->isFirstLineStyle()); - ASSERT(styleToUse); - - startOffset += textBox->start(); - - int textDecorations = styleToUse->textDecorationsInEffect(); - - int textWidth = 0; - IntPoint decorationOrigin; - SVGTextDecorationInfo info; - - if (!chunkCtm.isIdentity()) - m_paintInfo.context->concatCTM(chunkCtm); - - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (it->isHidden()) - continue; - - // Determine how many characters - starting from the current - can be drawn at once. - Vector<SVGChar>::iterator itSearch = it + 1; - while (itSearch != end) { - if (itSearch->drawnSeperated || itSearch->isHidden()) - break; - - itSearch++; - } - - const UChar* stringStart = text->characters() + startOffset + (it - start); - unsigned int stringLength = itSearch - it; - - // Paint decorations, that have to be drawn before the text gets drawn - if (textDecorations != TDNONE && m_paintInfo.phase != PaintPhaseSelection) { - textWidth = styleToUse->font().width(svgTextRunForInlineTextBox(stringStart, stringLength, styleToUse, textBox, (*it).x)); - decorationOrigin = IntPoint((int) (*it).x, (int) (*it).y - styleToUse->font().ascent()); - info = m_rootBox->retrievePaintServersForTextDecoration(text); - } - - if (textDecorations & UNDERLINE && textWidth != 0.0f) - textBox->paintDecoration(UNDERLINE, m_paintInfo.context, decorationOrigin.x(), decorationOrigin.y(), textWidth, *it, info); - - if (textDecorations & OVERLINE && textWidth != 0.0f) - textBox->paintDecoration(OVERLINE, m_paintInfo.context, decorationOrigin.x(), decorationOrigin.y(), textWidth, *it, info); - - // Paint text - m_textPaintInfo.activePaintingResource = activePaintingResource(); - textBox->paintCharacters(m_paintInfo, m_tx, m_ty, *it, stringStart, stringLength, m_textPaintInfo); - - // Paint decorations, that have to be drawn afterwards - if (textDecorations & LINE_THROUGH && textWidth != 0.0f) - textBox->paintDecoration(LINE_THROUGH, m_paintInfo.context, decorationOrigin.x(), decorationOrigin.y(), textWidth, *it, info); - - // Skip processed characters - it = itSearch - 1; - } - - if (!chunkCtm.isIdentity()) - m_paintInfo.context->concatCTM(chunkCtm.inverse()); - } - -private: - SVGRootInlineBox* m_rootBox; - bool m_chunkStarted : 1; - - RenderObject::PaintInfo m_paintInfo; - RenderObject::PaintInfo m_savedInfo; - - FloatRect m_boundingBox; - RenderSVGResourceFilter* m_filter; - - RenderSVGResource* m_fillPaintingResource; - RenderSVGResource* m_strokePaintingResource; - - RenderObject* m_fillPaintingResourceObject; - RenderObject* m_strokePaintingResourceObject; - - int m_tx; - int m_ty; - - SVGTextPaintInfo m_textPaintInfo; -}; - -void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) -{ - if (paintInfo.context->paintingDisabled() || paintInfo.phase != PaintPhaseForeground) - return; - - RenderObject::PaintInfo savedInfo(paintInfo); - paintInfo.context->save(); + FloatRect repaintRect = boxRenderer->repaintRectInLocalCoordinates(); RenderSVGResourceFilter* filter = 0; - FloatRect boundingBox(tx + x(), ty + y(), width(), height()); - - // Initialize text rendering - if (SVGRenderBase::prepareToRenderSVGContent(renderer(), paintInfo, boundingBox, filter)) { - // Render text, chunk-by-chunk - SVGRootInlineBoxPaintWalker walkerCallback(this, paintInfo, tx, ty); - SVGTextChunkWalker<SVGRootInlineBoxPaintWalker> walker(&walkerCallback, - &SVGRootInlineBoxPaintWalker::chunkPortionCallback, - &SVGRootInlineBoxPaintWalker::chunkStartCallback, - &SVGRootInlineBoxPaintWalker::chunkEndCallback); - - walkTextChunks(&walker); - } - - // Finalize text rendering - SVGRenderBase::finishRenderSVGContent(renderer(), paintInfo, filter, savedInfo.context); - paintInfo.context->restore(); -} - -int SVGRootInlineBox::placeBoxesHorizontally(int, int& leftPosition, int& rightPosition, bool&, GlyphOverflowAndFallbackFontsMap&) -{ - // Remove any offsets caused by RTL text layout - leftPosition = 0; - rightPosition = 0; - return 0; -} - -int SVGRootInlineBox::verticallyAlignBoxes(int, GlyphOverflowAndFallbackFontsMap&) -{ - // height is set by layoutInlineBoxes. - return height(); -} - -static float cummulatedWidthOrHeightOfTextChunk(SVGTextChunk& chunk, bool calcWidthOnly) -{ - float length = 0.0f; - Vector<SVGChar>::iterator charIt = chunk.start; - - Vector<SVGInlineBoxCharacterRange>::iterator it = chunk.boxes.begin(); - Vector<SVGInlineBoxCharacterRange>::iterator end = chunk.boxes.end(); - - for (; it != end; ++it) { - SVGInlineBoxCharacterRange& range = *it; - - SVGInlineTextBox* box = static_cast<SVGInlineTextBox*>(range.box); - RenderStyle* style = box->renderer()->style(); - - for (int i = range.startOffset; i < range.endOffset; ++i) { - ASSERT(charIt <= chunk.end); - - // Determine how many characters - starting from the current - can be measured at once. - // Important for non-absolute positioned non-latin1 text (ie. Arabic) where ie. the width - // of a string is not the sum of the boundaries of all contained glyphs. - Vector<SVGChar>::iterator itSearch = charIt + 1; - Vector<SVGChar>::iterator endSearch = charIt + range.endOffset - i; - while (itSearch != endSearch) { - // No need to check for 'isHidden()' here as this function is not called for text paths. - if (itSearch->drawnSeperated) - break; - - itSearch++; - } - - unsigned int positionOffset = itSearch - charIt; - - // Calculate width/height of subrange - SVGInlineBoxCharacterRange subRange; - subRange.box = range.box; - subRange.startOffset = i; - subRange.endOffset = i + positionOffset; - - if (calcWidthOnly) - length += cummulatedWidthOfInlineBoxCharacterRange(subRange); - else - length += cummulatedHeightOfInlineBoxCharacterRange(subRange); - - // Calculate gap between the previous & current range - // <text x="10 50 70">ABCD</text> - we need to take the gaps between A & B into account - // so add "40" as width, and analogous for B & C, add "20" as width. - if (itSearch > chunk.start && itSearch < chunk.end) { - SVGChar& lastCharacter = *(itSearch - 1); - SVGChar& currentCharacter = *itSearch; - - int offset = box->direction() == RTL ? box->end() - i - positionOffset + 1 : box->start() + i + positionOffset - 1; - - // FIXME: does this need to change to handle multichar glyphs? - int charsConsumed = 1; - String glyphName; - if (calcWidthOnly) { - float lastGlyphWidth = box->calculateGlyphWidth(style, offset, 0, charsConsumed, glyphName); - length += currentCharacter.x - lastCharacter.x - lastGlyphWidth; - } else { - float lastGlyphHeight = box->calculateGlyphHeight(style, offset, 0); - length += currentCharacter.y - lastCharacter.y - lastGlyphHeight; - } - } - - // Advance processed characters - i += positionOffset - 1; - charIt = itSearch; - } - } - - ASSERT(charIt == chunk.end); - return length; -} - -static float cummulatedWidthOfTextChunk(SVGTextChunk& chunk) -{ - return cummulatedWidthOrHeightOfTextChunk(chunk, true); -} - -static float cummulatedHeightOfTextChunk(SVGTextChunk& chunk) -{ - return cummulatedWidthOrHeightOfTextChunk(chunk, false); -} - -static float calculateTextAnchorShiftForTextChunk(SVGTextChunk& chunk, ETextAnchor anchor) -{ - float shift = 0.0f; - - if (chunk.isVerticalText) - shift = cummulatedHeightOfTextChunk(chunk); - else - shift = cummulatedWidthOfTextChunk(chunk); - - if (anchor == TA_MIDDLE) - shift *= -0.5f; - else - shift *= -1.0f; - - return shift; -} - -static void applyTextAnchorToTextChunk(SVGTextChunk& chunk) -{ - // This method is not called for chunks containing chars aligned on a path. - // -> all characters are visible, no need to check for "isHidden()" anywhere. - - if (chunk.anchor == TA_START) - return; - - float shift = calculateTextAnchorShiftForTextChunk(chunk, chunk.anchor); - - // Apply correction to chunk - Vector<SVGChar>::iterator chunkIt = chunk.start; - for (; chunkIt != chunk.end; ++chunkIt) { - SVGChar& curChar = *chunkIt; - - if (chunk.isVerticalText) - curChar.y += shift; - else - curChar.x += shift; - } - - // Move inline boxes - Vector<SVGInlineBoxCharacterRange>::iterator boxIt = chunk.boxes.begin(); - Vector<SVGInlineBoxCharacterRange>::iterator boxEnd = chunk.boxes.end(); - - for (; boxIt != boxEnd; ++boxIt) { - SVGInlineBoxCharacterRange& range = *boxIt; - - InlineBox* curBox = range.box; - ASSERT(curBox->isInlineTextBox()); - - // Move target box - if (chunk.isVerticalText) - curBox->setY(curBox->y() + static_cast<int>(shift)); - else - curBox->setX(curBox->x() + static_cast<int>(shift)); - } -} - -static float calculateTextLengthCorrectionForTextChunk(SVGTextChunk& chunk, ELengthAdjust lengthAdjust, float& computedLength) -{ - if (chunk.textLength <= 0.0f) - return 0.0f; - - float computedWidth = cummulatedWidthOfTextChunk(chunk); - float computedHeight = cummulatedHeightOfTextChunk(chunk); - - if ((computedWidth <= 0.0f && !chunk.isVerticalText) - || (computedHeight <= 0.0f && chunk.isVerticalText)) - return 0.0f; - - if (chunk.isVerticalText) - computedLength = computedHeight; - else - computedLength = computedWidth; - - if (lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS) { - if (chunk.isVerticalText) - chunk.ctm.scaleNonUniform(1.0f, chunk.textLength / computedLength); - else - chunk.ctm.scaleNonUniform(chunk.textLength / computedLength, 1.0f); - - return 0.0f; + if (SVGRenderBase::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) { + for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) + child->paint(childPaintInfo, 0, 0); } - return (chunk.textLength - computedLength) / float(chunk.end - chunk.start); -} - -static void applyTextLengthCorrectionToTextChunk(SVGTextChunk& chunk) -{ - // This method is not called for chunks containing chars aligned on a path. - // -> all characters are visible, no need to check for "isHidden()" anywhere. - - // lengthAdjust="spacingAndGlyphs" is handled by modifying chunk.ctm - float computedLength = 0.0f; - float spacingToApply = calculateTextLengthCorrectionForTextChunk(chunk, chunk.lengthAdjust, computedLength); - - if (!chunk.ctm.isIdentity() && chunk.lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS) { - SVGChar& firstChar = *(chunk.start); - - // Assure we apply the chunk scaling in the right origin - AffineTransform newChunkCtm(chunk.ctm); - newChunkCtm.translateRight(firstChar.x, firstChar.y); - newChunkCtm.translate(-firstChar.x, -firstChar.y); - - chunk.ctm = newChunkCtm; - } - - // Apply correction to chunk - if (spacingToApply != 0.0f) { - Vector<SVGChar>::iterator chunkIt = chunk.start; - for (; chunkIt != chunk.end; ++chunkIt) { - SVGChar& curChar = *chunkIt; - curChar.drawnSeperated = true; - - if (chunk.isVerticalText) - curChar.y += (chunkIt - chunk.start) * spacingToApply; - else - curChar.x += (chunkIt - chunk.start) * spacingToApply; - } - } + SVGRenderBase::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context); + childPaintInfo.context->restore(); } void SVGRootInlineBox::computePerCharacterLayoutInformation() @@ -668,26 +69,29 @@ void SVGRootInlineBox::computePerCharacterLayoutInformation() m_svgTextChunks.clear(); // Build layout information for all contained render objects - SVGCharacterLayoutInfo info(m_svgChars); - buildLayoutInformation(this, info); + SVGCharacterLayoutInfo charInfo; + buildLayoutInformation(this, charInfo); + m_svgChars = charInfo.svgChars; // Now all layout information are available for every character // contained in any of our child inline/flow boxes. Build list // of text chunks now, to be able to apply text-anchor shifts. - buildTextChunks(m_svgChars, m_svgTextChunks, this); + SVGTextChunkLayoutInfo chunkInfo; + chunkInfo.buildTextChunks(m_svgChars.begin(), m_svgChars.end(), this); // Layout all text chunks // text-anchor needs to be applied to individual chunks. - layoutTextChunks(); + chunkInfo.layoutTextChunks(); + m_svgTextChunks = chunkInfo.textChunks(); - // Finally the top left position of our box is known. - // Propogate this knownledge to our RenderSVGText parent. - FloatPoint topLeft = topLeftPositionOfCharacterRange(m_svgChars.begin(), m_svgChars.end()); - block()->setLocation((int) floorf(topLeft.x()), (int) floorf(topLeft.y())); + // Propagate text chunk part information to all SVGInlineTextBoxes, see SVGTextChunkLayoutInfo.h for details + propagateTextChunkPartInformation(); - // Layout all InlineText/Flow boxes - // BEWARE: This requires the root top/left position to be set correctly before! - layoutInlineBoxes(); + // Layout all child boxes. + layoutChildBoxes(this); + + // Resize our root box and our RenderSVGText parent block + layoutRootBox(); } void SVGRootInlineBox::buildLayoutInformation(InlineFlowBox* start, SVGCharacterLayoutInfo& info) @@ -711,8 +115,9 @@ void SVGRootInlineBox::buildLayoutInformation(InlineFlowBox* start, SVGCharacter ASSERT(curr->isInlineFlowBox()); InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(curr); + // Skip generated content. if (!flowBox->renderer()->node()) - continue; // Skip generated content. + continue; bool isAnchor = flowBox->renderer()->node()->hasTagName(SVGNames::aTag); bool isTextPath = flowBox->renderer()->node()->hasTagName(SVGNames::textPathTag); @@ -740,13 +145,14 @@ void SVGRootInlineBox::buildLayoutInformation(InlineFlowBox* start, SVGCharacter // Initialize sub-layout. We need to create text chunks from the textPath // children using our standard layout code, to be able to measure the // text length using our normal methods and not textPath specific hacks. - Vector<SVGChar> tempChars; Vector<SVGTextChunk> tempChunks; - SVGCharacterLayoutInfo tempInfo(tempChars); - buildLayoutInformation(flowBox, tempInfo); + SVGCharacterLayoutInfo tempCharInfo; + buildLayoutInformation(flowBox, tempCharInfo); - buildTextChunks(tempChars, tempChunks, flowBox); + SVGTextChunkLayoutInfo tempChunkInfo; + tempChunkInfo.buildTextChunks(tempCharInfo.svgChars.begin(), tempCharInfo.svgChars.end(), flowBox); + tempChunks = tempChunkInfo.textChunks(); Vector<SVGTextChunk>::iterator it = tempChunks.begin(); Vector<SVGTextChunk>::iterator end = tempChunks.end(); @@ -786,467 +192,175 @@ void SVGRootInlineBox::buildLayoutInformation(InlineFlowBox* start, SVGCharacter } } -void SVGRootInlineBox::layoutInlineBoxes() +void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start) { - int lowX = INT_MAX; - int lowY = INT_MAX; - int highX = INT_MIN; - int highY = INT_MIN; - - // Layout all child boxes - Vector<SVGChar>::iterator it = m_svgChars.begin(); - layoutInlineBoxes(this, it, lowX, highX, lowY, highY); - ASSERT(it == m_svgChars.end()); -} - -void SVGRootInlineBox::layoutInlineBoxes(InlineFlowBox* start, Vector<SVGChar>::iterator& it, int& lowX, int& highX, int& lowY, int& highY) -{ - for (InlineBox* curr = start->firstChild(); curr; curr = curr->nextOnLine()) { - RenderStyle* style = curr->renderer()->style(); - if (curr->renderer()->isText()) { - SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(curr); - unsigned length = textBox->len(); - - SVGChar curChar = *it; - ASSERT(it != m_svgChars.end()); - - FloatRect stringRect; - for (unsigned i = 0; i < length; ++i) { - ASSERT(it != m_svgChars.end()); - - if (it->isHidden()) { - ++it; - continue; - } - - stringRect.unite(textBox->calculateGlyphBoundaries(style, textBox->start() + i, *it)); - ++it; - } - - IntRect enclosedStringRect = enclosingIntRect(stringRect); - - int minX = enclosedStringRect.x(); - int maxX = minX + enclosedStringRect.width(); - - int minY = enclosedStringRect.y(); - int maxY = minY + enclosedStringRect.height(); - - curr->setX(minX - block()->x()); - curr->setWidth(enclosedStringRect.width()); - - curr->setY(minY - block()->y()); - textBox->setHeight(enclosedStringRect.height()); - - if (minX < lowX) - lowX = minX; - - if (maxX > highX) - highX = maxX; - - if (minY < lowY) - lowY = minY; - - if (maxY > highY) - highY = maxY; + for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { + if (child->renderer()->isText()) { + SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(child); + IntRect boxRect = textBox->calculateBoundaries(); + textBox->setX(boxRect.x()); + textBox->setY(boxRect.y()); + textBox->setWidth(boxRect.width()); + textBox->setHeight(boxRect.height()); } else { - ASSERT(curr->isInlineFlowBox()); - - int minX = INT_MAX; - int minY = INT_MAX; - int maxX = INT_MIN; - int maxY = INT_MIN; - - InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(curr); - - if (!flowBox->renderer()->node()) - continue; // Skip generated content. - - layoutInlineBoxes(flowBox, it, minX, maxX, minY, maxY); - - curr->setX(minX - block()->x()); - curr->setWidth(maxX - minX); - - curr->setY(minY - block()->y()); - static_cast<SVGInlineFlowBox*>(curr)->setHeight(maxY - minY); - - if (minX < lowX) - lowX = minX; - - if (maxX > highX) - highX = maxX; + ASSERT(child->isInlineFlowBox()); + + // Skip generated content. + if (!child->renderer()->node()) + continue; - if (minY < lowY) - lowY = minY; + SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child); + layoutChildBoxes(flowBox); - if (maxY > highY) - highY = maxY; + IntRect boxRect = flowBox->calculateBoundaries(); + flowBox->setX(boxRect.x()); + flowBox->setY(boxRect.y()); + flowBox->setWidth(boxRect.width()); + flowBox->setHeight(boxRect.height()); } } +} - if (start->isSVGRootInlineBox()) { - int top = lowY - block()->y(); - int bottom = highY - block()->y(); +void SVGRootInlineBox::layoutRootBox() +{ + RenderBlock* parentBlock = block(); + ASSERT(parentBlock); - start->setX(lowX - block()->x()); - start->setY(top); + IntRect childRect; + for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { + // Skip generated content. + if (!child->renderer()->node()) + continue; + childRect.unite(child->calculateBoundaries()); + } - start->setWidth(highX - lowX); - static_cast<SVGRootInlineBox*>(start)->setHeight(highY - lowY); + int xBlock = childRect.x(); + int yBlock = childRect.y(); + int widthBlock = childRect.width(); + int heightBlock = childRect.height(); - GlyphOverflowAndFallbackFontsMap textBoxDataMap; - start->computeVerticalOverflow(top, bottom, true, textBoxDataMap); - static_cast<SVGRootInlineBox*>(start)->setLineTopBottomPositions(top, bottom); - } -} + // Finally, assign the root block position, now that all content is laid out. + parentBlock->setLocation(xBlock, yBlock); + parentBlock->setWidth(widthBlock); + parentBlock->setHeight(heightBlock); -void SVGRootInlineBox::buildTextChunks(Vector<SVGChar>& svgChars, Vector<SVGTextChunk>& svgTextChunks, InlineFlowBox* start) -{ - SVGTextChunkLayoutInfo info(svgTextChunks); - info.it = svgChars.begin(); - info.chunk.start = svgChars.begin(); - info.chunk.end = svgChars.begin(); + // Position all children relative to the parent block. + for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { + // Skip generated content. + if (!child->renderer()->node()) + continue; + child->adjustPosition(-xBlock, -yBlock); + } - buildTextChunks(svgChars, start, info); - ASSERT(info.it == svgChars.end()); + // Position ourselves. + setX(0); + setY(0); + setWidth(widthBlock); + setHeight(heightBlock); + setBlockHeight(heightBlock); + setLineTopBottomPositions(0, heightBlock); } -void SVGRootInlineBox::buildTextChunks(Vector<SVGChar>& svgChars, InlineFlowBox* start, SVGTextChunkLayoutInfo& info) +void SVGRootInlineBox::propagateTextChunkPartInformation() { -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> buildTextChunks(start=%p)\n", start); +#if DEBUG_CHUNK_PART_PROPAGATION > 0 + ListHashSet<SVGInlineTextBox*> boxes; #endif - for (InlineBox* curr = start->firstChild(); curr; curr = curr->nextOnLine()) { - if (curr->renderer()->isText()) { - InlineTextBox* textBox = static_cast<InlineTextBox*>(curr); + // Loop through all text chunks + const Vector<SVGTextChunk>::const_iterator end = m_svgTextChunks.end(); + for (Vector<SVGTextChunk>::const_iterator it = m_svgTextChunks.begin(); it != end; ++it) { + const SVGTextChunk& chunk = *it; + int processedChunkCharacters = 0; - unsigned length = textBox->len(); - if (!length) - continue; + // Loop through all ranges contained in this chunk + const Vector<SVGInlineBoxCharacterRange>::const_iterator boxEnd = chunk.boxes.end(); + for (Vector<SVGInlineBoxCharacterRange>::const_iterator boxIt = chunk.boxes.begin(); boxIt != boxEnd; ++boxIt) { + const SVGInlineBoxCharacterRange& range = *boxIt; + ASSERT(range.box->isSVGInlineTextBox()); -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Handle inline text box (%p) with %i characters (start: %i, end: %i), handlingTextPath=%i\n", - textBox, length, textBox->start(), textBox->end(), (int) info.handlingTextPath); -#endif + // Access style & font information of this text box + SVGInlineTextBox* rangeTextBox = static_cast<SVGInlineTextBox*>(range.box); + rangeTextBox->setChunkTransformation(chunk.ctm); - RenderText* text = textBox->textRenderer(); + RenderText* text = rangeTextBox->textRenderer(); ASSERT(text); - ASSERT(text->node()); - SVGTextContentElement* textContent = 0; - Node* node = text->node()->parent(); - while (node && node->isSVGElement() && !textContent) { - if (static_cast<SVGElement*>(node)->isTextContent()) - textContent = static_cast<SVGTextContentElement*>(node); - else - node = node->parentNode(); - } - ASSERT(textContent); - - // Start new character range for the first chunk - bool isFirstCharacter = info.svgTextChunks.isEmpty() && info.chunk.start == info.it && info.chunk.start == info.chunk.end; - if (isFirstCharacter) { - ASSERT(info.chunk.boxes.isEmpty()); - info.chunk.boxes.append(SVGInlineBoxCharacterRange()); - } else - ASSERT(!info.chunk.boxes.isEmpty()); - - // Walk string to find out new chunk positions, if existent - for (unsigned i = 0; i < length; ++i) { - ASSERT(info.it != svgChars.end()); - - SVGInlineBoxCharacterRange& range = info.chunk.boxes.last(); - if (range.isOpen()) { - range.box = curr; - range.startOffset = i == 0 ? 0 : i - 1; - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " | -> Range is open! box=%p, startOffset=%i\n", range.box, range.startOffset); -#endif - } + RenderStyle* style = text->style(); + ASSERT(style); - // If a new (or the first) chunk has been started, record it's text-anchor and writing mode. - if (info.assignChunkProperties) { - info.assignChunkProperties = false; - - info.chunk.isVerticalText = isVerticalWritingMode(text->style()->svgStyle()); - info.chunk.isTextPath = info.handlingTextPath; - info.chunk.anchor = text->style()->svgStyle()->textAnchor(); - info.chunk.textLength = textContent->textLength().value(textContent); - info.chunk.lengthAdjust = (ELengthAdjust) textContent->lengthAdjust(); - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " | -> Assign chunk properties, isVerticalText=%i, anchor=%i\n", info.chunk.isVerticalText, info.chunk.anchor); -#endif + const Font& font = style->font(); + + // Figure out first and last character of this range in this chunk + int rangeLength = range.endOffset - range.startOffset; + Vector<SVGChar>::iterator itCharBegin = chunk.start + processedChunkCharacters; + Vector<SVGChar>::iterator itCharEnd = chunk.start + processedChunkCharacters + rangeLength; + ASSERT(itCharEnd <= chunk.end); + + // Loop through all characters in range + int processedRangeCharacters = 0; + for (Vector<SVGChar>::iterator itChar = itCharBegin; itChar != itCharEnd; ++itChar) { + if (itChar->isHidden()) { + ++processedRangeCharacters; + continue; } - if (i > 0 && !isFirstCharacter && (*info.it).newTextChunk) { - // Close mid chunk & character range - ASSERT(!range.isOpen()); - ASSERT(!range.isClosed()); + // Determine how many characters - starting from the current - can be drawn at once. + Vector<SVGChar>::iterator itSearch = itChar + 1; + while (itSearch != itCharEnd) { + if (itSearch->drawnSeperated || itSearch->isHidden()) + break; - range.endOffset = i; - closeTextChunk(info); - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " | -> Close mid-text chunk, at endOffset: %i and starting new mid chunk!\n", range.endOffset); -#endif - - // Prepare for next chunk, if we're not at the end - startTextChunk(info); - if (i + 1 == length) { -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " | -> Record last chunk of inline text box!\n"); -#endif - - startTextChunk(info); - SVGInlineBoxCharacterRange& range = info.chunk.boxes.last(); - - info.assignChunkProperties = false; - info.chunk.isVerticalText = isVerticalWritingMode(text->style()->svgStyle()); - info.chunk.isTextPath = info.handlingTextPath; - info.chunk.anchor = text->style()->svgStyle()->textAnchor(); - info.chunk.textLength = textContent->textLength().value(textContent); - info.chunk.lengthAdjust = (ELengthAdjust) textContent->lengthAdjust(); - - range.box = curr; - range.startOffset = i; - - ASSERT(!range.isOpen()); - ASSERT(!range.isClosed()); - } + ++itSearch; } - // This should only hold true for the first character of the first chunk - if (isFirstCharacter) - isFirstCharacter = false; - - ++info.it; - } - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Finished inline text box!\n"); -#endif - - SVGInlineBoxCharacterRange& range = info.chunk.boxes.last(); - if (!range.isOpen() && !range.isClosed()) { -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Last range not closed - closing with endOffset: %i\n", length); -#endif + // Calculate text chunk part information for this chunk sub-range + const UChar* partStart = text->characters() + rangeTextBox->start() + range.startOffset + processedRangeCharacters; - // Current text chunk is not yet closed. Finish the current range, but don't start a new chunk. - range.endOffset = length; + SVGTextChunkPart part; + part.firstCharacter = itChar; + part.length = itSearch - itChar; + part.width = font.floatWidth(svgTextRunForInlineTextBox(partStart, part.length, style, rangeTextBox)); + part.height = font.height(); + part.offset = range.startOffset + processedRangeCharacters; + rangeTextBox->addChunkPartInformation(part); + processedRangeCharacters += part.length; - if (info.it != svgChars.end()) { -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Not at last character yet!\n"); -#endif - - // If we're not at the end of the last box to be processed, and if the next - // character starts a new chunk, then close the current chunk and start a new one. - if ((*info.it).newTextChunk) { -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Next character starts new chunk! Closing current chunk, and starting a new one...\n"); -#endif - - closeTextChunk(info); - startTextChunk(info); - } else { - // Just start a new character range - info.chunk.boxes.append(SVGInlineBoxCharacterRange()); - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Next character does NOT start a new chunk! Starting new character range...\n"); -#endif - } - } else { -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Closing final chunk! Finished processing!\n"); -#endif - - // Close final chunk, once we're at the end of the last box - closeTextChunk(info); - } + // Skip processed characters + itChar = itSearch - 1; } - } else { - ASSERT(curr->isInlineFlowBox()); - InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(curr); - - if (!flowBox->renderer()->node()) - continue; // Skip generated content. - - bool isTextPath = flowBox->renderer()->node()->hasTagName(SVGNames::textPathTag); - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " -> Handle inline flow box (%p), isTextPath=%i\n", flowBox, (int) isTextPath); -#endif - if (isTextPath) - info.handlingTextPath = true; - - buildTextChunks(svgChars, flowBox, info); + ASSERT(processedRangeCharacters == rangeLength); + processedChunkCharacters += rangeLength; - if (isTextPath) - info.handlingTextPath = false; - } - } - -#if DEBUG_CHUNK_BUILDING > 1 - fprintf(stderr, " <- buildTextChunks(start=%p)\n", start); +#if DEBUG_CHUNK_PART_PROPAGATION > 0 + boxes.add(rangeTextBox); #endif -} - -void SVGRootInlineBox::layoutTextChunks() -{ - Vector<SVGTextChunk>::iterator it = m_svgTextChunks.begin(); - Vector<SVGTextChunk>::iterator end = m_svgTextChunks.end(); - - for (; it != end; ++it) { - SVGTextChunk& chunk = *it; - -#if DEBUG_CHUNK_BUILDING > 0 - { - fprintf(stderr, "Handle TEXT CHUNK! anchor=%i, textLength=%f, lengthAdjust=%i, isVerticalText=%i, isTextPath=%i start=%p, end=%p -> dist: %i\n", - (int) chunk.anchor, chunk.textLength, (int) chunk.lengthAdjust, (int) chunk.isVerticalText, - (int) chunk.isTextPath, chunk.start, chunk.end, (unsigned int) (chunk.end - chunk.start)); - - Vector<SVGInlineBoxCharacterRange>::iterator boxIt = chunk.boxes.begin(); - Vector<SVGInlineBoxCharacterRange>::iterator boxEnd = chunk.boxes.end(); - - unsigned int i = 0; - for (; boxIt != boxEnd; ++boxIt) { - SVGInlineBoxCharacterRange& range = *boxIt; - ++i; - fprintf(stderr, " -> RANGE %i STARTOFFSET: %i, ENDOFFSET: %i, BOX: %p\n", i, range.startOffset, range.endOffset, range.box); - } - } -#endif - - if (chunk.isTextPath) - continue; - - // text-path & textLength, with lengthAdjust="spacing" is already handled for textPath layouts. - applyTextLengthCorrectionToTextChunk(chunk); - - // text-anchor is already handled for textPath layouts. - applyTextAnchorToTextChunk(chunk); - } -} - -static inline void addPaintServerToTextDecorationInfo(ETextDecoration decoration, SVGTextDecorationInfo& info, RenderObject* object) -{ - if (object->style()->svgStyle()->hasFill()) - info.fillServerMap.set(decoration, object); - - if (object->style()->svgStyle()->hasStroke()) - info.strokeServerMap.set(decoration, object); -} - -SVGTextDecorationInfo SVGRootInlineBox::retrievePaintServersForTextDecoration(RenderObject* start) -{ - ASSERT(start); - - Vector<RenderObject*> parentChain; - while ((start = start->parent())) { - parentChain.prepend(start); - - // Stop at our direct <text> parent. - if (start->isSVGText()) - break; - } - - Vector<RenderObject*>::iterator it = parentChain.begin(); - Vector<RenderObject*>::iterator end = parentChain.end(); - - SVGTextDecorationInfo info; - - for (; it != end; ++it) { - RenderObject* object = *it; - ASSERT(object); - - RenderStyle* style = object->style(); - ASSERT(style); - - int decorations = style->textDecoration(); - if (decorations != NONE) { - if (decorations & OVERLINE) - addPaintServerToTextDecorationInfo(OVERLINE, info, object); - - if (decorations & UNDERLINE) - addPaintServerToTextDecorationInfo(UNDERLINE, info, object); - - if (decorations & LINE_THROUGH) - addPaintServerToTextDecorationInfo(LINE_THROUGH, info, object); } } - return info; -} - -void SVGRootInlineBox::walkTextChunks(SVGTextChunkWalkerBase* walker, const SVGInlineTextBox* textBox) -{ - ASSERT(walker); - - Vector<SVGTextChunk>::iterator it = m_svgTextChunks.begin(); - Vector<SVGTextChunk>::iterator itEnd = m_svgTextChunks.end(); - - for (; it != itEnd; ++it) { - SVGTextChunk& curChunk = *it; - - Vector<SVGInlineBoxCharacterRange>::iterator boxIt = curChunk.boxes.begin(); - Vector<SVGInlineBoxCharacterRange>::iterator boxEnd = curChunk.boxes.end(); - - InlineBox* lastNotifiedBox = 0; - InlineBox* prevBox = 0; - - unsigned int chunkOffset = 0; - bool startedFirstChunk = false; - - for (; boxIt != boxEnd; ++boxIt) { - SVGInlineBoxCharacterRange& range = *boxIt; - - ASSERT(range.box->isInlineTextBox()); - SVGInlineTextBox* rangeTextBox = static_cast<SVGInlineTextBox*>(range.box); - - if (textBox && rangeTextBox != textBox) { - chunkOffset += range.endOffset - range.startOffset; - continue; - } - - // Eventually notify that we started a new chunk - if (!textBox && !startedFirstChunk) { - startedFirstChunk = true; - - lastNotifiedBox = range.box; - walker->start(range.box); - } else { - // Eventually apply new style, as this chunk spans multiple boxes (with possible different styling) - if (prevBox && prevBox != range.box) { - lastNotifiedBox = range.box; - - walker->end(prevBox); - walker->start(lastNotifiedBox); - } +#if DEBUG_CHUNK_PART_PROPAGATION > 0 + { + fprintf(stderr, "Propagated text chunk part information:\n"); + + ListHashSet<SVGInlineTextBox*>::const_iterator it = boxes.begin(); + const ListHashSet<SVGInlineTextBox*>::const_iterator end = boxes.end(); + + for (; it != end; ++it) { + const SVGInlineTextBox* box = *it; + const Vector<SVGTextChunkPart>& parts = box->svgTextChunkParts(); + + fprintf(stderr, " Box %p contains %i text chunk parts:\n", box, static_cast<int>(parts.size())); + Vector<SVGTextChunkPart>::const_iterator partIt = parts.begin(); + const Vector<SVGTextChunkPart>::const_iterator partEnd = parts.end(); + for (; partIt != partEnd; ++partIt) { + const SVGTextChunkPart& part = *partIt; + fprintf(stderr, " -> firstCharacter x=%lf, y=%lf, offset=%i, length=%i, width=%lf, height=%lf, textRenderer=%p\n" + , part.firstCharacter->x, part.firstCharacter->y, part.offset, part.length, part.width, part.height, box->textRenderer()); } - - unsigned int length = range.endOffset - range.startOffset; - - Vector<SVGChar>::iterator itCharBegin = curChunk.start + chunkOffset; - Vector<SVGChar>::iterator itCharEnd = curChunk.start + chunkOffset + length; - ASSERT(itCharEnd <= curChunk.end); - - // Process this chunk portion - (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd); - - chunkOffset += length; - - if (!textBox) - prevBox = range.box; } - - if (!textBox && startedFirstChunk) - walker->end(lastNotifiedBox); } +#endif } } // namespace WebCore diff --git a/WebCore/rendering/SVGRootInlineBox.h b/WebCore/rendering/SVGRootInlineBox.h index c3e1028..75e85fd 100644 --- a/WebCore/rendering/SVGRootInlineBox.h +++ b/WebCore/rendering/SVGRootInlineBox.h @@ -1,9 +1,8 @@ /* - * This file is part of the WebKit project. - * * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> * (C) 2006 Apple Computer Inc. * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 @@ -34,12 +33,10 @@ namespace WebCore { -class InlineTextBox; -class RenderSVGRoot; class SVGInlineTextBox; -struct SVGLastGlyphInfo; -class SVGRootInlineBox : public RootInlineBox, protected SVGRenderBase { +class SVGRootInlineBox : public RootInlineBox + , protected SVGRenderBase { public: SVGRootInlineBox(RenderObject* obj) : RootInlineBox(obj) @@ -47,39 +44,27 @@ public: { } - virtual bool isSVGRootInlineBox() { return true; } + virtual bool isSVGRootInlineBox() const { return true; } virtual int virtualHeight() const { return m_height; } - void setHeight(int h) { m_height = h; } - - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + void setHeight(int height) { m_height = height; } - virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); - virtual int verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap&); + virtual void paint(RenderObject::PaintInfo&, int tx, int ty); - virtual void computePerCharacterLayoutInformation(); + void computePerCharacterLayoutInformation(); virtual FloatRect objectBoundingBox() const { return FloatRect(); } virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); } - // Used by SVGInlineTextBox + // Used by SVGRenderTreeAsText const Vector<SVGTextChunk>& svgTextChunks() const { return m_svgTextChunks; } - void walkTextChunks(SVGTextChunkWalkerBase*, const SVGInlineTextBox* textBox = 0); - private: - friend struct SVGRootInlineBoxPaintWalker; - - void layoutInlineBoxes(); - void layoutInlineBoxes(InlineFlowBox* start, Vector<SVGChar>::iterator& it, int& minX, int& maxX, int& minY, int& maxY); - + void propagateTextChunkPartInformation(); void buildLayoutInformation(InlineFlowBox* start, SVGCharacterLayoutInfo&); - void buildTextChunks(Vector<SVGChar>&, Vector<SVGTextChunk>&, InlineFlowBox* start); - void buildTextChunks(Vector<SVGChar>&, InlineFlowBox* start, SVGTextChunkLayoutInfo&); - void layoutTextChunks(); - - SVGTextDecorationInfo retrievePaintServersForTextDecoration(RenderObject* start); + void layoutRootBox(); + void layoutChildBoxes(InlineFlowBox* start); private: int m_height; @@ -87,9 +72,6 @@ private: Vector<SVGTextChunk> m_svgTextChunks; }; -// Shared with SVGRenderTreeAsText / SVGInlineTextBox -RenderSVGRoot* findSVGRootObject(RenderObject* start); - } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGTextChunkLayoutInfo.cpp b/WebCore/rendering/SVGTextChunkLayoutInfo.cpp new file mode 100644 index 0000000..a7a6d87 --- /dev/null +++ b/WebCore/rendering/SVGTextChunkLayoutInfo.cpp @@ -0,0 +1,493 @@ +/* + * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 "SVGTextChunkLayoutInfo.h" + +#if ENABLE(SVG) +#include "InlineFlowBox.h" +#include "SVGInlineTextBox.h" +#include "SVGRenderStyle.h" + +// Text chunk creation is complex and the whole process +// can easily be traced by setting this variable > 0. +#define DEBUG_CHUNK_BUILDING 0 + +namespace WebCore { + +static float cummulatedWidthOrHeightOfTextChunk(SVGTextChunk& chunk, bool calcWidthOnly) +{ + float length = 0.0f; + Vector<SVGChar>::iterator charIt = chunk.start; + + Vector<SVGInlineBoxCharacterRange>::iterator it = chunk.boxes.begin(); + Vector<SVGInlineBoxCharacterRange>::iterator end = chunk.boxes.end(); + + for (; it != end; ++it) { + SVGInlineBoxCharacterRange& range = *it; + + SVGInlineTextBox* box = static_cast<SVGInlineTextBox*>(range.box); + RenderStyle* style = box->renderer()->style(); + + for (int i = range.startOffset; i < range.endOffset; ++i) { + ASSERT(charIt <= chunk.end); + + // Determine how many characters - starting from the current - can be measured at once. + // Important for non-absolute positioned non-latin1 text (ie. Arabic) where ie. the width + // of a string is not the sum of the boundaries of all contained glyphs. + Vector<SVGChar>::iterator itSearch = charIt + 1; + Vector<SVGChar>::iterator endSearch = charIt + range.endOffset - i; + while (itSearch != endSearch) { + // No need to check for 'isHidden()' here as this function is not called for text paths. + if (itSearch->drawnSeperated) + break; + + itSearch++; + } + + unsigned int positionOffset = itSearch - charIt; + + // Calculate width/height of subrange + SVGInlineBoxCharacterRange subRange; + subRange.box = range.box; + subRange.startOffset = i; + subRange.endOffset = i + positionOffset; + + if (calcWidthOnly) + length += cummulatedWidthOfInlineBoxCharacterRange(subRange); + else + length += cummulatedHeightOfInlineBoxCharacterRange(subRange); + + // Calculate gap between the previous & current range + // <text x="10 50 70">ABCD</text> - we need to take the gaps between A & B into account + // so add "40" as width, and analogous for B & C, add "20" as width. + if (itSearch > chunk.start && itSearch < chunk.end) { + SVGChar& lastCharacter = *(itSearch - 1); + SVGChar& currentCharacter = *itSearch; + + int charsConsumed = 0; + float glyphWidth = 0.0f; + float glyphHeight = 0.0f; + String glyphName; + String unicodeString; + box->measureCharacter(style, i + positionOffset - 1, charsConsumed, glyphName, unicodeString, glyphWidth, glyphHeight); + + if (calcWidthOnly) + length += currentCharacter.x - lastCharacter.x - glyphWidth; + else + length += currentCharacter.y - lastCharacter.y - glyphHeight; + } + + // Advance processed characters + i += positionOffset - 1; + charIt = itSearch; + } + } + + ASSERT(charIt == chunk.end); + return length; +} + +static float cummulatedWidthOfTextChunk(SVGTextChunk& chunk) +{ + return cummulatedWidthOrHeightOfTextChunk(chunk, true); +} + +static float cummulatedHeightOfTextChunk(SVGTextChunk& chunk) +{ + return cummulatedWidthOrHeightOfTextChunk(chunk, false); +} + +float calculateTextAnchorShiftForTextChunk(SVGTextChunk& chunk, ETextAnchor anchor) +{ + float shift = 0.0f; + + if (chunk.isVerticalText) + shift = cummulatedHeightOfTextChunk(chunk); + else + shift = cummulatedWidthOfTextChunk(chunk); + + if (anchor == TA_MIDDLE) + shift *= -0.5f; + else + shift *= -1.0f; + + return shift; +} + +static void applyTextAnchorToTextChunk(SVGTextChunk& chunk) +{ + // This method is not called for chunks containing chars aligned on a path. + // -> all characters are visible, no need to check for "isHidden()" anywhere. + + if (chunk.anchor == TA_START) + return; + + float shift = calculateTextAnchorShiftForTextChunk(chunk, chunk.anchor); + + // Apply correction to chunk + Vector<SVGChar>::iterator chunkIt = chunk.start; + for (; chunkIt != chunk.end; ++chunkIt) { + SVGChar& curChar = *chunkIt; + + if (chunk.isVerticalText) + curChar.y += shift; + else + curChar.x += shift; + } + + // Move inline boxes + Vector<SVGInlineBoxCharacterRange>::iterator boxIt = chunk.boxes.begin(); + Vector<SVGInlineBoxCharacterRange>::iterator boxEnd = chunk.boxes.end(); + + for (; boxIt != boxEnd; ++boxIt) { + SVGInlineBoxCharacterRange& range = *boxIt; + + InlineBox* curBox = range.box; + ASSERT(curBox->isSVGInlineTextBox()); + + // Move target box + if (chunk.isVerticalText) + curBox->setY(curBox->y() + static_cast<int>(shift)); + else + curBox->setX(curBox->x() + static_cast<int>(shift)); + } +} + +float calculateTextLengthCorrectionForTextChunk(SVGTextChunk& chunk, ELengthAdjust lengthAdjust, float& computedLength) +{ + if (chunk.textLength <= 0.0f) + return 0.0f; + + computedLength = 0.0f; + + float computedWidth = cummulatedWidthOfTextChunk(chunk); + float computedHeight = cummulatedHeightOfTextChunk(chunk); + if ((computedWidth <= 0.0f && !chunk.isVerticalText) + || (computedHeight <= 0.0f && chunk.isVerticalText)) + return 0.0f; + + computedLength = chunk.isVerticalText ? computedHeight : computedWidth; + if (lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS) { + if (chunk.isVerticalText) + chunk.ctm.scaleNonUniform(1.0f, chunk.textLength / computedLength); + else + chunk.ctm.scaleNonUniform(chunk.textLength / computedLength, 1.0f); + + return 0.0f; + } + + return (chunk.textLength - computedLength) / float(chunk.end - chunk.start); +} + +static void applyTextLengthCorrectionToTextChunk(SVGTextChunk& chunk) +{ + // This method is not called for chunks containing chars aligned on a path. + // -> all characters are visible, no need to check for "isHidden()" anywhere. + + // lengthAdjust="spacingAndGlyphs" is handled by setting a scale factor for the whole chunk + float textLength = 0.0f; + float spacingToApply = calculateTextLengthCorrectionForTextChunk(chunk, chunk.lengthAdjust, textLength); + + if (!chunk.ctm.isIdentity() && chunk.lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS) { + SVGChar& firstChar = *(chunk.start); + + // Assure we apply the chunk scaling in the right origin + AffineTransform newChunkCtm(chunk.ctm); + newChunkCtm.translateRight(firstChar.x, firstChar.y); + newChunkCtm.translate(-firstChar.x, -firstChar.y); + + chunk.ctm = newChunkCtm; + } + + // Apply correction to chunk + if (spacingToApply != 0.0f) { + Vector<SVGChar>::iterator chunkIt = chunk.start; + for (; chunkIt != chunk.end; ++chunkIt) { + SVGChar& curChar = *chunkIt; + curChar.drawnSeperated = true; + + if (chunk.isVerticalText) + curChar.y += (chunkIt - chunk.start) * spacingToApply; + else + curChar.x += (chunkIt - chunk.start) * spacingToApply; + } + } +} + +void SVGTextChunkLayoutInfo::startTextChunk() +{ + m_chunk.boxes.clear(); + m_chunk.boxes.append(SVGInlineBoxCharacterRange()); + + m_chunk.start = m_charsIt; + m_assignChunkProperties = true; +} + +void SVGTextChunkLayoutInfo::closeTextChunk() +{ + ASSERT(!m_chunk.boxes.last().isOpen()); + ASSERT(m_chunk.boxes.last().isClosed()); + + m_chunk.end = m_charsIt; + ASSERT(m_chunk.end >= m_chunk.start); + + m_svgTextChunks.append(m_chunk); +} + +void SVGTextChunkLayoutInfo::buildTextChunks(Vector<SVGChar>::iterator begin, Vector<SVGChar>::iterator end, InlineFlowBox* start) +{ + m_charsBegin = begin; + m_charsEnd = end; + + m_charsIt = begin; + m_chunk = SVGTextChunk(begin); + + recursiveBuildTextChunks(start); + ASSERT(m_charsIt == m_charsEnd); +} + +void SVGTextChunkLayoutInfo::recursiveBuildTextChunks(InlineFlowBox* start) +{ +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> buildTextChunks(start=%p)\n", start); +#endif + + for (InlineBox* curr = start->firstChild(); curr; curr = curr->nextOnLine()) { + if (curr->renderer()->isText()) { + InlineTextBox* textBox = static_cast<InlineTextBox*>(curr); + + unsigned length = textBox->len(); + ASSERT(length > 0); + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Handle inline text box (%p) with %i characters (start: %i, end: %i), handlingTextPath=%i\n", + textBox, length, textBox->start(), textBox->end(), (int) m_handlingTextPath); +#endif + + RenderText* text = textBox->textRenderer(); + ASSERT(text); + ASSERT(text->node()); + + SVGTextContentElement* textContent = 0; + Node* node = text->node()->parent(); + while (node && node->isSVGElement() && !textContent) { + if (static_cast<SVGElement*>(node)->isTextContent()) + textContent = static_cast<SVGTextContentElement*>(node); + else + node = node->parentNode(); + } + ASSERT(textContent); + + // Start new character range for the first chunk + bool isFirstCharacter = m_svgTextChunks.isEmpty() && m_chunk.start == m_charsIt && m_chunk.start == m_chunk.end; + if (isFirstCharacter) { + ASSERT(m_chunk.boxes.isEmpty()); + m_chunk.boxes.append(SVGInlineBoxCharacterRange()); + } else + ASSERT(!m_chunk.boxes.isEmpty()); + + // Walk string to find out new chunk positions, if existent + for (unsigned i = 0; i < length; ++i) { + ASSERT(m_charsIt != m_charsEnd); + + SVGInlineBoxCharacterRange& range = m_chunk.boxes.last(); + if (range.isOpen()) { + range.box = curr; + range.startOffset = !i ? 0 : i - 1; + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " | -> Range is open! box=%p, startOffset=%i\n", range.box, range.startOffset); +#endif + } + + // If a new (or the first) chunk has been started, record it's text-anchor and writing mode. + if (m_assignChunkProperties) { + m_assignChunkProperties = false; + + m_chunk.isVerticalText = isVerticalWritingMode(text->style()->svgStyle()); + m_chunk.isTextPath = m_handlingTextPath; + m_chunk.anchor = text->style()->svgStyle()->textAnchor(); + m_chunk.textLength = textContent->textLength().value(textContent); + m_chunk.lengthAdjust = (ELengthAdjust) textContent->lengthAdjust(); + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " | -> Assign chunk properties, isVerticalText=%i, anchor=%i\n", m_chunk.isVerticalText, m_chunk.anchor); +#endif + } + + if (i > 0 && !isFirstCharacter && m_charsIt->newTextChunk) { + // Close mid chunk & character range + ASSERT(!range.isOpen()); + ASSERT(!range.isClosed()); + + range.endOffset = i; + closeTextChunk(); + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " | -> Close mid-text chunk, at endOffset: %i and starting new mid chunk!\n", range.endOffset); +#endif + + // Prepare for next chunk, if we're not at the end + startTextChunk(); + if (i + 1 == length) { +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " | -> Record last chunk of inline text box!\n"); +#endif + + startTextChunk(); + SVGInlineBoxCharacterRange& range = m_chunk.boxes.last(); + + m_assignChunkProperties = false; + m_chunk.isVerticalText = isVerticalWritingMode(text->style()->svgStyle()); + m_chunk.isTextPath = m_handlingTextPath; + m_chunk.anchor = text->style()->svgStyle()->textAnchor(); + m_chunk.textLength = textContent->textLength().value(textContent); + m_chunk.lengthAdjust = (ELengthAdjust) textContent->lengthAdjust(); + + range.box = curr; + range.startOffset = i; + + ASSERT(!range.isOpen()); + ASSERT(!range.isClosed()); + } + } + + // This should only hold true for the first character of the first chunk + if (isFirstCharacter) + isFirstCharacter = false; + + ++m_charsIt; + } + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Finished inline text box!\n"); +#endif + + SVGInlineBoxCharacterRange& range = m_chunk.boxes.last(); + if (!range.isOpen() && !range.isClosed()) { +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Last range not closed - closing with endOffset: %i\n", length); +#endif + + // Current text chunk is not yet closed. Finish the current range, but don't start a new chunk. + range.endOffset = length; + + if (m_charsIt != m_charsEnd) { +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Not at last character yet!\n"); +#endif + + // If we're not at the end of the last box to be processed, and if the next + // character starts a new chunk, then close the current chunk and start a new one. + if (m_charsIt->newTextChunk) { +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Next character starts new chunk! Closing current chunk, and starting a new one...\n"); +#endif + + closeTextChunk(); + startTextChunk(); + } else { + // Just start a new character range + m_chunk.boxes.append(SVGInlineBoxCharacterRange()); + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Next character does NOT start a new chunk! Starting new character range...\n"); +#endif + } + } else { +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Closing final chunk! Finished processing!\n"); +#endif + + // Close final chunk, once we're at the end of the last box + closeTextChunk(); + } + } + } else { + ASSERT(curr->isInlineFlowBox()); + InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(curr); + + // Skip generated content. + if (!flowBox->renderer()->node()) + continue; + + bool isTextPath = flowBox->renderer()->node()->hasTagName(SVGNames::textPathTag); + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " -> Handle inline flow box (%p), isTextPath=%i\n", flowBox, (int) isTextPath); +#endif + + if (isTextPath) + m_handlingTextPath = true; + + recursiveBuildTextChunks(flowBox); + + if (isTextPath) + m_handlingTextPath = false; + } + } + +#if DEBUG_CHUNK_BUILDING > 1 + fprintf(stderr, " <- buildTextChunks(start=%p)\n", start); +#endif +} + +void SVGTextChunkLayoutInfo::layoutTextChunks() +{ + Vector<SVGTextChunk>::iterator it = m_svgTextChunks.begin(); + Vector<SVGTextChunk>::iterator end = m_svgTextChunks.end(); + + for (; it != end; ++it) { + SVGTextChunk& chunk = *it; + +#if DEBUG_CHUNK_BUILDING > 0 + { + fprintf(stderr, "Handle TEXT CHUNK! anchor=%i, textLength=%f, lengthAdjust=%i, isVerticalText=%i, isTextPath=%i start=%p, end=%p -> dist: %i\n", + (int) chunk.anchor, chunk.textLength, (int) chunk.lengthAdjust, (int) chunk.isVerticalText, + (int) chunk.isTextPath, chunk.start, chunk.end, (unsigned int) (chunk.end - chunk.start)); + + Vector<SVGInlineBoxCharacterRange>::iterator boxIt = chunk.boxes.begin(); + Vector<SVGInlineBoxCharacterRange>::iterator boxEnd = chunk.boxes.end(); + + unsigned int i = 0; + for (; boxIt != boxEnd; ++boxIt) { + SVGInlineBoxCharacterRange& range = *boxIt; + ++i; + fprintf(stderr, " -> RANGE %i STARTOFFSET: %i, ENDOFFSET: %i, BOX: %p\n", i, range.startOffset, range.endOffset, range.box); + } + } +#endif + + if (chunk.isTextPath) + continue; + + // text-path & textLength, with lengthAdjust="spacing" is already handled for textPath layouts. + applyTextLengthCorrectionToTextChunk(chunk); + + // text-anchor is already handled for textPath layouts. + applyTextAnchorToTextChunk(chunk); + } +} + +} // namespace WebCore + +#endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGTextChunkLayoutInfo.h b/WebCore/rendering/SVGTextChunkLayoutInfo.h index 524c983..e06dd1a 100644 --- a/WebCore/rendering/SVGTextChunkLayoutInfo.h +++ b/WebCore/rendering/SVGTextChunkLayoutInfo.h @@ -24,6 +24,8 @@ #if ENABLE(SVG) #include "AffineTransform.h" +#include "SVGCharacterData.h" +#include "SVGRenderStyle.h" #include "SVGTextContentElement.h" #include <wtf/Assertions.h> @@ -32,8 +34,75 @@ namespace WebCore { class InlineBox; +class InlineFlowBox; class SVGInlineTextBox; +// A SVGTextChunk directly corresponds to the definition of a "text chunk" per SVG 1.1 specification +// For example, each absolute positioned character starts a text chunk (much more to respect, see spec). +// Each SVGTextChunk contains a Vector of SVGInlineBoxCharacterRange, describing how many boxes are spanned +// by this chunk. Following two examples should clarify the code a bit: +// +// 1. <text x="10 20 30">ABC</text> - one InlineTextBox is created, three SVGTextChunks each with one SVGInlineBoxCharaterRange +// [SVGTextChunk 1] +// [SVGInlineBoxCharacterRange 1, startOffset=0, endOffset=1, box=0x1] +// [SVGTextChunk 2] +// [SVGInlineBoxCharacterRange 1, startOffset=1, endOffset=2, box=0x1] +// [SVGTextChunk 3] +// [SVGInlineBoxCharacterRange 1, startOffset=2, endOffset=3, box=0x1] +// +// 2. <text x="10">A<tspan>B</tspan>C</text> - three InlineTextBoxs are created, one SVGTextChunk, with three SVGInlineBoxCharacterRanges +// [SVGTextChunk 1] +// [SVGInlineBoxCharacterRange 1, startOffset=0, endOffset=1, box=0x1] +// [SVGInlineBoxCharacterRange 2, startOffset=0, endOffset=1, box=0x2] +// [SVGInlineBoxCharacterRange 3, startOffset=0, endOffset=1, box=0x3] +// +// High level overview of the SVG text layout code: +// Step #1) - Build Vector of SVGChar objects starting from root <text> diving into children +// Step #2) - Build Vector of SVGTextChunk objects, containing offsets into the InlineTextBoxes and SVGChar vectors +// Step #3) - Apply chunk post processing (text-anchor / textLength support, which operate on text chunks!) +// Step #4) - Propagate information, how many chunk "parts" are associated with each SVGInlineTextBox (see below) +// Step #5) - Layout all InlineBoxes, only by measuring their context rect (x/y/width/height defined through SVGChars and transformations) +// Step #6) - Layout SVGRootInlineBox, it's parent RenderSVGText block and fixup child positions, to be relative to the root box +// +// When painting a range of characters, we have to determine how many can be drawn in a row. Each absolute postioned +// character is drawn individually. After step #2) we know all text chunks, and how they span across the SVGInlineTextBoxes. +// In step #4) we build a list of text chunk "parts" and store it in each SVGInlineTextBox. A chunk "part" is a part of a +// text chunk that lives in a SVGInlineTextBox (consists of a length, width, height and a monotonic offset from the chunk begin) +// The SVGTextChunkPart object describes this information. +// When painting we can follow the regular InlineBox flow, we start painting the SVGRootInlineBox, which just asks its children +// to paint. They can paint on their own because all position information are known. Previously we used to draw _all_ characters +// from the SVGRootInlineBox, which violates the whole concept of the multiple InlineBoxes, and made text selection very hard to +// implement. + +struct SVGTextChunkPart { + SVGTextChunkPart() + : offset(-1) + , length(-1) + , width(0) + , height(0) + { + } + + bool isValid() const + { + return offset != -1 + && length != -1 + && width + && height; + } + + // First character of this text chunk part, defining the origin to be drawn + Vector<SVGChar>::const_iterator firstCharacter; + + // Start offset in textRenderer()->characters() buffer. + int offset; + + // length/width/height of chunk part + int length; + float width; + float height; +}; + struct SVGInlineBoxCharacterRange { SVGInlineBoxCharacterRange() : startOffset(INT_MIN) @@ -57,16 +126,16 @@ struct SVGChar; typedef SVGTextContentElement::SVGLengthAdjustType ELengthAdjust; struct SVGTextChunk { - SVGTextChunk() + SVGTextChunk(Vector<SVGChar>::iterator it) : anchor(TA_START) , textLength(0.0f) , lengthAdjust(SVGTextContentElement::LENGTHADJUST_SPACING) - , ctm() , isVerticalText(false) , isTextPath(false) - , start(0) - , end(0) - { } + , start(it) + , end(it) + { + } // text-anchor support ETextAnchor anchor; @@ -87,91 +156,42 @@ struct SVGTextChunk { Vector<SVGInlineBoxCharacterRange> boxes; }; -struct SVGTextChunkWalkerBase { - virtual ~SVGTextChunkWalkerBase() { } - - virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) = 0; - - // Followings methods are only used for painting text chunks - virtual void start(InlineBox*) = 0; - virtual void end(InlineBox*) = 0; -}; - -template<typename CallbackClass> -struct SVGTextChunkWalker : public SVGTextChunkWalkerBase { -public: - typedef void (CallbackClass::*SVGTextChunkWalkerCallback)(SVGInlineTextBox* textBox, - int startOffset, - const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, - const Vector<SVGChar>::iterator& end); - - // These callbacks are only used for painting! - typedef void (CallbackClass::*SVGTextChunkStartCallback)(InlineBox* box); - typedef void (CallbackClass::*SVGTextChunkEndCallback)(InlineBox* box); - - SVGTextChunkWalker(CallbackClass* object, - SVGTextChunkWalkerCallback walker, - SVGTextChunkStartCallback start = 0, - SVGTextChunkEndCallback end = 0) - : m_object(object) - , m_walkerCallback(walker) - , m_startCallback(start) - , m_endCallback(end) +struct SVGTextChunkLayoutInfo { + SVGTextChunkLayoutInfo() + : m_assignChunkProperties(true) + , m_handlingTextPath(false) + , m_charsIt(0) + , m_charsBegin(0) + , m_charsEnd(0) + , m_chunk(0) { - ASSERT(object); - ASSERT(walker); } - virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - (*m_object.*m_walkerCallback)(textBox, startOffset, chunkCtm, start, end); - } + const Vector<SVGTextChunk>& textChunks() const { return m_svgTextChunks; } - // Followings methods are only used for painting text chunks - virtual void start(InlineBox* box) - { - if (m_startCallback) - (*m_object.*m_startCallback)(box); - else - ASSERT_NOT_REACHED(); - } - - virtual void end(InlineBox* box) - { - if (m_endCallback) - (*m_object.*m_endCallback)(box); - else - ASSERT_NOT_REACHED(); - } + void buildTextChunks(Vector<SVGChar>::iterator charsBegin, Vector<SVGChar>::iterator charsEnd, InlineFlowBox* start); + void layoutTextChunks(); private: - CallbackClass* m_object; - SVGTextChunkWalkerCallback m_walkerCallback; - SVGTextChunkStartCallback m_startCallback; - SVGTextChunkEndCallback m_endCallback; -}; + void startTextChunk(); + void closeTextChunk(); + void recursiveBuildTextChunks(InlineFlowBox* start); -struct SVGTextChunkLayoutInfo { - SVGTextChunkLayoutInfo(Vector<SVGTextChunk>& textChunks) - : assignChunkProperties(true) - , handlingTextPath(false) - , svgTextChunks(textChunks) - , it(0) - { - } - - bool assignChunkProperties : 1; - bool handlingTextPath : 1; + bool m_assignChunkProperties : 1; + bool m_handlingTextPath : 1; - Vector<SVGTextChunk>& svgTextChunks; - Vector<SVGChar>::iterator it; + Vector<SVGChar>::iterator m_charsIt; + Vector<SVGChar>::iterator m_charsBegin; + Vector<SVGChar>::iterator m_charsEnd; - SVGTextChunk chunk; + Vector<SVGTextChunk> m_svgTextChunks; + SVGTextChunk m_chunk; }; +// Helper functions +float calculateTextAnchorShiftForTextChunk(SVGTextChunk&, ETextAnchor); +float calculateTextLengthCorrectionForTextChunk(SVGTextChunk&, ELengthAdjust, float& computedLength); + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGTextLayoutUtilities.cpp b/WebCore/rendering/SVGTextLayoutUtilities.cpp index 39705e9..4366498 100644 --- a/WebCore/rendering/SVGTextLayoutUtilities.cpp +++ b/WebCore/rendering/SVGTextLayoutUtilities.cpp @@ -272,40 +272,45 @@ float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange& range { ASSERT(!range.isOpen()); ASSERT(range.isClosed()); - ASSERT(range.box->isInlineTextBox()); + ASSERT(range.box->isSVGInlineTextBox()); InlineTextBox* textBox = static_cast<InlineTextBox*>(range.box); RenderText* text = textBox->textRenderer(); RenderStyle* style = text->style(); - - return style->font().floatWidth(svgTextRunForInlineTextBox(text->characters() + textBox->start() + range.startOffset, range.endOffset - range.startOffset, style, textBox, 0)); + return style->font().floatWidth(svgTextRunForInlineTextBox(text->characters() + textBox->start() + range.startOffset, range.endOffset - range.startOffset, style, textBox)); } float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange& range) { ASSERT(!range.isOpen()); ASSERT(range.isClosed()); - ASSERT(range.box->isInlineTextBox()); + ASSERT(range.box->isSVGInlineTextBox()); InlineTextBox* textBox = static_cast<InlineTextBox*>(range.box); - RenderText* text = textBox->textRenderer(); - const Font& font = text->style()->font(); - - return (range.endOffset - range.startOffset) * (font.ascent() + font.descent()); + return (range.endOffset - range.startOffset) * textBox->textRenderer()->style()->font().height(); } -TextRun svgTextRunForInlineTextBox(const UChar* characters, int length, const RenderStyle* style, const InlineTextBox* textBox, float xPosition) +TextRun svgTextRunForInlineTextBox(const UChar* characters, int length, const RenderStyle* style, const InlineTextBox* textBox) { ASSERT(textBox); ASSERT(style); - TextRun run(characters, length, false, static_cast<int>(xPosition), textBox->toAdd(), textBox->direction() == RTL, textBox->m_dirOverride || style->visuallyOrdered()); + TextRun run(characters + , length + , false /* allowTabs */ + , 0 /* xPos, only relevant with allowTabs=true */ + , 0 /* padding, only relevant for justified text, not relevant for SVG */ + , textBox->direction() == RTL + , textBox->m_dirOverride || style->visuallyOrdered() /* directionalOverride */); #if ENABLE(SVG_FONTS) run.setReferencingRenderObject(textBox->textRenderer()->parent()); #endif - // We handle letter & word spacing ourselves + // Disable any word/character rounding. + run.disableRoundingHacks(); + + // We handle letter & word spacing ourselves. run.disableSpacing(); return run; } diff --git a/WebCore/rendering/SVGTextLayoutUtilities.h b/WebCore/rendering/SVGTextLayoutUtilities.h index 196a09c..8c07f62 100644 --- a/WebCore/rendering/SVGTextLayoutUtilities.h +++ b/WebCore/rendering/SVGTextLayoutUtilities.h @@ -32,7 +32,6 @@ class Font; class InlineTextBox; class RenderObject; class RenderStyle; -class RenderSVGResource; class SVGRenderStyle; class TextRun; @@ -40,26 +39,6 @@ struct SVGChar; struct SVGCharacterLayoutInfo; struct SVGInlineBoxCharacterRange; -enum SVGTextPaintSubphase { - SVGTextPaintSubphaseBackground, - SVGTextPaintSubphaseGlyphFill, - SVGTextPaintSubphaseGlyphFillSelection, - SVGTextPaintSubphaseGlyphStroke, - SVGTextPaintSubphaseGlyphStrokeSelection, - SVGTextPaintSubphaseForeground -}; - -struct SVGTextPaintInfo { - SVGTextPaintInfo() - : activePaintingResource(0) - , subphase(SVGTextPaintSubphaseBackground) - { - } - - RenderSVGResource* activePaintingResource; - SVGTextPaintSubphase subphase; -}; - struct SVGLastGlyphInfo { SVGLastGlyphInfo() : isValid(false) @@ -79,7 +58,7 @@ float applyGlyphAdvanceAndShiftRespectingOrientation(bool isVerticalText, float FloatPoint topLeftPositionOfCharacterRange(Vector<SVGChar>::iterator start, Vector<SVGChar>::iterator end); float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange&); float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange&); -TextRun svgTextRunForInlineTextBox(const UChar*, int length, const RenderStyle*, const InlineTextBox*, float xPos); +TextRun svgTextRunForInlineTextBox(const UChar*, int length, const RenderStyle*, const InlineTextBox*); float calculateCSSKerning(const RenderStyle*); bool applySVGKerning(SVGCharacterLayoutInfo&, const RenderStyle*, SVGLastGlyphInfo&, const String& unicodeString, const String& glyphName, bool isVerticalText); diff --git a/WebCore/rendering/SVGTextQuery.cpp b/WebCore/rendering/SVGTextQuery.cpp new file mode 100644 index 0000000..35ca690 --- /dev/null +++ b/WebCore/rendering/SVGTextQuery.cpp @@ -0,0 +1,467 @@ +/* + Copyright (C) Research In Motion Limited 2010. 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 "SVGTextQuery.h" + +#if ENABLE(SVG) +#include "FloatConversion.h" +#include "InlineFlowBox.h" +#include "RenderBlock.h" +#include "RenderInline.h" +#include "SVGInlineTextBox.h" +#include "VisiblePosition.h" + +namespace WebCore { + +// Base structure for callback user data +struct SVGTextQuery::Data { + Data() + : processedChunkCharacters(0) + { + } + + unsigned processedChunkCharacters; +}; + +static inline InlineFlowBox* flowBoxForRenderer(RenderObject* renderer) +{ + if (!renderer) + return 0; + + if (renderer->isRenderBlock()) { + // If we're given a block element, it has to be a RenderSVGText. + ASSERT(renderer->isSVGText()); + RenderBlock* renderBlock = toRenderBlock(renderer); + + // RenderSVGText only ever contains a single line box. + InlineFlowBox* flowBox = renderBlock->firstLineBox(); + ASSERT(flowBox == renderBlock->lastLineBox()); + return flowBox; + } + + if (renderer->isRenderInline()) { + // We're given a RenderSVGInline or objects that derive from it (RenderSVGTSpan / RenderSVGTextPath) + RenderInline* renderInline = toRenderInline(renderer); + + // RenderSVGInline only ever contains a single line box. + InlineFlowBox* flowBox = renderInline->firstLineBox(); + ASSERT(flowBox == renderInline->lastLineBox()); + return flowBox; + } + + ASSERT_NOT_REACHED(); + return 0; +} + +static inline float mapLengthThroughChunkTransformation(const SVGInlineTextBox* textBox, bool isVerticalText, float length) +{ + const AffineTransform& transform = textBox->chunkTransformation(); + if (transform.isIdentity()) + return length; + + return narrowPrecisionToFloat(static_cast<double>(length) * (isVerticalText ? transform.d() : transform.a())); +} + +SVGTextQuery::SVGTextQuery(RenderObject* renderer) +{ + collectTextBoxesInFlowBox(flowBoxForRenderer(renderer)); +} + +void SVGTextQuery::collectTextBoxesInFlowBox(InlineFlowBox* flowBox) +{ + if (!flowBox) + return; + + for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnLine()) { + if (child->isInlineFlowBox()) { + // Skip generated content. + if (!child->renderer()->node()) + continue; + + collectTextBoxesInFlowBox(static_cast<InlineFlowBox*>(child)); + continue; + } + + ASSERT(child->isSVGInlineTextBox()); + m_textBoxes.append(static_cast<SVGInlineTextBox*>(child)); + } +} + +bool SVGTextQuery::executeQuery(Data* queryData, ProcessTextChunkPartCallback chunkPartCallback) const +{ + ASSERT(!m_textBoxes.isEmpty()); + bool finished = false; + + // Loop over all text boxes + const Vector<SVGInlineTextBox*>::const_iterator end = m_textBoxes.end(); + for (Vector<SVGInlineTextBox*>::const_iterator it = m_textBoxes.begin(); it != end; ++it) { + const SVGInlineTextBox* textBox = *it; + const Vector<SVGTextChunkPart>& parts = textBox->svgTextChunkParts(); + + int processedCharacters = 0; + + // Loop over all text chunk parts in this text box, firing a callback for each chunk part. + const Vector<SVGTextChunkPart>::const_iterator partEnd = parts.end(); + for (Vector<SVGTextChunkPart>::const_iterator partIt = parts.begin(); partIt != partEnd; ++partIt) { + if ((this->*chunkPartCallback)(queryData, textBox, *partIt)) { + finished = true; + break; + } + + processedCharacters += partIt->length; + } + + if (finished) + break; + + queryData->processedChunkCharacters += processedCharacters; + } + + return finished; +} + +bool SVGTextQuery::mapStartAndLengthIntoChunkPartCoordinates(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part, int& startPosition, int& endPosition) const +{ + // Reuse the same logic used for text selection & painting, to map our query start/length into start/endPositions of the current text chunk part. + startPosition -= queryData->processedChunkCharacters; + endPosition -= queryData->processedChunkCharacters; + textBox->mapStartEndPositionsIntoChunkPartCoordinates(startPosition, endPosition, part); + + // If startPosition < endPosition, then the position we're supposed to measure lies in this chunk part. + return startPosition < endPosition; +} + +float SVGTextQuery::measureCharacterRange(const SVGInlineTextBox* textBox, RenderStyle* style, bool isVerticalText, int startPosition, int length) const +{ + // FIXME: Vertical writing mode needs to be handled more accurate. + if (isVerticalText) + return length * style->font().height(); + + const UChar* startCharacter = textBox->textRenderer()->characters() + textBox->start() + startPosition; + return style->font().floatWidth(svgTextRunForInlineTextBox(startCharacter, length, style, textBox)); +} + +// numberOfCharacters() implementation +struct NumberOfCharactersData : SVGTextQuery::Data { + NumberOfCharactersData() + : characters(0) + { + } + + unsigned characters; +}; + +bool SVGTextQuery::numberOfCharactersCallback(Data* queryData, const SVGInlineTextBox*, const SVGTextChunkPart& part) const +{ + NumberOfCharactersData* data = static_cast<NumberOfCharactersData*>(queryData); + data->characters += part.length; + return false; +} + +unsigned SVGTextQuery::numberOfCharacters() const +{ + if (m_textBoxes.isEmpty()) + return 0; + + NumberOfCharactersData data; + executeQuery(&data, &SVGTextQuery::numberOfCharactersCallback); + return data.characters; +} + +// textLength() implementation +struct TextLengthData : SVGTextQuery::Data { + TextLengthData() + : textLength(0.0f) + { + } + + float textLength; +}; + +bool SVGTextQuery::textLengthCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + TextLengthData* data = static_cast<TextLengthData*>(queryData); + + RenderStyle* style = textBox->textRenderer()->style(); + ASSERT(style); + + bool isVerticalText = isVerticalWritingMode(style->svgStyle()); + float partLength = isVerticalText ? part.height : part.width; + + data->textLength += mapLengthThroughChunkTransformation(textBox, isVerticalText, partLength); + return false; +} + +float SVGTextQuery::textLength() const +{ + if (m_textBoxes.isEmpty()) + return 0.0f; + + TextLengthData data; + executeQuery(&data, &SVGTextQuery::textLengthCallback); + return data.textLength; +} + +// subStringLength() implementation +struct SubStringLengthData : SVGTextQuery::Data { + SubStringLengthData(unsigned queryStartPosition, unsigned queryLength) + : startPosition(queryStartPosition) + , length(queryLength) + , subStringLength(0.0f) + { + } + + unsigned startPosition; + unsigned length; + + float subStringLength; +}; + +bool SVGTextQuery::subStringLengthCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + SubStringLengthData* data = static_cast<SubStringLengthData*>(queryData); + + int startPosition = data->startPosition; + int endPosition = startPosition + data->length; + if (!mapStartAndLengthIntoChunkPartCoordinates(queryData, textBox, part, startPosition, endPosition)) + return false; + + RenderStyle* style = textBox->textRenderer()->style(); + ASSERT(style); + + bool isVerticalText = isVerticalWritingMode(style->svgStyle()); + float partLength = measureCharacterRange(textBox, style, isVerticalWritingMode(style->svgStyle()), part.offset + startPosition, endPosition - startPosition); + + data->subStringLength += mapLengthThroughChunkTransformation(textBox, isVerticalText, partLength); + return false; +} + +float SVGTextQuery::subStringLength(unsigned startPosition, unsigned length) const +{ + if (m_textBoxes.isEmpty()) + return 0.0f; + + SubStringLengthData data(startPosition, length); + executeQuery(&data, &SVGTextQuery::subStringLengthCallback); + return data.subStringLength; +} + +// startPositionOfCharacter() implementation +struct StartPositionOfCharacterData : SVGTextQuery::Data { + StartPositionOfCharacterData(unsigned queryPosition) + : position(queryPosition) + { + } + + unsigned position; + FloatPoint startPosition; +}; + +bool SVGTextQuery::startPositionOfCharacterCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + StartPositionOfCharacterData* data = static_cast<StartPositionOfCharacterData*>(queryData); + + int startPosition = data->position; + int endPosition = startPosition + 1; + if (!mapStartAndLengthIntoChunkPartCoordinates(queryData, textBox, part, startPosition, endPosition)) + return false; + + const SVGChar& character = *(part.firstCharacter + startPosition); + data->startPosition = textBox->chunkTransformation().mapPoint(FloatPoint(character.x, character.y)); + return true; +} + +FloatPoint SVGTextQuery::startPositionOfCharacter(unsigned position) const +{ + if (m_textBoxes.isEmpty()) + return FloatPoint(); + + StartPositionOfCharacterData data(position); + executeQuery(&data, &SVGTextQuery::startPositionOfCharacterCallback); + return data.startPosition; +} + +// endPositionOfCharacter() implementation +struct EndPositionOfCharacterData : SVGTextQuery::Data { + EndPositionOfCharacterData(unsigned queryPosition) + : position(queryPosition) + { + } + + unsigned position; + FloatPoint endPosition; +}; + +bool SVGTextQuery::endPositionOfCharacterCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + EndPositionOfCharacterData* data = static_cast<EndPositionOfCharacterData*>(queryData); + + int startPosition = data->position; + int endPosition = startPosition + 1; + if (!mapStartAndLengthIntoChunkPartCoordinates(queryData, textBox, part, startPosition, endPosition)) + return false; + + const SVGChar& character = *(part.firstCharacter + startPosition); + data->endPosition = FloatPoint(character.x, character.y); + + RenderStyle* style = textBox->textRenderer()->style(); + ASSERT(style); + + bool isVerticalText = isVerticalWritingMode(style->svgStyle()); + float glyphAdvance = measureCharacterRange(textBox, style, isVerticalText, part.offset + startPosition, 1); + + if (isVerticalText) + data->endPosition.move(0.0f, glyphAdvance); + else + data->endPosition.move(glyphAdvance, 0.0f); + + data->endPosition = textBox->chunkTransformation().mapPoint(data->endPosition); + return true; +} + +FloatPoint SVGTextQuery::endPositionOfCharacter(unsigned position) const +{ + if (m_textBoxes.isEmpty()) + return FloatPoint(); + + EndPositionOfCharacterData data(position); + executeQuery(&data, &SVGTextQuery::endPositionOfCharacterCallback); + return data.endPosition; +} + +// rotationOfCharacter() implementation +struct RotationOfCharacterData : SVGTextQuery::Data { + RotationOfCharacterData(unsigned queryPosition) + : position(queryPosition) + , rotation(0.0f) + { + } + + unsigned position; + float rotation; +}; + +bool SVGTextQuery::rotationOfCharacterCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + RotationOfCharacterData* data = static_cast<RotationOfCharacterData*>(queryData); + + int startPosition = data->position; + int endPosition = startPosition + 1; + if (!mapStartAndLengthIntoChunkPartCoordinates(queryData, textBox, part, startPosition, endPosition)) + return false; + + const SVGChar& character = *(part.firstCharacter + startPosition); + data->rotation = character.angle; + return true; +} + +float SVGTextQuery::rotationOfCharacter(unsigned position) const +{ + if (m_textBoxes.isEmpty()) + return 0.0f; + + RotationOfCharacterData data(position); + executeQuery(&data, &SVGTextQuery::rotationOfCharacterCallback); + return data.rotation; +} + +// extentOfCharacter() implementation +struct ExtentOfCharacterData : SVGTextQuery::Data { + ExtentOfCharacterData(unsigned queryPosition) + : position(queryPosition) + { + } + + unsigned position; + FloatRect extent; +}; + +bool SVGTextQuery::extentOfCharacterCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + ExtentOfCharacterData* data = static_cast<ExtentOfCharacterData*>(queryData); + + int startPosition = data->position; + int endPosition = startPosition + 1; + if (!mapStartAndLengthIntoChunkPartCoordinates(queryData, textBox, part, startPosition, endPosition)) + return false; + + RenderStyle* style = textBox->textRenderer()->style(); + ASSERT(style); + + const SVGChar& character = *(part.firstCharacter + startPosition); + data->extent = textBox->calculateGlyphBoundaries(style, part.offset + startPosition, character); + return true; +} + +FloatRect SVGTextQuery::extentOfCharacter(unsigned position) const +{ + if (m_textBoxes.isEmpty()) + return FloatRect(); + + ExtentOfCharacterData data(position); + executeQuery(&data, &SVGTextQuery::extentOfCharacterCallback); + return data.extent; +} + +// characterNumberAtPosition() implementation +struct CharacterNumberAtPositionData : SVGTextQuery::Data { + CharacterNumberAtPositionData(const FloatPoint& queryPosition) + : characterNumber(0) + , position(queryPosition) + { + } + + unsigned characterNumber; + FloatPoint position; +}; + +bool SVGTextQuery::characterNumberAtPositionCallback(Data* queryData, const SVGInlineTextBox* textBox, const SVGTextChunkPart& part) const +{ + CharacterNumberAtPositionData* data = static_cast<CharacterNumberAtPositionData*>(queryData); + + RenderStyle* style = textBox->textRenderer()->style(); + ASSERT(style); + + for (int i = 0; i < part.length; ++i) { + FloatRect extent(textBox->calculateGlyphBoundaries(style, part.offset + i, *(part.firstCharacter + i))); + if (extent.contains(data->position)) + return true; + + ++data->characterNumber; + } + + return false; +} + +int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const +{ + if (m_textBoxes.isEmpty()) + return -1; + + CharacterNumberAtPositionData data(position); + if (!executeQuery(&data, &SVGTextQuery::characterNumberAtPositionCallback)) + return -1; + + return data.characterNumber; +} + +} + +#endif diff --git a/WebCore/rendering/SVGTextQuery.h b/WebCore/rendering/SVGTextQuery.h new file mode 100644 index 0000000..f19c72e --- /dev/null +++ b/WebCore/rendering/SVGTextQuery.h @@ -0,0 +1,76 @@ +/* + Copyright (C) Research In Motion Limited 2010. 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. +*/ + +#ifndef SVGTextQuery_h +#define SVGTextQuery_h + +#if ENABLE(SVG) +#include "FloatRect.h" +#include <wtf/Vector.h> + +namespace WebCore { + +class InlineFlowBox; +class RenderObject; +class RenderStyle; +class SVGInlineTextBox; +struct SVGTextChunkPart; + +class SVGTextQuery { +public: + SVGTextQuery(RenderObject*); + + unsigned numberOfCharacters() const; + float textLength() const; + float subStringLength(unsigned startPosition, unsigned length) const; + FloatPoint startPositionOfCharacter(unsigned position) const; + FloatPoint endPositionOfCharacter(unsigned position) const; + float rotationOfCharacter(unsigned position) const; + FloatRect extentOfCharacter(unsigned position) const; + int characterNumberAtPosition(const FloatPoint&) const; + + // Public helper struct. Private classes in SVGTextQuery inherit from it. + struct Data; + +private: + typedef bool (SVGTextQuery::*ProcessTextChunkPartCallback)(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool executeQuery(Data*, ProcessTextChunkPartCallback) const; + + void collectTextBoxesInFlowBox(InlineFlowBox*); + float measureCharacterRange(const SVGInlineTextBox*, RenderStyle*, bool isVerticalText, int startPosition, int length) const; + bool mapStartAndLengthIntoChunkPartCoordinates(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&, int& startPosition, int& endPosition) const; + +private: + bool numberOfCharactersCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool textLengthCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool subStringLengthCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool startPositionOfCharacterCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool endPositionOfCharacterCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool rotationOfCharacterCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool extentOfCharacterCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + bool characterNumberAtPositionCallback(Data*, const SVGInlineTextBox*, const SVGTextChunkPart&) const; + +private: + Vector<SVGInlineTextBox*> m_textBoxes; +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/ShadowElement.cpp b/WebCore/rendering/ShadowElement.cpp index dea9233..62b37e1 100644 --- a/WebCore/rendering/ShadowElement.cpp +++ b/WebCore/rendering/ShadowElement.cpp @@ -22,17 +22,85 @@ #include "ShadowElement.h" #include "HTMLNames.h" +#include "RenderTheme.h" +#include "RenderView.h" namespace WebCore { +using namespace HTMLNames; + PassRefPtr<ShadowBlockElement> ShadowBlockElement::create(Node* shadowParent) { return new ShadowBlockElement(shadowParent); } ShadowBlockElement::ShadowBlockElement(Node* shadowParent) - : ShadowElement<HTMLDivElement>(HTMLNames::divTag, shadowParent) + : ShadowElement<HTMLDivElement>(divTag, shadowParent) +{ +} + +void ShadowBlockElement::layoutAsPart(const IntRect& partRect) +{ + RenderBox* parentRenderer = toRenderBox(renderer()->parent()); + RenderBox* selfRenderer = toRenderBox(renderer()); + IntRect oldRect = selfRenderer->frameRect(); + + LayoutStateMaintainer statePusher(parentRenderer->view(), parentRenderer, parentRenderer->size()); + + if (oldRect.size() != partRect.size()) + selfRenderer->setChildNeedsLayout(true, false); + + selfRenderer->layoutIfNeeded(); + selfRenderer->setFrameRect(partRect); + + if (selfRenderer->checkForRepaintDuringLayout()) + selfRenderer->repaintDuringLayoutIfMoved(oldRect); + + statePusher.pop(); + parentRenderer->addOverflowFromChild(selfRenderer); +} + +void ShadowBlockElement::updateStyleForPart(PseudoId pseudoId) +{ + if (renderer()->style()->styleType() != pseudoId) + renderer()->setStyle(createStyleForPart(renderer()->parent(), pseudoId)); +} + +PassRefPtr<ShadowBlockElement> ShadowBlockElement::createForPart(Node* shadowParent, PseudoId pseudoId) +{ + RenderObject* parentRenderer = shadowParent->renderer(); + RefPtr<RenderStyle> styleForPart = createStyleForPart(parentRenderer, pseudoId); + RefPtr<ShadowBlockElement> part = create(shadowParent); + part->setRenderer(part->createRenderer(parentRenderer->renderArena(), styleForPart.get())); + part->renderer()->setStyle(styleForPart.release()); + part->setAttached(); + part->setInDocument(); + return part.release(); +} + +PassRefPtr<RenderStyle> ShadowBlockElement::createStyleForPart(RenderObject* parentRenderer, PseudoId pseudoId) +{ + RefPtr<RenderStyle> styleForPart; + RenderStyle* pseudoStyle = parentRenderer->getCachedPseudoStyle(pseudoId); + if (pseudoStyle) + styleForPart = RenderStyle::clone(pseudoStyle); + else + styleForPart = RenderStyle::create(); + + styleForPart->inheritFrom(parentRenderer->style()); + styleForPart->setDisplay(BLOCK); + styleForPart->setAppearance(NoControlPart); + return styleForPart.release(); +} + +bool ShadowBlockElement::partShouldHaveStyle(const RenderObject* parentRenderer, PseudoId pseudoId) { + // We have some -webkit-appearance values for default styles of parts and + // that appearance get turned off during RenderStyle creation + // if they have background styles specified. + // So !hasAppearance() implies that there are something to be styled. + RenderStyle* pseudoStyle = parentRenderer->getCachedPseudoStyle(pseudoId); + return !(pseudoStyle && pseudoStyle->hasAppearance()); } PassRefPtr<ShadowInputElement> ShadowInputElement::create(Node* shadowParent) @@ -41,7 +109,7 @@ PassRefPtr<ShadowInputElement> ShadowInputElement::create(Node* shadowParent) } ShadowInputElement::ShadowInputElement(Node* shadowParent) - : ShadowElement<HTMLInputElement>(HTMLNames::inputTag, shadowParent) + : ShadowElement<HTMLInputElement>(inputTag, shadowParent) { } diff --git a/WebCore/rendering/ShadowElement.h b/WebCore/rendering/ShadowElement.h index 90030ee..b8aacfd 100644 --- a/WebCore/rendering/ShadowElement.h +++ b/WebCore/rendering/ShadowElement.h @@ -40,20 +40,31 @@ protected: ShadowElement(const QualifiedName& name, Node* shadowParent) : BaseElement(name, shadowParent->document()) , m_shadowParent(shadowParent) - {} + { + } + Node* shadowParent() const { return m_shadowParent; } + +private: virtual bool isShadowNode() const { return true; } virtual Node* shadowParentNode() { return m_shadowParent; } -private: Node* m_shadowParent; }; class ShadowBlockElement : public ShadowElement<HTMLDivElement> { public: static PassRefPtr<ShadowBlockElement> create(Node*); + static PassRefPtr<ShadowBlockElement> createForPart(Node*, PseudoId); + static bool partShouldHaveStyle(const RenderObject* parentRenderer, PseudoId pseudoId); + void layoutAsPart(const IntRect& partRect); + void updateStyleForPart(PseudoId); + protected: ShadowBlockElement(Node*); + +private: + static PassRefPtr<RenderStyle> createStyleForPart(RenderObject*, PseudoId); }; class ShadowInputElement : public ShadowElement<HTMLInputElement> { diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp index ed12611..61c85e7 100644 --- a/WebCore/rendering/TextControlInnerElements.cpp +++ b/WebCore/rendering/TextControlInnerElements.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. + * 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 @@ -89,7 +90,7 @@ TextControlInnerElement::TextControlInnerElement(Document* document, Node* shado PassRefPtr<TextControlInnerElement> TextControlInnerElement::create(Node* shadowParent) { - return new TextControlInnerElement(shadowParent->document(), shadowParent); + return adoptRef(new TextControlInnerElement(shadowParent->document(), shadowParent)); } void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<RenderStyle> style, RenderArena* arena) @@ -126,7 +127,7 @@ inline TextControlInnerTextElement::TextControlInnerTextElement(Document* docume PassRefPtr<TextControlInnerTextElement> TextControlInnerTextElement::create(Document* document, Node* shadowParent) { - return new TextControlInnerTextElement(document, shadowParent); + return adoptRef(new TextControlInnerTextElement(document, shadowParent)); } void TextControlInnerTextElement::defaultEventHandler(Event* event) @@ -162,7 +163,7 @@ inline SearchFieldResultsButtonElement::SearchFieldResultsButtonElement(Document PassRefPtr<SearchFieldResultsButtonElement> SearchFieldResultsButtonElement::create(Document* document) { - return new SearchFieldResultsButtonElement(document); + return adoptRef(new SearchFieldResultsButtonElement(document)); } void SearchFieldResultsButtonElement::defaultEventHandler(Event* event) @@ -194,7 +195,7 @@ inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document* PassRefPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::create(Document* document) { - return new SearchFieldCancelButtonElement(document); + return adoptRef(new SearchFieldCancelButtonElement(document)); } void SearchFieldCancelButtonElement::detach() @@ -251,7 +252,7 @@ inline SpinButtonElement::SpinButtonElement(Node* shadowParent) PassRefPtr<SpinButtonElement> SpinButtonElement::create(Node* shadowParent) { - return new SpinButtonElement(shadowParent); + return adoptRef(new SpinButtonElement(shadowParent)); } void SpinButtonElement::defaultEventHandler(Event* event) @@ -269,20 +270,27 @@ void SpinButtonElement::defaultEventHandler(Event* event) return; } + RenderBox* box = renderBox(); + if (!box) { + if (!event->defaultHandled()) + HTMLDivElement::defaultEventHandler(event); + return; + } + HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); - IntPoint local = roundedIntPoint(renderBox()->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); + IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); if (event->type() == eventNames().clickEvent) { - if (renderBox()->borderBoxRect().contains(local)) { + if (box->borderBoxRect().contains(local)) { input->focus(); input->select(); - if (local.y() < renderBox()->y() + renderBox()->height() / 2) + if (local.y() < box->y() + box->height() / 2) input->stepUpFromRenderer(1); else input->stepUpFromRenderer(-1); event->setDefaultHandled(); } } else if (event->type() == eventNames().mousemoveEvent) { - if (renderBox()->borderBoxRect().contains(local)) { + if (box->borderBoxRect().contains(local)) { if (!m_capturing) { if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(input); @@ -290,7 +298,7 @@ void SpinButtonElement::defaultEventHandler(Event* event) } } bool oldOnUpButton = m_onUpButton; - m_onUpButton = local.y() < renderBox()->y() + renderBox()->height() / 2; + m_onUpButton = local.y() < box->y() + box->height() / 2; if (m_onUpButton != oldOnUpButton) renderer()->repaint(); } else { @@ -307,4 +315,26 @@ void SpinButtonElement::defaultEventHandler(Event* event) HTMLDivElement::defaultEventHandler(event); } +// ---------------------------- + +#if ENABLE(INPUT_SPEECH) + +inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Document* document) + : TextControlInnerElement(document) +{ +} + +PassRefPtr<InputFieldSpeechButtonElement> InputFieldSpeechButtonElement::create(Document* document) +{ + return adoptRef(new InputFieldSpeechButtonElement(document)); +} + +void InputFieldSpeechButtonElement::defaultEventHandler(Event* event) +{ + // FIXME: Start speech recognition here. + HTMLDivElement::defaultEventHandler(event); +} + +#endif // ENABLE(INPUT_SPEECH) + } diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h index ed1887e..1884a34 100644 --- a/WebCore/rendering/TextControlInnerElements.h +++ b/WebCore/rendering/TextControlInnerElements.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. + * 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 @@ -104,6 +105,20 @@ private: bool m_onUpButton; }; +#if ENABLE(INPUT_SPEECH) + +class InputFieldSpeechButtonElement : public TextControlInnerElement { +public: + static PassRefPtr<InputFieldSpeechButtonElement> create(Document*); + + virtual void defaultEventHandler(Event*); + +private: + InputFieldSpeechButtonElement(Document*); +}; + +#endif // ENABLE(INPUT_SPEECH) + } // namespace #endif diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index af4e055..40f7a27 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 @@ -386,7 +386,9 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon rareInheritedData->wordWrap != other->rareInheritedData->wordWrap || rareInheritedData->nbspMode != other->rareInheritedData->nbspMode || rareInheritedData->khtmlLineBreak != other->rareInheritedData->khtmlLineBreak || - rareInheritedData->textSecurity != other->rareInheritedData->textSecurity) + rareInheritedData->textSecurity != other->rareInheritedData->textSecurity || + rareInheritedData->hyphens != other->rareInheritedData->hyphens || + rareInheritedData->hyphenateCharacter != other->rareInheritedData->hyphenateCharacter) return StyleDifferenceLayout; if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get())) @@ -802,6 +804,19 @@ CounterDirectiveMap& RenderStyle::accessCounterDirectives() return *map.get(); } +const AtomicString& RenderStyle::hyphenString() const +{ + ASSERT(hyphens() == HyphensAuto); + + const AtomicString& hyphenateCharacter = rareInheritedData.get()->hyphenateCharacter; + if (!hyphenateCharacter.isNull()) + return hyphenateCharacter; + + // FIXME: This should depend on locale. + DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphen, 1)); + return hyphenMinusString; +} + #if ENABLE(DASHBOARD_SUPPORT) const Vector<StyleDashboardRegion>& RenderStyle::initialDashboardRegions() { diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index 16dcae8..2914fcf 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -2,7 +2,7 @@ * Copyright (C) 2000 Lars Knoll (knoll@kde.org) * (C) 2000 Antti Koivisto (koivisto@kde.org) * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) * * This library is free software; you can redistribute it and/or @@ -647,6 +647,8 @@ public: EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); } EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); } const AtomicString& highlight() const { return rareInheritedData->highlight; } + Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); } + const AtomicString& hyphenateCharacter() const { return rareInheritedData->hyphenateCharacter; } EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); } EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); } float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; } @@ -701,6 +703,7 @@ public: bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; } Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; } Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; } + LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; } #if USE(ACCELERATED_COMPOSITING) // When set, this ensures that styles compare as different. Used during accelerated animations. @@ -826,6 +829,7 @@ public: void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v) } void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) } void setClip(Length top, Length right, Length bottom, Length left); + void setClip(LengthBox box) { SET_VAR(visual, clip, box) } void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; } @@ -982,6 +986,8 @@ public: void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); } void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); } void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); } + void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); } + void setHyphenateCharacter(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenateCharacter, h); } void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); } void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); } void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); } @@ -1028,6 +1034,7 @@ public: void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); } void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); } void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); } + void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); } #if USE(ACCELERATED_COMPOSITING) void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); } @@ -1065,6 +1072,8 @@ public: const CounterDirectiveMap* counterDirectives() const; CounterDirectiveMap& accessCounterDirectives(); + const AtomicString& hyphenString() const; + bool inheritedNotEqual(const RenderStyle*) const; StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; @@ -1188,6 +1197,8 @@ public: static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; } static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; } static const AtomicString& initialHighlight() { return nullAtom; } + static Hyphens initialHyphens() { return HyphensManual; } + static const AtomicString& initialHyphenateCharacter() { return nullAtom; } static EBorderFit initialBorderFit() { return BorderFitBorder; } static EResize initialResize() { return RESIZE_NONE; } static ControlPart initialAppearance() { return NoControlPart; } diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index b6dce18..dd82433 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -74,8 +74,9 @@ enum PseudoId { MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON, MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, - INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE, - + INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE, + METER_HORIZONTAL_BAR, METER_HORIZONTAL_OPTIMUM, METER_HORIZONTAL_SUBOPTIMAL, METER_HORIZONTAL_EVEN_LESS_GOOD, + METER_VERTICAL_BAR, METER_VERTICAL_OPTIMUM, METER_VERTICAL_SUBOPTIMAL, METER_VERTICAL_EVEN_LESS_GOOD, AFTER_LAST_INTERNAL_PSEUDOID, FIRST_PUBLIC_PSEUDOID = FIRST_LINE, FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON, @@ -405,6 +406,8 @@ enum EBackfaceVisibility { enum ELineClampType { LineClampLineCount, LineClampPercentage }; +enum Hyphens { HyphensNone, HyphensManual, HyphensAuto }; + } // namespace WebCore #endif // RenderStyleConstants_h diff --git a/WebCore/rendering/style/StyleRareInheritedData.cpp b/WebCore/rendering/style/StyleRareInheritedData.cpp index 04923d5..cb6edf3 100644 --- a/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 @@ -47,6 +47,7 @@ StyleRareInheritedData::StyleRareInheritedData() , resize(RenderStyle::initialResize()) , userSelect(RenderStyle::initialUserSelect()) , colorSpace(DeviceColorSpace) + , hyphens(HyphensManual) { } @@ -75,6 +76,8 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) , resize(o.resize) , userSelect(o.userSelect) , colorSpace(o.colorSpace) + , hyphens(o.hyphens) + , hyphenateCharacter(o.hyphenateCharacter) { } @@ -116,7 +119,9 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const #endif && resize == o.resize && userSelect == o.userSelect - && colorSpace == o.colorSpace; + && colorSpace == o.colorSpace + && hyphens == o.hyphens + && hyphenateCharacter == o.hyphenateCharacter; } bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const diff --git a/WebCore/rendering/style/StyleRareInheritedData.h b/WebCore/rendering/style/StyleRareInheritedData.h index 3ad8b0b..f6e3bf4 100644 --- a/WebCore/rendering/style/StyleRareInheritedData.h +++ b/WebCore/rendering/style/StyleRareInheritedData.h @@ -80,7 +80,10 @@ public: unsigned resize : 2; // EResize unsigned userSelect : 1; // EUserSelect unsigned colorSpace : 1; // ColorSpace - + unsigned hyphens : 2; // Hyphens + + AtomicString hyphenateCharacter; + private: StyleRareInheritedData(); StyleRareInheritedData(const StyleRareInheritedData&); diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.h b/WebCore/rendering/style/StyleRareNonInheritedData.h index d6fe96e..74e736c 100644 --- a/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -40,6 +40,7 @@ namespace WebCore { class AnimationList; class CSSStyleSelector; +class LengthSize; class ShadowData; class StyleFlexibleBoxData; class StyleMarqueeData; @@ -50,7 +51,7 @@ class StyleTransformData; struct ContentData; #if ENABLE(DASHBOARD_SUPPORT) -class StyleDashboardRegion; +struct StyleDashboardRegion; #endif #if ENABLE(XBL) @@ -123,6 +124,8 @@ public: Length m_perspectiveOriginX; Length m_perspectiveOriginY; + LengthSize m_pageSize; + #if ENABLE(XBL) OwnPtr<BindingURI> bindingURI; // The XBL binding URI list. #endif diff --git a/WebCore/storage/AbstractDatabase.cpp b/WebCore/storage/AbstractDatabase.cpp index c795189..dc3e8e2 100644 --- a/WebCore/storage/AbstractDatabase.cpp +++ b/WebCore/storage/AbstractDatabase.cpp @@ -33,6 +33,22 @@ namespace WebCore { +static bool isDatabaseAvailable = true; + +bool AbstractDatabase::isAvailable() +{ + return isDatabaseAvailable; +} + +void AbstractDatabase::setIsAvailable(bool available) +{ + isDatabaseAvailable = available; +} + +AbstractDatabase::~AbstractDatabase() +{ +} + } // namespace WebCore #endif // ENABLE(DATABASE) diff --git a/WebCore/storage/AbstractDatabase.h b/WebCore/storage/AbstractDatabase.h index 962be61..5e4e0fa 100644 --- a/WebCore/storage/AbstractDatabase.h +++ b/WebCore/storage/AbstractDatabase.h @@ -31,9 +31,30 @@ #if ENABLE(DATABASE) +#include "PlatformString.h" +#include <wtf/ThreadSafeShared.h> + namespace WebCore { -class AbstractDatabase { +class ScriptExecutionContext; +class SecurityOrigin; + +class AbstractDatabase : public ThreadSafeShared<AbstractDatabase> { +public: + static bool isAvailable(); + static void setIsAvailable(bool available); + + virtual ~AbstractDatabase(); + + virtual ScriptExecutionContext* scriptExecutionContext() const = 0; + virtual SecurityOrigin* securityOrigin() const = 0; + virtual String stringIdentifier() const = 0; + virtual String displayName() const = 0; + virtual unsigned long estimatedSize() const = 0; + virtual String fileName() const = 0; + + virtual void markAsDeletedAndClose() = 0; + virtual void closeImmediately() = 0; }; } // namespace WebCore diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index c96dfba..ad6b92c 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -73,18 +73,6 @@ const String& Database::databaseInfoTableName() return name; } -static bool isDatabaseAvailable = true; - -void Database::setIsAvailable(bool available) -{ - isDatabaseAvailable = available; -} - -bool Database::isAvailable() -{ - return isDatabaseAvailable; -} - static Mutex& guidMutex() { // Note: We don't have to use AtomicallyInitializedStatic here because @@ -451,6 +439,15 @@ void Database::close(ClosePolicy policy) m_scriptExecutionContext->postTask(ContextRemoveOpenDatabaseTask::create(this)); } +void Database::closeImmediately() +{ + DatabaseThread* databaseThread = scriptExecutionContext()->databaseThread(); + if (databaseThread && !databaseThread->terminationRequested()) { + stop(); + databaseThread->scheduleTask(DatabaseCloseTask::create(this, Database::RemoveDatabaseFromContext, 0)); + } +} + void Database::stop() { // FIXME: The net effect of the following code is to remove all pending transactions and statements, but allow the current statement diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h index f9fd3cd..495f98f 100644 --- a/WebCore/storage/Database.h +++ b/WebCore/storage/Database.h @@ -30,6 +30,7 @@ #define Database_h #if ENABLE(DATABASE) +#include "AbstractDatabase.h" #include "PlatformString.h" #include "SQLiteDatabase.h" #ifndef NDEBUG @@ -55,12 +56,9 @@ class VoidCallback; typedef int ExceptionCode; -class Database : public ThreadSafeShared<Database> { +class Database : public AbstractDatabase { public: - static void setIsAvailable(bool); - static bool isAvailable(); - - ~Database(); + virtual ~Database(); // Direct support for the DOM API static PassRefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, @@ -84,24 +82,25 @@ public: Vector<String> tableNames(); - ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext.get(); } - SecurityOrigin* securityOrigin() const; + virtual ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext.get(); } + virtual SecurityOrigin* securityOrigin() const; SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; } - String stringIdentifier() const; - String displayName() const; - unsigned long estimatedSize() const; - String fileName() const; + virtual String stringIdentifier() const; + virtual String displayName() const; + virtual unsigned long estimatedSize() const; + virtual String fileName() const; bool getVersionFromDatabase(String&); bool setVersionInDatabase(const String&); void setExpectedVersion(const String&); bool versionMatchesExpected() const; - void markAsDeletedAndClose(); + virtual void markAsDeletedAndClose(); bool deleted() const { return m_deleted; } enum ClosePolicy { DoNotRemoveDatabaseFromContext, RemoveDatabaseFromContext }; void close(ClosePolicy); + virtual void closeImmediately(); bool opened() const { return m_opened; } void stop(); diff --git a/WebCore/storage/DatabaseSync.cpp b/WebCore/storage/DatabaseSync.cpp index 224a75d..0d3bed5 100644 --- a/WebCore/storage/DatabaseSync.cpp +++ b/WebCore/storage/DatabaseSync.cpp @@ -46,18 +46,6 @@ const String& DatabaseSync::databaseInfoTableName() return name; } -static bool isSyncDatabaseAvailable = true; - -void DatabaseSync::setIsAvailable(bool available) -{ - isSyncDatabaseAvailable = available; -} - -bool DatabaseSync::isAvailable() -{ - return isSyncDatabaseAvailable; -} - PassRefPtr<DatabaseSync> DatabaseSync::openDatabaseSync(ScriptExecutionContext*, const String&, const String&, const String&, unsigned long, PassRefPtr<DatabaseCallback>, ExceptionCode& ec) { @@ -110,4 +98,3 @@ ScriptExecutionContext* DatabaseSync::scriptExecutionContext() const } // namespace WebCore #endif // ENABLE(DATABASE) - diff --git a/WebCore/storage/DatabaseSync.h b/WebCore/storage/DatabaseSync.h index 4b9985c..321b620 100644 --- a/WebCore/storage/DatabaseSync.h +++ b/WebCore/storage/DatabaseSync.h @@ -44,9 +44,6 @@ typedef int ExceptionCode; // Instances of this class should be created and used only on the worker's context thread. class DatabaseSync : public RefCounted<DatabaseSync> { public: - static void setIsAvailable(bool); - static bool isAvailable(); - ~DatabaseSync(); // Direct support for the DOM API diff --git a/WebCore/storage/DatabaseTracker.cpp b/WebCore/storage/DatabaseTracker.cpp index 752dbe6..cf56ff6 100644 --- a/WebCore/storage/DatabaseTracker.cpp +++ b/WebCore/storage/DatabaseTracker.cpp @@ -31,9 +31,9 @@ #if ENABLE(DATABASE) +#include "AbstractDatabase.h" #include "Chrome.h" #include "ChromeClient.h" -#include "Database.h" #include "DatabaseThread.h" #include "DatabaseTrackerClient.h" #include "Logging.h" @@ -219,7 +219,7 @@ bool DatabaseTracker::hasEntryForDatabase(SecurityOrigin* origin, const String& return statement.step() == SQLResultRow; } -unsigned long long DatabaseTracker::getMaxSizeForDatabase(const Database* database) +unsigned long long DatabaseTracker::getMaxSizeForDatabase(const AbstractDatabase* database) { ASSERT(currentThread() == database->scriptExecutionContext()->databaseThread()->getThreadID()); // The maximum size for a database is the full quota for its origin, minus the current usage within the origin, @@ -230,7 +230,7 @@ unsigned long long DatabaseTracker::getMaxSizeForDatabase(const Database* databa return quotaForOriginNoLock(origin) - originQuotaManager().diskUsage(origin) + SQLiteFileSystem::getDatabaseFileSize(database->fileName()); } -void DatabaseTracker::databaseChanged(Database* database) +void DatabaseTracker::databaseChanged(AbstractDatabase* database) { Locker<OriginQuotaManager> quotaManagerLocker(originQuotaManager()); originQuotaManager().markDatabase(database); @@ -479,7 +479,7 @@ unsigned long long DatabaseTracker::usageForDatabase(const String& name, Securit return SQLiteFileSystem::getDatabaseFileSize(path); } -void DatabaseTracker::addOpenDatabase(Database* database) +void DatabaseTracker::addOpenDatabase(AbstractDatabase* database) { if (!database) return; @@ -512,7 +512,7 @@ void DatabaseTracker::addOpenDatabase(Database* database) doneCreatingDatabase(database->securityOrigin(), database->stringIdentifier()); } -void DatabaseTracker::removeOpenDatabase(Database* database) +void DatabaseTracker::removeOpenDatabase(AbstractDatabase* database) { if (!database) return; @@ -559,7 +559,7 @@ void DatabaseTracker::removeOpenDatabase(Database* database) originQuotaManager().removeOrigin(database->securityOrigin()); } -void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<Database> >* databases) +void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<AbstractDatabase> >* databases) { MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); if (!m_openDatabaseMap) @@ -973,7 +973,7 @@ bool DatabaseTracker::deleteDatabaseFile(SecurityOrigin* origin, const String& n } #endif - Vector<RefPtr<Database> > deletedDatabases; + Vector<RefPtr<AbstractDatabase> > deletedDatabases; // Make sure not to hold the any locks when calling // Database::markAsDeletedAndClose(), since that can cause a deadlock diff --git a/WebCore/storage/DatabaseTracker.h b/WebCore/storage/DatabaseTracker.h index 223d4f2..b1267bc 100644 --- a/WebCore/storage/DatabaseTracker.h +++ b/WebCore/storage/DatabaseTracker.h @@ -44,7 +44,7 @@ namespace WebCore { -class Database; +class AbstractDatabase; class ScriptExecutionContext; class SecurityOrigin; @@ -70,17 +70,17 @@ public: void setDatabaseDetails(SecurityOrigin*, const String& name, const String& displayName, unsigned long estimatedSize); String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfDoesNotExist = true); - void addOpenDatabase(Database*); - void removeOpenDatabase(Database*); - void getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<Database> >* databases); + void addOpenDatabase(AbstractDatabase*); + void removeOpenDatabase(AbstractDatabase*); + void getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<AbstractDatabase> >* databases); - unsigned long long getMaxSizeForDatabase(const Database*); - void databaseChanged(Database*); + unsigned long long getMaxSizeForDatabase(const AbstractDatabase*); + void databaseChanged(AbstractDatabase*); private: DatabaseTracker(const String& databasePath); - typedef HashSet<Database*> DatabaseSet; + typedef HashSet<AbstractDatabase*> DatabaseSet; typedef HashMap<String, DatabaseSet*> DatabaseNameMap; typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*, SecurityOriginHash> DatabaseOriginMap; diff --git a/WebCore/storage/IDBObjectStoreImpl.h b/WebCore/storage/IDBObjectStoreImpl.h index 89a06db..89a06db 100755..100644 --- a/WebCore/storage/IDBObjectStoreImpl.h +++ b/WebCore/storage/IDBObjectStoreImpl.h diff --git a/WebCore/storage/IndexedDatabaseImpl.cpp b/WebCore/storage/IndexedDatabaseImpl.cpp index 793af9e..e6af901 100644 --- a/WebCore/storage/IndexedDatabaseImpl.cpp +++ b/WebCore/storage/IndexedDatabaseImpl.cpp @@ -40,7 +40,7 @@ namespace WebCore { PassRefPtr<IndexedDatabaseImpl> IndexedDatabaseImpl::create() { - return new IndexedDatabaseImpl(); + return adoptRef(new IndexedDatabaseImpl); } IndexedDatabaseImpl::IndexedDatabaseImpl() diff --git a/WebCore/storage/LocalStorageTask.cpp b/WebCore/storage/LocalStorageTask.cpp index 12cc083..d31c991 100644 --- a/WebCore/storage/LocalStorageTask.cpp +++ b/WebCore/storage/LocalStorageTask.cpp @@ -39,7 +39,7 @@ LocalStorageTask::LocalStorageTask(Type type, StorageAreaSync* area) , m_thread(0) { ASSERT(m_area); - ASSERT(m_type == AreaImport || m_type == AreaSync); + ASSERT(m_type == AreaImport || m_type == AreaSync || m_type == DeleteEmptyDatabase); } LocalStorageTask::LocalStorageTask(Type type, LocalStorageThread* thread) @@ -64,6 +64,9 @@ void LocalStorageTask::performTask() case AreaSync: m_area->performSync(); break; + case DeleteEmptyDatabase: + m_area->deleteEmptyDatabase(); + break; case TerminateThread: m_thread->performTerminate(); break; diff --git a/WebCore/storage/LocalStorageTask.h b/WebCore/storage/LocalStorageTask.h index dc3e7e2..8d53ce4 100644 --- a/WebCore/storage/LocalStorageTask.h +++ b/WebCore/storage/LocalStorageTask.h @@ -39,12 +39,13 @@ namespace WebCore { // FIXME: Rename this class to StorageTask class LocalStorageTask : public Noncopyable { public: - enum Type { AreaImport, AreaSync, TerminateThread }; + enum Type { AreaImport, AreaSync, DeleteEmptyDatabase, TerminateThread }; ~LocalStorageTask(); static PassOwnPtr<LocalStorageTask> createImport(StorageAreaSync* area) { return new LocalStorageTask(AreaImport, area); } static PassOwnPtr<LocalStorageTask> createSync(StorageAreaSync* area) { return new LocalStorageTask(AreaSync, area); } + static PassOwnPtr<LocalStorageTask> createDeleteEmptyDatabase(StorageAreaSync* area) { return new LocalStorageTask(DeleteEmptyDatabase, area); } static PassOwnPtr<LocalStorageTask> createTerminate(LocalStorageThread* thread) { return new LocalStorageTask(TerminateThread, thread); } void performTask(); diff --git a/WebCore/storage/OriginQuotaManager.cpp b/WebCore/storage/OriginQuotaManager.cpp index 88f75b8..0f415c1 100644 --- a/WebCore/storage/OriginQuotaManager.cpp +++ b/WebCore/storage/OriginQuotaManager.cpp @@ -30,7 +30,7 @@ #if ENABLE(DATABASE) -#include "Database.h" +#include "AbstractDatabase.h" #include "OriginUsageRecord.h" namespace WebCore { @@ -112,7 +112,7 @@ void OriginQuotaManager::removeOrigin(SecurityOrigin* origin) } } -void OriginQuotaManager::markDatabase(Database* database) +void OriginQuotaManager::markDatabase(AbstractDatabase* database) { ASSERT(database); ASSERT(m_usageRecordGuardLocked); diff --git a/WebCore/storage/OriginQuotaManager.h b/WebCore/storage/OriginQuotaManager.h index 33c201a..c904737 100644 --- a/WebCore/storage/OriginQuotaManager.h +++ b/WebCore/storage/OriginQuotaManager.h @@ -38,7 +38,7 @@ namespace WebCore { -class Database; +class AbstractDatabase; class OriginUsageRecord; class OriginQuotaManager : public Noncopyable { @@ -55,7 +55,7 @@ public: void removeDatabase(SecurityOrigin*, const String& databaseIdentifier); void removeOrigin(SecurityOrigin*); - void markDatabase(Database*); // Mark dirtiness of a specific database. + void markDatabase(AbstractDatabase*); // Mark dirtiness of a specific database. unsigned long long diskUsage(SecurityOrigin*) const; private: diff --git a/WebCore/storage/SQLError.h b/WebCore/storage/SQLError.h index 4414e6b..efbe4ec 100644 --- a/WebCore/storage/SQLError.h +++ b/WebCore/storage/SQLError.h @@ -43,6 +43,17 @@ public: unsigned code() const { return m_code; } String message() const { return m_message.threadsafeCopy(); } + enum SQLErrorCode { + UNKNOWN_ERR = 0, + DATABASE_ERR = 1, + VERSION_ERR = 2, + TOO_LARGE_ERR = 3, + QUOTA_ERR = 4, + SYNTAX_ERR = 5, + CONSTRAINT_ERR = 6, + TIMEOUT_ERR = 7 + }; + private: SQLError(unsigned code, const String& message) : m_code(code), m_message(message.threadsafeCopy()) { } unsigned m_code; diff --git a/WebCore/storage/SQLError.idl b/WebCore/storage/SQLError.idl index b50a8bc..87be8c7 100644 --- a/WebCore/storage/SQLError.idl +++ b/WebCore/storage/SQLError.idl @@ -35,5 +35,15 @@ module storage { ] SQLError { readonly attribute unsigned long code; readonly attribute DOMString message; + + // SQLErrorCode: used only in the async DB API + const unsigned short UNKNOWN_ERR = 0; + const unsigned short DATABASE_ERR = 1; + const unsigned short VERSION_ERR = 2; + const unsigned short TOO_LARGE_ERR = 3; + const unsigned short QUOTA_ERR = 4; + const unsigned short SYNTAX_ERR = 5; + const unsigned short CONSTRAINT_ERR = 6; + const unsigned short TIMEOUT_ERR = 7; }; } diff --git a/WebCore/storage/SQLException.h b/WebCore/storage/SQLException.h new file mode 100644 index 0000000..a0f118d --- /dev/null +++ b/WebCore/storage/SQLException.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifndef SQLException_h +#define SQLException_h + +#if ENABLE(DATABASE) + +#include "ExceptionBase.h" + +namespace WebCore { + +class SQLException : public ExceptionBase { +public: + static PassRefPtr<SQLException> create(const ExceptionCodeDescription& description) + { + return adoptRef(new SQLException(description)); + } + + static const int SQLExceptionOffset = 1000; + static const int SQLExceptionMax = 1099; + + enum SQLExceptionCode { + UNKNOWN_ERR = SQLExceptionOffset, + DATABASE_ERR = SQLExceptionOffset + 1, + VERSION_ERR = SQLExceptionOffset + 2, + TOO_LARGE_ERR = SQLExceptionOffset + 3, + QUOTA_ERR = SQLExceptionOffset + 4, + SYNTAX_ERR = SQLExceptionOffset + 5, + CONSTRAINT_ERR = SQLExceptionOffset + 6, + TIMEOUT_ERR = SQLExceptionOffset + 7 + }; + +private: + SQLException(const ExceptionCodeDescription& description) + : ExceptionBase(description) + { + } +}; + +} // namespace WebCore + +#endif // ENABLE(DATABASE) + +#endif // SQLException_h diff --git a/WebCore/storage/SQLException.idl b/WebCore/storage/SQLException.idl new file mode 100644 index 0000000..9830142 --- /dev/null +++ b/WebCore/storage/SQLException.idl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +module storage { + + interface [ + Conditional=DATABASE, + NoStaticTables + ] SQLException { + readonly attribute unsigned long code; + readonly attribute DOMString message; + + // SQLExceptionCode: used only in the sync DB API + const unsigned short UNKNOWN_ERR = 0; + const unsigned short DATABASE_ERR = 1; + const unsigned short VERSION_ERR = 2; + const unsigned short TOO_LARGE_ERR = 3; + const unsigned short QUOTA_ERR = 4; + const unsigned short SYNTAX_ERR = 5; + const unsigned short CONSTRAINT_ERR = 6; + const unsigned short TIMEOUT_ERR = 7; + }; +} diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp index cd96535..2d7d78e 100644 --- a/WebCore/storage/SQLStatement.cpp +++ b/WebCore/storage/SQLStatement.cpp @@ -78,7 +78,7 @@ bool SQLStatement::execute(Database* db) if (result != SQLResultOk) { LOG(StorageAPI, "Unable to verify correctness of statement %s - error %i (%s)", m_statement.ascii().data(), result, database->lastErrorMsg()); - m_error = SQLError::create(1, database->lastErrorMsg()); + m_error = SQLError::create(SQLError::SYNTAX_ERR, database->lastErrorMsg()); return false; } @@ -86,7 +86,7 @@ bool SQLStatement::execute(Database* db) // If this is the case, they might be trying to do something fishy or malicious if (statement.bindParameterCount() != m_arguments.size()) { LOG(StorageAPI, "Bind parameter count doesn't match number of question marks"); - m_error = SQLError::create(1, "number of '?'s in statement string does not match argument count"); + m_error = SQLError::create(SQLError::SYNTAX_ERR, "number of '?'s in statement string does not match argument count"); return false; } @@ -99,7 +99,7 @@ bool SQLStatement::execute(Database* db) if (result != SQLResultOk) { LOG(StorageAPI, "Failed to bind value index %i to statement for query '%s'", i + 1, m_statement.ascii().data()); - m_error = SQLError::create(1, database->lastErrorMsg()); + m_error = SQLError::create(SQLError::DATABASE_ERR, database->lastErrorMsg()); return false; } } @@ -123,7 +123,7 @@ bool SQLStatement::execute(Database* db) } while (result == SQLResultRow); if (result != SQLResultDone) { - m_error = SQLError::create(1, database->lastErrorMsg()); + m_error = SQLError::create(SQLError::DATABASE_ERR, database->lastErrorMsg()); return false; } } else if (result == SQLResultDone) { @@ -135,7 +135,7 @@ bool SQLStatement::execute(Database* db) setFailureDueToQuota(); return false; } else { - m_error = SQLError::create(1, database->lastErrorMsg()); + m_error = SQLError::create(SQLError::DATABASE_ERR, database->lastErrorMsg()); return false; } @@ -151,13 +151,13 @@ bool SQLStatement::execute(Database* db) void SQLStatement::setDatabaseDeletedError() { ASSERT(!m_error && !m_resultSet); - m_error = SQLError::create(0, "unable to execute statement, because the user deleted the database"); + m_error = SQLError::create(SQLError::UNKNOWN_ERR, "unable to execute statement, because the user deleted the database"); } void SQLStatement::setVersionMismatchedError() { ASSERT(!m_error && !m_resultSet); - m_error = SQLError::create(2, "current version of the database and `oldVersion` argument do not match"); + m_error = SQLError::create(SQLError::VERSION_ERR, "current version of the database and `oldVersion` argument do not match"); } bool SQLStatement::performCallback(SQLTransaction* transaction) @@ -184,7 +184,7 @@ bool SQLStatement::performCallback(SQLTransaction* transaction) void SQLStatement::setFailureDueToQuota() { ASSERT(!m_error && !m_resultSet); - m_error = SQLError::create(4, "there was not enough remaining storage space, or the storage quota was reached and the user declined to allow more space"); + m_error = SQLError::create(SQLError::QUOTA_ERR, "there was not enough remaining storage space, or the storage quota was reached and the user declined to allow more space"); } void SQLStatement::clearFailureDueToQuota() @@ -195,7 +195,7 @@ void SQLStatement::clearFailureDueToQuota() bool SQLStatement::lastExecutionFailedDueToQuota() const { - return m_error && m_error->code() == 4; + return m_error && m_error->code() == SQLError::QUOTA_ERR; } } // namespace WebCore diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index b06d865..5a1e2b0 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -241,7 +241,7 @@ void SQLTransaction::openTransactionAndPreflight() // If the database was deleted, jump to the error callback if (m_database->deleted()) { - m_transactionError = SQLError::create(0, "unable to open a transaction, because the user deleted the database"); + m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to open a transaction, because the user deleted the database"); handleTransactionError(false); return; } @@ -262,7 +262,7 @@ void SQLTransaction::openTransactionAndPreflight() if (!m_sqliteTransaction->inProgress()) { ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_sqliteTransaction.clear(); - m_transactionError = SQLError::create(0, "unable to open a transaction to the database"); + m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to open a transaction to the database"); handleTransactionError(false); return; } @@ -273,7 +273,7 @@ void SQLTransaction::openTransactionAndPreflight() m_sqliteTransaction.clear(); m_transactionError = m_wrapper->sqlError(); if (!m_transactionError) - m_transactionError = SQLError::create(0, "unknown error occured setting up transaction"); + m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "unknown error occured setting up transaction"); handleTransactionError(false); return; @@ -298,7 +298,7 @@ void SQLTransaction::deliverTransactionCallback() // Transaction Step 5 - If the transaction callback was null or raised an exception, jump to the error callback if (shouldDeliverErrorCallback) { - m_transactionError = SQLError::create(0, "the SQLTransactionCallback was null or threw an exception"); + m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "the SQLTransactionCallback was null or threw an exception"); deliverTransactionErrorCallback(); } else scheduleToRunStatements(); @@ -405,7 +405,7 @@ void SQLTransaction::handleCurrentStatementError() } else { m_transactionError = m_currentStatement->sqlError(); if (!m_transactionError) - m_transactionError = SQLError::create(1, "the statement failed to execute"); + m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "the statement failed to execute"); handleTransactionError(false); } } @@ -421,7 +421,7 @@ void SQLTransaction::deliverStatementCallback() m_executeSqlAllowed = false; if (result) { - m_transactionError = SQLError::create(0, "the statement callback raised an exception or statement error callback did not return false"); + m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "the statement callback raised an exception or statement error callback did not return false"); handleTransactionError(true); } else scheduleToRunStatements(); @@ -447,7 +447,7 @@ void SQLTransaction::postflightAndCommit() if (m_wrapper && !m_wrapper->performPostflight(this)) { m_transactionError = m_wrapper->sqlError(); if (!m_transactionError) - m_transactionError = SQLError::create(0, "unknown error occured setting up transaction"); + m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "unknown error occured setting up transaction"); handleTransactionError(false); return; } @@ -461,7 +461,7 @@ void SQLTransaction::postflightAndCommit() // If the commit failed, the transaction will still be marked as "in progress" if (m_sqliteTransaction->inProgress()) { - m_transactionError = SQLError::create(0, "failed to commit the transaction"); + m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "failed to commit the transaction"); handleTransactionError(false); return; } diff --git a/WebCore/storage/StorageAreaImpl.cpp b/WebCore/storage/StorageAreaImpl.cpp index aa04781..dc25e54 100644 --- a/WebCore/storage/StorageAreaImpl.cpp +++ b/WebCore/storage/StorageAreaImpl.cpp @@ -44,12 +44,7 @@ StorageAreaImpl::~StorageAreaImpl() ASSERT(isMainThread()); } -PassRefPtr<StorageAreaImpl> StorageAreaImpl::create(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota) -{ - return adoptRef(new StorageAreaImpl(storageType, origin, syncManager, quota)); -} - -StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota) +inline StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota) : m_storageType(storageType) , m_securityOrigin(origin) , m_storageMap(StorageMap::create(quota)) @@ -61,13 +56,20 @@ StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<SecurityOri ASSERT(isMainThread()); ASSERT(m_securityOrigin); ASSERT(m_storageMap); +} + +PassRefPtr<StorageAreaImpl> StorageAreaImpl::create(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota) +{ + RefPtr<StorageAreaImpl> area = adoptRef(new StorageAreaImpl(storageType, origin, syncManager, quota)); // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing, - // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894 - if (m_storageSyncManager) { - m_storageAreaSync = StorageAreaSync::create(m_storageSyncManager, this, m_securityOrigin->databaseIdentifier()); - ASSERT(m_storageAreaSync); + // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894 + if (area->m_storageSyncManager) { + area->m_storageAreaSync = StorageAreaSync::create(area->m_storageSyncManager, area.get(), area->m_securityOrigin->databaseIdentifier()); + ASSERT(area->m_storageAreaSync); } + + return area.release(); } PassRefPtr<StorageAreaImpl> StorageAreaImpl::copy() diff --git a/WebCore/storage/StorageAreaSync.cpp b/WebCore/storage/StorageAreaSync.cpp index 59f558b..e20f11c 100644 --- a/WebCore/storage/StorageAreaSync.cpp +++ b/WebCore/storage/StorageAreaSync.cpp @@ -31,8 +31,9 @@ #include "EventNames.h" #include "FileSystem.h" #include "HTMLElement.h" -#include "SecurityOrigin.h" +#include "SQLiteFileSystem.h" #include "SQLiteStatement.h" +#include "SecurityOrigin.h" #include "StorageAreaImpl.h" #include "StorageSyncManager.h" #include "SuddenTermination.h" @@ -101,6 +102,7 @@ void StorageAreaSync::scheduleFinalSync() // we should do it safely. m_finalSyncScheduled = true; syncTimerFired(&m_syncTimer); + m_syncManager->scheduleDeleteEmptyDatabase(this); } void StorageAreaSync::scheduleItemForSync(const String& key, const String& value) @@ -306,6 +308,8 @@ void StorageAreaSync::sync(bool clearItems, const HashMap<String, String>& items { ASSERT(!isMainThread()); + if (items.isEmpty() && !clearItems) + return; if (m_databaseOpenFailed) return; if (!m_database.isOpen()) @@ -393,6 +397,34 @@ void StorageAreaSync::performSync() enableSuddenTermination(); } +void StorageAreaSync::deleteEmptyDatabase() +{ + ASSERT(!isMainThread()); + if (!m_database.isOpen()) + return; + + SQLiteStatement query(m_database, "SELECT COUNT(*) FROM ItemTable"); + if (query.prepare() != SQLResultOk) { + LOG_ERROR("Unable to count number of rows in ItemTable for local storage"); + return; + } + + int result = query.step(); + if (result != SQLResultRow) { + LOG_ERROR("No results when counting number of rows in ItemTable for local storage"); + return; + } + + int count = query.getColumnInt(0); + if (!count) { + query.finalize(); + m_database.close(); + String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier); + if (!SQLiteFileSystem::deleteDatabaseFile(databaseFilename)) + LOG_ERROR("Failed to delete database file %s\n", databaseFilename.utf8().data()); + } +} + } // namespace WebCore #endif // ENABLE(DOM_STORAGE) diff --git a/WebCore/storage/StorageAreaSync.h b/WebCore/storage/StorageAreaSync.h index d26d399..a26b041 100644 --- a/WebCore/storage/StorageAreaSync.h +++ b/WebCore/storage/StorageAreaSync.h @@ -73,6 +73,7 @@ namespace WebCore { // Called from the background thread void performImport(); void performSync(); + void deleteEmptyDatabase(); private: enum OpenDatabaseParamType { diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp index b505d1d..557dd76 100644 --- a/WebCore/storage/StorageNamespaceImpl.cpp +++ b/WebCore/storage/StorageNamespaceImpl.cpp @@ -108,7 +108,7 @@ PassRefPtr<StorageArea> StorageNamespaceImpl::storageArea(PassRefPtr<SecurityOri RefPtr<SecurityOrigin> origin = prpOrigin; RefPtr<StorageAreaImpl> storageArea; - if (storageArea = m_storageAreaMap.get(origin)) + if ((storageArea = m_storageAreaMap.get(origin))) return storageArea.release(); storageArea = StorageAreaImpl::create(m_storageType, origin, m_syncManager, m_quota); diff --git a/WebCore/storage/StorageSyncManager.cpp b/WebCore/storage/StorageSyncManager.cpp index ebf35bd..1cf8306 100644 --- a/WebCore/storage/StorageSyncManager.cpp +++ b/WebCore/storage/StorageSyncManager.cpp @@ -100,6 +100,13 @@ void StorageSyncManager::scheduleSync(PassRefPtr<StorageAreaSync> area) m_thread->scheduleTask(LocalStorageTask::createSync(area.get())); } +void StorageSyncManager::scheduleDeleteEmptyDatabase(PassRefPtr<StorageAreaSync> area) +{ + ASSERT(isMainThread()); + ASSERT(m_thread); + if (m_thread) + m_thread->scheduleTask(LocalStorageTask::createDeleteEmptyDatabase(area.get())); +} } // namespace WebCore #endif // ENABLE(DOM_STORAGE) diff --git a/WebCore/storage/StorageSyncManager.h b/WebCore/storage/StorageSyncManager.h index e2dfa76..6fbb75d 100644 --- a/WebCore/storage/StorageSyncManager.h +++ b/WebCore/storage/StorageSyncManager.h @@ -47,6 +47,7 @@ namespace WebCore { bool scheduleImport(PassRefPtr<StorageAreaSync>); void scheduleSync(PassRefPtr<StorageAreaSync>); + void scheduleDeleteEmptyDatabase(PassRefPtr<StorageAreaSync>); void close(); diff --git a/WebCore/storage/chromium/DatabaseObserver.h b/WebCore/storage/chromium/DatabaseObserver.h index 4e266c1..e2e5184 100644 --- a/WebCore/storage/chromium/DatabaseObserver.h +++ b/WebCore/storage/chromium/DatabaseObserver.h @@ -33,7 +33,7 @@ namespace WebCore { -class Database; +class AbstractDatabase; class ScriptExecutionContext; class String; @@ -42,9 +42,9 @@ class String; class DatabaseObserver { public: static bool canEstablishDatabase(ScriptExecutionContext*, const String&, const String&, unsigned long); - static void databaseOpened(Database*); - static void databaseModified(Database*); - static void databaseClosed(Database*); + static void databaseOpened(AbstractDatabase*); + static void databaseModified(AbstractDatabase*); + static void databaseClosed(AbstractDatabase*); }; } diff --git a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp index 9d2a942..13c65cc 100644 --- a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp +++ b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "DatabaseTracker.h" -#include "Database.h" +#include "AbstractDatabase.h" #include "DatabaseObserver.h" #include "DatabaseThread.h" #include "QuotaTracker.h" @@ -72,7 +72,7 @@ String DatabaseTracker::fullPathForDatabase(SecurityOrigin* origin, const String return origin->databaseIdentifier() + "/" + name + "#"; } -void DatabaseTracker::addOpenDatabase(Database* database) +void DatabaseTracker::addOpenDatabase(AbstractDatabase* database) { ASSERT(database->scriptExecutionContext()->isContextThread()); MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); @@ -99,7 +99,7 @@ void DatabaseTracker::addOpenDatabase(Database* database) class TrackerRemoveOpenDatabaseTask : public ScriptExecutionContext::Task { public: - static PassOwnPtr<TrackerRemoveOpenDatabaseTask> create(PassRefPtr<Database> database) + static PassOwnPtr<TrackerRemoveOpenDatabaseTask> create(PassRefPtr<AbstractDatabase> database) { return new TrackerRemoveOpenDatabaseTask(database); } @@ -110,15 +110,15 @@ public: } private: - TrackerRemoveOpenDatabaseTask(PassRefPtr<Database> database) + TrackerRemoveOpenDatabaseTask(PassRefPtr<AbstractDatabase> database) : m_database(database) { } - RefPtr<Database> m_database; + RefPtr<AbstractDatabase> m_database; }; -void DatabaseTracker::removeOpenDatabase(Database* database) +void DatabaseTracker::removeOpenDatabase(AbstractDatabase* database) { if (!database->scriptExecutionContext()->isContextThread()) { database->scriptExecutionContext()->postTask(TrackerRemoveOpenDatabaseTask::create(database)); @@ -147,7 +147,7 @@ void DatabaseTracker::removeOpenDatabase(Database* database) } -void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<Database> >* databases) +void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& name, HashSet<RefPtr<AbstractDatabase> >* databases) { MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); if (!m_openDatabaseMap) @@ -165,7 +165,7 @@ void DatabaseTracker::getOpenDatabases(SecurityOrigin* origin, const String& nam databases->add(*it); } -unsigned long long DatabaseTracker::getMaxSizeForDatabase(const Database* database) +unsigned long long DatabaseTracker::getMaxSizeForDatabase(const AbstractDatabase* database) { ASSERT(currentThread() == database->scriptExecutionContext()->databaseThread()->getThreadID()); unsigned long long spaceAvailable = 0; diff --git a/WebCore/svg/SVGDocument.cpp b/WebCore/svg/SVGDocument.cpp index 2264a11..b449390 100644 --- a/WebCore/svg/SVGDocument.cpp +++ b/WebCore/svg/SVGDocument.cpp @@ -35,8 +35,8 @@ namespace WebCore { -SVGDocument::SVGDocument(Frame* frame) - : Document(frame, false, false) +SVGDocument::SVGDocument(Frame* frame, const KURL& url) + : Document(frame, url, false, false) { } diff --git a/WebCore/svg/SVGDocument.h b/WebCore/svg/SVGDocument.h index c7006f9..49e2746 100644 --- a/WebCore/svg/SVGDocument.h +++ b/WebCore/svg/SVGDocument.h @@ -33,9 +33,9 @@ namespace WebCore { class SVGDocument : public Document { public: - static PassRefPtr<SVGDocument> create(Frame* frame) + static PassRefPtr<SVGDocument> create(Frame* frame, const KURL& url) { - return adoptRef(new SVGDocument(frame)); + return adoptRef(new SVGDocument(frame, url)); } virtual ~SVGDocument(); @@ -51,7 +51,7 @@ namespace WebCore { void updatePan(const FloatPoint& pos) const; private: - SVGDocument(Frame*); + SVGDocument(Frame*, const KURL&); virtual bool isSVGDocument() const { return true; } diff --git a/WebCore/svg/SVGElement.idl b/WebCore/svg/SVGElement.idl index 27fcb8d..cecaa18 100644 --- a/WebCore/svg/SVGElement.idl +++ b/WebCore/svg/SVGElement.idl @@ -23,10 +23,8 @@ module svg { interface [GenerateNativeConverter, Conditional=SVG] SVGElement : Element { - attribute [ConvertNullToNullString, Reflect] DOMString id - setter raises(DOMException); - attribute [ConvertNullToNullString] DOMString xmlbase - setter raises(DOMException); + attribute [Reflect] DOMString id setter raises(DOMException); + attribute [ConvertNullToNullString] DOMString xmlbase setter raises(DOMException); readonly attribute SVGSVGElement ownerSVGElement; readonly attribute SVGElement viewportElement; }; diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp index 049d35e..5436688 100644 --- a/WebCore/svg/SVGFont.cpp +++ b/WebCore/svg/SVGFont.cpp @@ -571,7 +571,7 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, } } -FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const IntPoint& point, int height, int from, int to) const +FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const FloatPoint& point, int height, int from, int to) const { int charsConsumed; String glyphName; @@ -580,7 +580,7 @@ FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const IntPo point.y(), floatWidthOfSubStringUsingSVGFont(this, run, 0, from, to, charsConsumed, glyphName), height); } -int Font::offsetForPositionForTextUsingSVGFont(const TextRun&, int, bool) const +int Font::offsetForPositionForTextUsingSVGFont(const TextRun&, float, bool) const { // TODO: Fix text selection when HTML text is drawn using a SVG Font // We need to integrate the SVG text selection code in the offsetForPosition() framework. diff --git a/WebCore/svg/SVGForeignObjectElement.cpp b/WebCore/svg/SVGForeignObjectElement.cpp index 9dc61c9..e3e8fab 100644 --- a/WebCore/svg/SVGForeignObjectElement.cpp +++ b/WebCore/svg/SVGForeignObjectElement.cpp @@ -131,6 +131,10 @@ RenderObject* SVGForeignObjectElement::createRenderer(RenderArena* arena, Render bool SVGForeignObjectElement::childShouldCreateRenderer(Node* child) const { + // Disallow arbitary SVG content. Only allow proper <svg xmlns="svgNS"> subdocuments. + if (child->isSVGElement()) + return child->hasTagName(SVGNames::svgTag); + // Skip over SVG rules which disallow non-SVG kids return StyledElement::childShouldCreateRenderer(child); } diff --git a/WebCore/svg/SVGPaint.cpp b/WebCore/svg/SVGPaint.cpp index 3b39b91..82a5fe4 100644 --- a/WebCore/svg/SVGPaint.cpp +++ b/WebCore/svg/SVGPaint.cpp @@ -66,14 +66,14 @@ SVGPaint::~SVGPaint() SVGPaint* SVGPaint::defaultFill() { - static SVGPaint* _defaultFill = new SVGPaint(Color::black); - return _defaultFill; + static SVGPaint* staticDefaultFill = create(Color::black).releaseRef(); + return staticDefaultFill; } SVGPaint* SVGPaint::defaultStroke() { - static SVGPaint* _defaultStroke = new SVGPaint(SVG_PAINTTYPE_NONE); - return _defaultStroke; + static SVGPaint* staticDefaultStroke = create(SVG_PAINTTYPE_NONE).releaseRef(); + return staticDefaultStroke; } String SVGPaint::uri() const diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp index 4b14a1f..154ad7a 100644 --- a/WebCore/svg/SVGSVGElement.cpp +++ b/WebCore/svg/SVGSVGElement.cpp @@ -522,6 +522,10 @@ bool SVGSVGElement::isOutermostSVG() const if (!parentNode()) return true; + // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element. + if (parentNode()->hasTagName(SVGNames::foreignObjectTag)) + return true; + // This is true whenever this is the outermost SVG, even if there are HTML elements outside it return !parentNode()->isSVGElement(); } diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp index 61c68b6..abe77a9 100644 --- a/WebCore/svg/SVGScriptElement.cpp +++ b/WebCore/svg/SVGScriptElement.cpp @@ -199,6 +199,16 @@ String SVGScriptElement::eventAttributeValue() const return String(); } +bool SVGScriptElement::asyncAttributeValue() const +{ + return false; +} + +bool SVGScriptElement::deferAttributeValue() const +{ + return false; +} + void SVGScriptElement::dispatchLoadEvent() { bool externalResourcesRequired = externalResourcesRequiredBaseValue(); diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h index b864ad5..770dc89 100644 --- a/WebCore/svg/SVGScriptElement.h +++ b/WebCore/svg/SVGScriptElement.h @@ -67,6 +67,8 @@ namespace WebCore { virtual String languageAttributeValue() const; virtual String forAttributeValue() const; virtual String eventAttributeValue() const; + virtual bool asyncAttributeValue() const; + virtual bool deferAttributeValue() const; virtual void dispatchLoadEvent(); virtual void dispatchErrorEvent(); diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index bd461c0..10cc793 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -228,12 +228,7 @@ void SVGStyledElement::parseMappedAttribute(Attribute* attr) bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName) { - // Recognize all style related SVG CSS properties - int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName); - if (propId > 0) - return true; - - return isIdAttributeName(attrName) || attrName == HTMLNames::styleAttr; + return isIdAttributeName(attrName); } void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName) diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp index 4fef0ee..12b9b31 100644 --- a/WebCore/svg/SVGTextContentElement.cpp +++ b/WebCore/svg/SVGTextContentElement.cpp @@ -23,23 +23,12 @@ #if ENABLE(SVG) #include "SVGTextContentElement.h" -#include "Attribute.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" -#include "ExceptionCode.h" -#include "FloatPoint.h" -#include "FloatRect.h" #include "Frame.h" -#include "Position.h" -#include "RenderSVGText.h" -#include "SVGCharacterData.h" -#include "SVGInlineTextBox.h" -#include "SVGLength.h" -#include "SVGNames.h" -#include "SVGRootInlineBox.h" +#include "SVGTextQuery.h" #include "SelectionController.h" #include "XMLNames.h" -#include <wtf/StdLibExtras.h> namespace WebCore { @@ -57,330 +46,16 @@ SVGTextContentElement::~SVGTextContentElement() { } -static inline float cumulativeCharacterRangeLength(const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end, SVGInlineTextBox* textBox, - int startOffset, long startPosition, long length, bool isVerticalText, long& atCharacter) -{ - if (!length) - return 0.0f; - - float textLength = 0.0f; - RenderStyle* style = textBox->textRenderer()->style(); - - bool usesFullRange = (startPosition == -1 && length == -1); - - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (usesFullRange || (atCharacter >= startPosition && atCharacter <= startPosition + length)) { - unsigned int newOffset = textBox->start() + (it - start) + startOffset; - - // Take RTL text into account and pick right glyph width/height. - if (textBox->direction() == RTL) - newOffset = textBox->start() + textBox->end() - newOffset; - - // FIXME: does this handle multichar glyphs ok? not sure - int charsConsumed = 0; - String glyphName; - if (isVerticalText) - textLength += textBox->calculateGlyphHeight(style, newOffset, 0); - else - textLength += textBox->calculateGlyphWidth(style, newOffset, 0, charsConsumed, glyphName); - } - - if (!usesFullRange) { - if (atCharacter == startPosition + length - 1) - break; - - atCharacter++; - } - } - - return textLength; -} - -// Helper class for querying certain glyph information -struct SVGInlineTextBoxQueryWalker { - typedef enum { - NumberOfCharacters, - TextLength, - SubStringLength, - StartPosition, - EndPosition, - Extent, - Rotation, - CharacterNumberAtPosition - } QueryMode; - - SVGInlineTextBoxQueryWalker(const SVGTextContentElement* reference, QueryMode mode) - : m_reference(reference) - , m_mode(mode) - , m_queryStartPosition(0) - , m_queryLength(0) - , m_queryPointInput() - , m_queryLongResult(0) - , m_queryFloatResult(0.0f) - , m_queryPointResult() - , m_queryRectResult() - , m_stopProcessing(true) - , m_atCharacter(0) - { - } - - void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform&, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - RenderStyle* style = textBox->textRenderer()->style(); - bool isVerticalText = style->svgStyle()->writingMode() == WM_TBRL || style->svgStyle()->writingMode() == WM_TB; - - switch (m_mode) { - case NumberOfCharacters: - { - m_queryLongResult += (end - start); - m_stopProcessing = false; - return; - } - case TextLength: - { - float textLength = cumulativeCharacterRangeLength(start, end, textBox, startOffset, -1, -1, isVerticalText, m_atCharacter); - - if (isVerticalText) - m_queryFloatResult += textLength; - else - m_queryFloatResult += textLength; - - m_stopProcessing = false; - return; - } - case SubStringLength: - { - long startPosition = m_queryStartPosition; - long length = m_queryLength; - - float textLength = cumulativeCharacterRangeLength(start, end, textBox, startOffset, startPosition, length, isVerticalText, m_atCharacter); - - if (isVerticalText) - m_queryFloatResult += textLength; - else - m_queryFloatResult += textLength; - - if (m_atCharacter == startPosition + length) - m_stopProcessing = true; - else - m_stopProcessing = false; - - return; - } - case StartPosition: - { - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (m_atCharacter == m_queryStartPosition) { - m_queryPointResult = FloatPoint(it->x, it->y); - m_stopProcessing = true; - return; - } - - m_atCharacter++; - } - - m_stopProcessing = false; - return; - } - case EndPosition: - { - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (m_atCharacter == m_queryStartPosition) { - unsigned int newOffset = textBox->start() + (it - start) + startOffset; - - // Take RTL text into account and pick right glyph width/height. - if (textBox->direction() == RTL) - newOffset = textBox->start() + textBox->end() - newOffset; - - int charsConsumed; - String glyphName; - // calculateGlyph{Height,Width} will consume at least one character. This is the number of characters available - // to them beyond that first one. - int extraCharactersAvailable = end - it - 1; - if (isVerticalText) - m_queryPointResult.move(it->x, it->y + textBox->calculateGlyphHeight(style, newOffset, extraCharactersAvailable)); - else - m_queryPointResult.move(it->x + textBox->calculateGlyphWidth(style, newOffset, extraCharactersAvailable, charsConsumed, glyphName), it->y); - - m_stopProcessing = true; - return; - } - - m_atCharacter++; - } - - m_stopProcessing = false; - return; - } - case Extent: - { - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (m_atCharacter == m_queryStartPosition) { - unsigned int newOffset = textBox->start() + (it - start) + startOffset; - m_queryRectResult = textBox->calculateGlyphBoundaries(style, newOffset, *it); - m_stopProcessing = true; - return; - } - - m_atCharacter++; - } - - m_stopProcessing = false; - return; - } - case Rotation: - { - for (Vector<SVGChar>::iterator it = start; it != end; ++it) { - if (m_atCharacter == m_queryStartPosition) { - m_queryFloatResult = it->angle; - m_stopProcessing = true; - return; - } - - m_atCharacter++; - } - - m_stopProcessing = false; - return; - } - case CharacterNumberAtPosition: - { - int offset = 0; - SVGChar* charAtPos = textBox->closestCharacterToPosition(m_queryPointInput.x(), m_queryPointInput.y(), offset); - - offset += m_atCharacter; - if (charAtPos && offset > m_queryLongResult) - m_queryLongResult = offset; - - m_atCharacter += end - start; - m_stopProcessing = false; - return; - } - default: - ASSERT_NOT_REACHED(); - m_stopProcessing = true; - return; - } - } - - void setQueryInputParameters(long startPosition, long length, FloatPoint referencePoint) - { - m_queryStartPosition = startPosition; - m_queryLength = length; - m_queryPointInput = referencePoint; - } - - long longResult() const { return m_queryLongResult; } - float floatResult() const { return m_queryFloatResult; } - FloatPoint pointResult() const { return m_queryPointResult; } - FloatRect rectResult() const { return m_queryRectResult; } - bool stopProcessing() const { return m_stopProcessing; } - -private: - const SVGTextContentElement* m_reference; - QueryMode m_mode; - - long m_queryStartPosition; - long m_queryLength; - FloatPoint m_queryPointInput; - - long m_queryLongResult; - float m_queryFloatResult; - FloatPoint m_queryPointResult; - FloatRect m_queryRectResult; - - bool m_stopProcessing; - long m_atCharacter; -}; - -static Vector<SVGInlineTextBox*> findInlineTextBoxInTextChunks(const SVGTextContentElement* element, const Vector<SVGTextChunk>& chunks) -{ - Vector<SVGTextChunk>::const_iterator it = chunks.begin(); - const Vector<SVGTextChunk>::const_iterator end = chunks.end(); - - Vector<SVGInlineTextBox*> boxes; - - for (; it != end; ++it) { - Vector<SVGInlineBoxCharacterRange>::const_iterator boxIt = it->boxes.begin(); - const Vector<SVGInlineBoxCharacterRange>::const_iterator boxEnd = it->boxes.end(); - - for (; boxIt != boxEnd; ++boxIt) { - SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(boxIt->box); - - Node* textElement = textBox->textRenderer()->parent()->node(); - ASSERT(textElement); - - if (textElement == element || textElement->parent() == element) - boxes.append(textBox); - } - } - - return boxes; -} - -static inline SVGRootInlineBox* rootInlineBoxForTextContentElement(const SVGTextContentElement* element) -{ - RenderObject* object = element->renderer(); - - if (!object || !object->isSVGText() || object->isText()) - return 0; - - RenderBlock* svgText = toRenderBlock(object); - - // Find root inline box - SVGRootInlineBox* rootBox = static_cast<SVGRootInlineBox*>(svgText->firstRootBox()); - if (!rootBox) { - // Layout is not sync yet! - element->document()->updateLayoutIgnorePendingStylesheets(); - rootBox = static_cast<SVGRootInlineBox*>(svgText->firstRootBox()); - } - - ASSERT(rootBox); - return rootBox; -} - -static inline SVGInlineTextBoxQueryWalker executeTextQuery(const SVGTextContentElement* element, SVGInlineTextBoxQueryWalker::QueryMode mode, - long startPosition = 0, long length = 0, FloatPoint referencePoint = FloatPoint()) -{ - SVGRootInlineBox* rootBox = rootInlineBoxForTextContentElement(element); - if (!rootBox) - return SVGInlineTextBoxQueryWalker(0, mode); - - // Find all inline text box associated with our renderer - Vector<SVGInlineTextBox*> textBoxes = findInlineTextBoxInTextChunks(element, rootBox->svgTextChunks()); - - // Walk text chunks to find chunks associated with our inline text box - SVGInlineTextBoxQueryWalker walkerCallback(element, mode); - walkerCallback.setQueryInputParameters(startPosition, length, referencePoint); - - SVGTextChunkWalker<SVGInlineTextBoxQueryWalker> walker(&walkerCallback, &SVGInlineTextBoxQueryWalker::chunkPortionCallback); - - Vector<SVGInlineTextBox*>::iterator it = textBoxes.begin(); - Vector<SVGInlineTextBox*>::iterator end = textBoxes.end(); - - for (; it != end; ++it) { - rootBox->walkTextChunks(&walker, *it); - - if (walkerCallback.stopProcessing()) - break; - } - - return walkerCallback; -} - unsigned SVGTextContentElement::getNumberOfChars() const { document()->updateLayoutIgnorePendingStylesheets(); - - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::NumberOfCharacters).longResult(); + return SVGTextQuery(renderer()).numberOfCharacters(); } float SVGTextContentElement::getComputedTextLength() const { document()->updateLayoutIgnorePendingStylesheets(); - - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::TextLength).floatResult(); + return SVGTextQuery(renderer()).textLength(); } float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec) const @@ -393,7 +68,7 @@ float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar return 0.0f; } - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::SubStringLength, charnum, nchars).floatResult(); + return SVGTextQuery(renderer()).subStringLength(charnum, nchars); } FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec) const @@ -405,7 +80,7 @@ FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excep return FloatPoint(); } - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::StartPosition, charnum).pointResult(); + return SVGTextQuery(renderer()).startPositionOfCharacter(charnum); } FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec) const @@ -417,7 +92,7 @@ FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, Excepti return FloatPoint(); } - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::EndPosition, charnum).pointResult(); + return SVGTextQuery(renderer()).endPositionOfCharacter(charnum); } FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec) const @@ -429,7 +104,7 @@ FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode return FloatRect(); } - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Extent, charnum).rectResult(); + return SVGTextQuery(renderer()).extentOfCharacter(charnum); } float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& ec) const @@ -441,14 +116,13 @@ float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& return 0.0f; } - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Rotation, charnum).floatResult(); + return SVGTextQuery(renderer()).rotationOfCharacter(charnum); } int SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const { document()->updateLayoutIgnorePendingStylesheets(); - - return executeTextQuery(this, SVGInlineTextBoxQueryWalker::CharacterNumberAtPosition, 0.0f, 0.0f, point).longResult(); + return SVGTextQuery(renderer()).characterNumberAtPosition(point); } void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionCode& ec) const diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp index f62dc68..0aba04b 100644 --- a/WebCore/svg/SVGTextElement.cpp +++ b/WebCore/svg/SVGTextElement.cpp @@ -132,16 +132,6 @@ void SVGTextElement::synchronizeProperty(const QualifiedName& attrName) synchronizeTransform(); } -void SVGTextElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) -{ - SVGTextPositioningElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - - if (!renderer()) - return; - - renderer()->setNeedsLayout(true); -} - } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h index 4c7db90..1bb8f5a 100644 --- a/WebCore/svg/SVGTextElement.h +++ b/WebCore/svg/SVGTextElement.h @@ -50,7 +50,6 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); private: DECLARE_ANIMATED_PROPERTY(SVGTextElement, SVGNames::transformAttr, SVGTransformList*, Transform, transform) diff --git a/WebCore/svg/animation/SMILTimeContainer.h b/WebCore/svg/animation/SMILTimeContainer.h index e11cc6f..1e1007e 100644 --- a/WebCore/svg/animation/SMILTimeContainer.h +++ b/WebCore/svg/animation/SMILTimeContainer.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SMILTimeContainer_H -#define SMILTimeContainer_H +#ifndef SMILTimeContainer_h +#define SMILTimeContainer_h #if ENABLE(SVG) diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.h b/WebCore/svg/graphics/filters/SVGFilterBuilder.h index 89d55e1..1cf583d 100644 --- a/WebCore/svg/graphics/filters/SVGFilterBuilder.h +++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.h @@ -34,7 +34,7 @@ namespace WebCore { class SVGFilterBuilder : public RefCounted<SVGFilterBuilder> { public: - SVGFilterBuilder(); + static PassRefPtr<SVGFilterBuilder> create() { return adoptRef(new SVGFilterBuilder); } void add(const AtomicString& id, RefPtr<FilterEffect> effect); @@ -46,6 +46,8 @@ namespace WebCore { void clearEffects(); private: + SVGFilterBuilder(); + HashMap<AtomicString, RefPtr<FilterEffect> > m_builtinEffects; HashMap<AtomicString, RefPtr<FilterEffect> > m_namedEffects; diff --git a/WebCore/svg/svgtags.in b/WebCore/svg/svgtags.in index 4ab6c5c..5d44e03 100644 --- a/WebCore/svg/svgtags.in +++ b/WebCore/svg/svgtags.in @@ -1,7 +1,7 @@ namespace="SVG" namespaceURI="http://www.w3.org/2000/svg" guardFactoryWith="ENABLE(SVG)" - + a createWithNew #if ENABLE_SVG_FONTS altGlyph createWithNew diff --git a/WebCore/websockets/WebSocket.idl b/WebCore/websockets/WebSocket.idl index cc4a07b..6850d36 100644 --- a/WebCore/websockets/WebSocket.idl +++ b/WebCore/websockets/WebSocket.idl @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -32,7 +33,10 @@ module websockets { interface [ Conditional=WEB_SOCKETS, - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + ConstructorParameters=1, + V8CustomConstructor, EventTarget, NoStaticTables ] WebSocket { @@ -52,8 +56,7 @@ module websockets { attribute EventListener onerror; attribute EventListener onclose; - [Custom] boolean send(in DOMString data) - raises(DOMException); + [RequiresAllArguments] boolean send(in DOMString data) raises(DOMException); void close(); // EventTarget interface diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp index 9ca2b20..5859fd7 100644 --- a/WebCore/websockets/WebSocketChannel.cpp +++ b/WebCore/websockets/WebSocketChannel.cpp @@ -58,6 +58,7 @@ WebSocketChannel::WebSocketChannel(ScriptExecutionContext* context, WebSocketCha , m_handshake(url, protocol, context) , m_buffer(0) , m_bufferSize(0) + , m_resumeTimer(this, &WebSocketChannel::resumeTimerFired) , m_suspended(false) , m_closed(false) , m_unhandledBufferedAmount(0) @@ -125,12 +126,8 @@ void WebSocketChannel::suspend() void WebSocketChannel::resume() { m_suspended = false; - RefPtr<WebSocketChannel> protect(this); // The client can close the channel, potentially removing the last reference. - while (!m_suspended && m_client && m_buffer) - if (!processBuffer()) - break; - if (!m_suspended && m_client && m_closed && m_handle) - didClose(m_handle.get()); + if ((m_buffer || m_closed) && m_client && !m_resumeTimer.isActive()) + m_resumeTimer.startOneShot(0); } void WebSocketChannel::didOpen(SocketStreamHandle* handle) @@ -234,6 +231,7 @@ bool WebSocketChannel::processBuffer() ASSERT(!m_suspended); ASSERT(m_client); ASSERT(m_buffer); + if (m_handshake.mode() == WebSocketHandshake::Incomplete) { int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize); if (headerLength <= 0) @@ -318,6 +316,18 @@ bool WebSocketChannel::processBuffer() return false; } +void WebSocketChannel::resumeTimerFired(Timer<WebSocketChannel>* timer) +{ + ASSERT_UNUSED(timer, timer == &m_resumeTimer); + + RefPtr<WebSocketChannel> protect(this); // The client can close the channel, potentially removing the last reference. + while (!m_suspended && m_client && m_buffer) + if (!processBuffer()) + break; + if (!m_suspended && m_client && m_closed && m_handle) + didClose(m_handle.get()); +} + } // namespace WebCore #endif // ENABLE(WEB_SOCKETS) diff --git a/WebCore/websockets/WebSocketChannel.h b/WebCore/websockets/WebSocketChannel.h index 0cb411d..a90c6dc 100644 --- a/WebCore/websockets/WebSocketChannel.h +++ b/WebCore/websockets/WebSocketChannel.h @@ -82,6 +82,7 @@ namespace WebCore { bool appendToBuffer(const char* data, int len); void skipBuffer(int len); bool processBuffer(); + void resumeTimerFired(Timer<WebSocketChannel>* timer); ScriptExecutionContext* m_context; WebSocketChannelClient* m_client; @@ -90,6 +91,7 @@ namespace WebCore { char* m_buffer; int m_bufferSize; + Timer<WebSocketChannel> m_resumeTimer; bool m_suspended; bool m_closed; unsigned long m_unhandledBufferedAmount; diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp index ea4f5e5..ba14732 100644 --- a/WebCore/websockets/WebSocketHandshake.cpp +++ b/WebCore/websockets/WebSocketHandshake.cpp @@ -35,6 +35,7 @@ #include "WebSocketHandshake.h" #include "AtomicString.h" +#include "CharacterNames.h" #include "Cookie.h" #include "CookieJar.h" #include "Document.h" @@ -56,28 +57,6 @@ namespace WebCore { static const char randomCharacterInSecWebSocketKey[] = "!\"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -static String extractResponseCode(const char* header, int len, size_t& lineLength) -{ - const char* space1 = 0; - const char* space2 = 0; - const char* p; - lineLength = 0; - for (p = header; p - header < len; p++, lineLength++) { - if (*p == ' ') { - if (!space1) - space1 = p; - else if (!space2) - space2 = p; - } else if (*p == '\n') - break; - } - if (p - header == len) - return String(); - if (!space1 || !space2) - return ""; - return String(space1 + 1, space2 - space1 - 1); -} - static String resourceName(const KURL& url) { String name = url.path(); @@ -102,11 +81,12 @@ static String hostName(const KURL& url, bool secure) return builder.toString(); } +static const size_t maxConsoleMessageSize = 128; static String trimConsoleMessage(const char* p, size_t len) { - String s = String(p, std::min<size_t>(len, 128)); - if (len > 128) - s += "..."; + String s = String(p, std::min<size_t>(len, maxConsoleMessageSize)); + if (len > maxConsoleMessageSize) + s.append(horizontalEllipsis); return s; } @@ -279,17 +259,27 @@ WebSocketHandshakeRequest WebSocketHandshake::clientHandshakeRequest() const // Keep the following consistent with clientHandshakeMessage(). // FIXME: do we need to store m_secWebSocketKey1, m_secWebSocketKey2 and // m_key3 in WebSocketHandshakeRequest? - WebSocketHandshakeRequest request(m_url, clientOrigin(), m_clientProtocol); + WebSocketHandshakeRequest request("GET", m_url); + request.addHeaderField("Upgrade", "WebSocket"); + request.addHeaderField("Connection", "Upgrade"); + request.addHeaderField("Host", hostName(m_url, m_secure)); + request.addHeaderField("Origin", clientOrigin()); + if (!m_clientProtocol.isEmpty()) + request.addHeaderField("Sec-WebSocket-Protocol:", m_clientProtocol); KURL url = httpURLForAuthenticationAndCookies(); if (m_context->isDocument()) { Document* document = static_cast<Document*>(m_context); String cookie = cookieRequestHeaderFieldValue(document, url); if (!cookie.isEmpty()) - request.addExtraHeaderField("Cookie", cookie); + request.addHeaderField("Cookie", cookie); // Set "Cookie2: <cookie>" if cookies 2 exists for url? } + request.addHeaderField("Sec-WebSocket-Key1", m_secWebSocketKey1); + request.addHeaderField("Sec-WebSocket-Key2", m_secWebSocketKey2); + request.setKey3(m_key3); + return request; } @@ -312,21 +302,21 @@ void WebSocketHandshake::clearScriptExecutionContext() int WebSocketHandshake::readServerHandshake(const char* header, size_t len) { m_mode = Incomplete; - size_t lineLength; - const String& code = extractResponseCode(header, len, lineLength); - if (code.isNull()) { - // Just hasn't been received yet. + int statusCode; + String statusText; + int lineLength = readStatusLine(header, len, statusCode, statusText); + if (lineLength == -1) return -1; - } - if (code.isEmpty()) { + if (statusCode == -1) { m_mode = Failed; - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "No response code found: " + trimConsoleMessage(header, lineLength), 0, clientOrigin()); return len; } - LOG(Network, "response code: %s", code.utf8().data()); - if (code != "101") { + LOG(Network, "response code: %d", statusCode); + m_response.setStatusCode(statusCode); + m_response.setStatusText(statusText); + if (statusCode != 101) { m_mode = Failed; - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected response code:" + code, 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("Unexpected response code: %d", statusCode), 0, clientOrigin()); return len; } m_mode = Normal; @@ -335,17 +325,14 @@ int WebSocketHandshake::readServerHandshake(const char* header, size_t len) m_mode = Incomplete; return -1; } - HTTPHeaderMap headers; - const char* headerFields = strnstr(header, "\r\n", len); // skip status line - ASSERT(headerFields); - headerFields += 2; // skip "\r\n". - const char* p = readHTTPHeaders(headerFields, header + len, &headers); + const char* p = readHTTPHeaders(header + lineLength, header + len); if (!p) { LOG(Network, "readHTTPHeaders failed"); m_mode = Failed; return len; } - if (!processHeaders(headers) || !checkResponseHeaders()) { + processHeaders(); + if (!checkResponseHeaders()) { LOG(Network, "header process failed"); m_mode = Failed; return p - header; @@ -355,6 +342,7 @@ int WebSocketHandshake::readServerHandshake(const char* header, size_t len) m_mode = Incomplete; return -1; } + m_response.setChallengeResponse(static_cast<const unsigned char*>(static_cast<const void*>(p))); if (memcmp(p, m_expectedChallengeResponse, sizeof(m_expectedChallengeResponse))) { m_mode = Failed; return (p - header) + sizeof(m_expectedChallengeResponse); @@ -418,6 +406,11 @@ void WebSocketHandshake::setServerSetCookie2(const String& setCookie2) m_setCookie2 = setCookie2; } +const WebSocketHandshakeResponse& WebSocketHandshake::serverHandshakeResponse() const +{ + return m_response; +} + KURL WebSocketHandshake::httpURLForAuthenticationAndCookies() const { KURL url = m_url.copy(); @@ -426,8 +419,70 @@ KURL WebSocketHandshake::httpURLForAuthenticationAndCookies() const return url; } -const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* end, HTTPHeaderMap* headers) +// Returns the header length (including "\r\n"), or -1 if we have not received enough data yet. +// If the line is malformed or the status code is not a 3-digit number, +// statusCode and statusText will be set to -1 and a null string, respectively. +int WebSocketHandshake::readStatusLine(const char* header, size_t headerLength, int& statusCode, String& statusText) { + statusCode = -1; + statusText = String(); + + const char* space1 = 0; + const char* space2 = 0; + const char* p; + size_t consumedLength; + + for (p = header, consumedLength = 0; consumedLength < headerLength; p++, consumedLength++) { + if (*p == ' ') { + if (!space1) + space1 = p; + else if (!space2) + space2 = p; + } else if (*p == '\n') + break; + } + if (consumedLength == headerLength) + return -1; // We have not received '\n' yet. + + const char* end = p + 1; + if (end - header > INT_MAX) { + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line is too long: " + trimConsoleMessage(header, maxConsoleMessageSize + 1), 0, clientOrigin()); + return INT_MAX; + } + int lineLength = end - header; + + if (!space1 || !space2) { + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "No response code found: " + trimConsoleMessage(header, lineLength - 1), 0, clientOrigin()); + return lineLength; + } + + // The line must end with "\r\n". + if (*(end - 2) != '\r') { + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line does not end with CRLF", 0, clientOrigin()); + return lineLength; + } + + String statusCodeString(space1 + 1, space2 - space1 - 1); + if (statusCodeString.length() != 3) // Status code must consist of three digits. + return lineLength; + for (int i = 0; i < 3; ++i) + if (statusCodeString[i] < '0' || statusCodeString[i] > '9') { + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Invalid status code: " + statusCodeString, 0, clientOrigin()); + return lineLength; + } + + bool ok = false; + statusCode = statusCodeString.toInt(&ok); + ASSERT(ok); + + statusText = String(space2 + 1, end - space2 - 3); // Exclude "\r\n". + return lineLength; +} + +const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* end) +{ + m_response.clearHeaderFields(); + Vector<char> name; Vector<char> value; for (const char* p = start; p < end; p++) { @@ -451,10 +506,7 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e case ':': break; default: - if (*p >= 0x41 && *p <= 0x5a) - name.append(*p + 0x20); - else - name.append(*p); + name.append(*p); continue; } if (*p == ':') { @@ -495,36 +547,21 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e return 0; } LOG(Network, "name=%s value=%s", nameStr.string().utf8().data(), valueStr.utf8().data()); - headers->add(nameStr, valueStr); + m_response.addHeaderField(nameStr, valueStr); } ASSERT_NOT_REACHED(); return 0; } -bool WebSocketHandshake::processHeaders(const HTTPHeaderMap& headers) -{ - for (HTTPHeaderMap::const_iterator it = headers.begin(); it != headers.end(); ++it) { - switch (m_mode) { - case Normal: - if (it->first == "sec-websocket-origin") - m_wsOrigin = it->second; - else if (it->first == "sec-websocket-location") - m_wsLocation = it->second; - else if (it->first == "sec-websocket-protocol") - m_wsProtocol = it->second; - else if (it->first == "set-cookie") - m_setCookie = it->second; - else if (it->first == "set-cookie2") - m_setCookie2 = it->second; - continue; - case Incomplete: - case Failed: - case Connected: - ASSERT_NOT_REACHED(); - } - ASSERT_NOT_REACHED(); - } - return true; +void WebSocketHandshake::processHeaders() +{ + ASSERT(m_mode == Normal); + const HTTPHeaderMap& headers = m_response.headerFields(); + m_wsOrigin = headers.get("sec-websocket-origin"); + m_wsLocation = headers.get("sec-websocket-location"); + m_wsProtocol = headers.get("sec-websocket-protocol"); + m_setCookie = headers.get("set-cookie"); + m_setCookie2 = headers.get("set-cookie2"); } bool WebSocketHandshake::checkResponseHeaders() diff --git a/WebCore/websockets/WebSocketHandshake.h b/WebCore/websockets/WebSocketHandshake.h index 3e0c66a..a5b4260 100644 --- a/WebCore/websockets/WebSocketHandshake.h +++ b/WebCore/websockets/WebSocketHandshake.h @@ -36,11 +36,11 @@ #include "KURL.h" #include "PlatformString.h" #include "WebSocketHandshakeRequest.h" +#include "WebSocketHandshakeResponse.h" #include <wtf/Noncopyable.h> namespace WebCore { - class HTTPHeaderMap; class ScriptExecutionContext; class WebSocketHandshake : public Noncopyable { @@ -86,12 +86,16 @@ namespace WebCore { const String& serverSetCookie2() const; void setServerSetCookie2(const String& setCookie2); + const WebSocketHandshakeResponse& serverHandshakeResponse() const; + private: KURL httpURLForAuthenticationAndCookies() const; + int readStatusLine(const char* header, size_t headerLength, int& statusCode, String& statusText); + // Reads all headers except for the two predefined ones. - const char* readHTTPHeaders(const char* start, const char* end, HTTPHeaderMap* headers); - bool processHeaders(const HTTPHeaderMap& headers); + const char* readHTTPHeaders(const char* start, const char* end); + void processHeaders(); bool checkResponseHeaders(); KURL m_url; @@ -111,6 +115,8 @@ namespace WebCore { String m_secWebSocketKey2; unsigned char m_key3[8]; unsigned char m_expectedChallengeResponse[16]; + + WebSocketHandshakeResponse m_response; }; } // namespace WebCore diff --git a/WebCore/websockets/WebSocketHandshakeRequest.cpp b/WebCore/websockets/WebSocketHandshakeRequest.cpp index 9a41167..1132a44 100644 --- a/WebCore/websockets/WebSocketHandshakeRequest.cpp +++ b/WebCore/websockets/WebSocketHandshakeRequest.cpp @@ -34,60 +34,60 @@ #include "WebSocketHandshakeRequest.h" -#include "AtomicString.h" -#include "StringBuilder.h" -#include <utility> -#include <wtf/Assertions.h> +#include <cstring> using namespace std; namespace WebCore { -WebSocketHandshakeRequest::WebSocketHandshakeRequest(const KURL& url, const String& origin, const String& webSocketProtocol) +WebSocketHandshakeRequest::Key3::Key3() +{ + memset(value, 0, sizeof(value)); +} + +void WebSocketHandshakeRequest::Key3::set(const unsigned char key3[8]) +{ + memcpy(value, key3, sizeof(value)); +} + +WebSocketHandshakeRequest::WebSocketHandshakeRequest(const String& requestMethod, const KURL& url) : m_url(url) - , m_secure(m_url.protocolIs("wss")) - , m_origin(origin) - , m_webSocketProtocol(webSocketProtocol) + , m_requestMethod(requestMethod) { - ASSERT(!origin.isNull()); } WebSocketHandshakeRequest::~WebSocketHandshakeRequest() { } -void WebSocketHandshakeRequest::addExtraHeaderField(const AtomicString& name, const String& value) +String WebSocketHandshakeRequest::requestMethod() const +{ + return m_requestMethod; +} + +KURL WebSocketHandshakeRequest::url() const +{ + return m_url; +} + +void WebSocketHandshakeRequest::addHeaderField(const char* name, const String& value) { - m_extraHeaderFields.append(HeaderField(name, value)); + m_headerFields.add(name, value); } -void WebSocketHandshakeRequest::addExtraHeaderField(const char* name, const String& value) +const HTTPHeaderMap& WebSocketHandshakeRequest::headerFields() const { - m_extraHeaderFields.append(HeaderField(name, value)); + return m_headerFields; } -Vector<WebSocketHandshakeRequest::HeaderField> WebSocketHandshakeRequest::headerFields() const +WebSocketHandshakeRequest::Key3 WebSocketHandshakeRequest::key3() const { - Vector<HeaderField> fields; - fields.append(HeaderField("Upgrade", "WebSocket")); - fields.append(HeaderField("Connection", "Upgrade")); - fields.append(HeaderField("Host", host())); - fields.append(HeaderField("Origin", m_origin)); - if (!m_webSocketProtocol.isEmpty()) - fields.append(HeaderField("WebSocket-Protocol", m_webSocketProtocol)); - fields.append(m_extraHeaderFields); - return fields; + return m_key3; } -String WebSocketHandshakeRequest::host() const +void WebSocketHandshakeRequest::setKey3(const unsigned char key3[8]) { - StringBuilder builder; - builder.append(m_url.host().lower()); - if ((!m_secure && m_url.port() != 80) || (m_secure && m_url.port() != 443)) { - builder.append(":"); - builder.append(String::number(m_url.port())); - } - return builder.toString(); + m_key3.set(key3); } } // namespace WebCore diff --git a/WebCore/websockets/WebSocketHandshakeRequest.h b/WebCore/websockets/WebSocketHandshakeRequest.h index d488135..792f67e 100644 --- a/WebCore/websockets/WebSocketHandshakeRequest.h +++ b/WebCore/websockets/WebSocketHandshakeRequest.h @@ -33,37 +33,37 @@ #if ENABLE(WEB_SOCKETS) +#include "HTTPHeaderMap.h" #include "KURL.h" #include "PlatformString.h" -#include <wtf/Vector.h> namespace WebCore { -class AtomicString; - class WebSocketHandshakeRequest { public: - WebSocketHandshakeRequest(const KURL&, const String& origin, const String& webSocketProtocol); + WebSocketHandshakeRequest(const String& requestMethod, const KURL&); ~WebSocketHandshakeRequest(); - // According to current Web Socket protocol specification, four mandatory headers (Upgrade, Connection, Host, and Origin) and - // one optional header (WebSocket-Protocol) should be sent in this order, at the beginning of the handshake request. - // The remaining headers can be set by using the following function. - void addExtraHeaderField(const AtomicString& name, const String& value); - void addExtraHeaderField(const char* name, const String& value); + String requestMethod() const; + KURL url() const; - // Returns the list of header fields including five special ones. - typedef std::pair<AtomicString, String> HeaderField; - Vector<HeaderField> headerFields() const; + const HTTPHeaderMap& headerFields() const; + void addHeaderField(const char* name, const String& value); -private: - String host() const; + struct Key3 { + unsigned char value[8]; + Key3(); + void set(const unsigned char key3[8]); + }; + Key3 key3() const; + void setKey3(const unsigned char key3[8]); + +private: KURL m_url; - bool m_secure; - String m_origin; - String m_webSocketProtocol; - Vector<HeaderField> m_extraHeaderFields; + String m_requestMethod; + HTTPHeaderMap m_headerFields; + Key3 m_key3; }; } // namespace WebCore diff --git a/WebCore/websockets/WebSocketHandshakeResponse.cpp b/WebCore/websockets/WebSocketHandshakeResponse.cpp new file mode 100644 index 0000000..753cecf --- /dev/null +++ b/WebCore/websockets/WebSocketHandshakeResponse.cpp @@ -0,0 +1,110 @@ +/* + * 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. + */ + +#include "config.h" + +#if ENABLE(WEB_SOCKETS) + +#include "WebSocketHandshakeResponse.h" + +#include "AtomicString.h" +#include <wtf/Assertions.h> + +using namespace std; + +namespace WebCore { + +WebSocketHandshakeResponse::ChallengeResponse::ChallengeResponse() +{ + memset(value, 0, sizeof(value)); +} + +void WebSocketHandshakeResponse::ChallengeResponse::set(const unsigned char challengeResponse[16]) +{ + memcpy(value, challengeResponse, sizeof(value)); +} + +WebSocketHandshakeResponse::WebSocketHandshakeResponse() +{ +} + +WebSocketHandshakeResponse::~WebSocketHandshakeResponse() +{ +} + +int WebSocketHandshakeResponse::statusCode() const +{ + return m_statusCode; +} + +void WebSocketHandshakeResponse::setStatusCode(int statusCode) +{ + ASSERT(statusCode >= 100 && statusCode < 600); + m_statusCode = statusCode; +} + +const String& WebSocketHandshakeResponse::statusText() const +{ + return m_statusText; +} + +void WebSocketHandshakeResponse::setStatusText(const String& statusText) +{ + m_statusText = statusText; +} + +const HTTPHeaderMap& WebSocketHandshakeResponse::headerFields() const +{ + return m_headerFields; +} + +void WebSocketHandshakeResponse::addHeaderField(const AtomicString& name, const String& value) +{ + m_headerFields.add(name, value); +} + +void WebSocketHandshakeResponse::clearHeaderFields() +{ + m_headerFields.clear(); +} + +const WebSocketHandshakeResponse::ChallengeResponse& WebSocketHandshakeResponse::challengeResponse() const +{ + return m_challengeResponse; +} + +void WebSocketHandshakeResponse::setChallengeResponse(const unsigned char challengeResponse[16]) +{ + m_challengeResponse.set(challengeResponse); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_SOCKETS) diff --git a/WebCore/websockets/WebSocketHandshakeResponse.h b/WebCore/websockets/WebSocketHandshakeResponse.h new file mode 100644 index 0000000..c385a1b --- /dev/null +++ b/WebCore/websockets/WebSocketHandshakeResponse.h @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifndef WebSocketHandshakeResponse_h +#define WebSocketHandshakeResponse_h + +#if ENABLE(WEB_SOCKETS) + +#include "HTTPHeaderMap.h" +#include "PlatformString.h" + +namespace WebCore { + +class AtomicString; + +class WebSocketHandshakeResponse { +public: + WebSocketHandshakeResponse(); + ~WebSocketHandshakeResponse(); + + int statusCode() const; + void setStatusCode(int statusCode); + const String& statusText() const; + void setStatusText(const String& statusText); + const HTTPHeaderMap& headerFields() const; + void addHeaderField(const AtomicString& name, const String& value); + void clearHeaderFields(); + + struct ChallengeResponse { + unsigned char value[16]; + + ChallengeResponse(); + void set(const unsigned char challengeResponse[16]); + }; + const ChallengeResponse& challengeResponse() const; + void setChallengeResponse(const unsigned char challengeResponse[16]); + +private: + int m_statusCode; + String m_statusText; + HTTPHeaderMap m_headerFields; + ChallengeResponse m_challengeResponse; +}; + +} // namespace WebCore + +#endif // ENABLE(WEB_SOCKETS) + +#endif // WebSocketHandshakeResponse_h diff --git a/WebCore/wml/WMLErrorHandling.h b/WebCore/wml/WMLErrorHandling.h index 3005803..8277be4 100644 --- a/WebCore/wml/WMLErrorHandling.h +++ b/WebCore/wml/WMLErrorHandling.h @@ -18,8 +18,8 @@ * */ -#ifndef WMLErrorCodes_h -#define WMLErrorCodes_h +#ifndef WMLErrorHandling_h +#define WMLErrorHandling_h #if ENABLE(WML) namespace WebCore { diff --git a/WebCore/workers/SharedWorker.idl b/WebCore/workers/SharedWorker.idl index c04f7cf..748adc3 100644 --- a/WebCore/workers/SharedWorker.idl +++ b/WebCore/workers/SharedWorker.idl @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -32,7 +33,10 @@ module threads { interface [ Conditional=SHARED_WORKERS, - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + ConstructorParameters=2, + V8CustomConstructor, CustomMarkFunction, GenerateNativeConverter, GenerateToJS diff --git a/WebCore/workers/Worker.idl b/WebCore/workers/Worker.idl index 54d406d..e53de93 100644 --- a/WebCore/workers/Worker.idl +++ b/WebCore/workers/Worker.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,7 +28,10 @@ module threads { interface [ Conditional=WORKERS, - CustomConstructor, + CanBeConstructed, + CustomConstructFunction, + ConstructorParameters=1, + V8CustomConstructor, GenerateNativeConverter, GenerateToJS ] Worker : AbstractWorker { diff --git a/WebCore/workers/WorkerContext.cpp b/WebCore/workers/WorkerContext.cpp index bf893d2..c710ba6 100644 --- a/WebCore/workers/WorkerContext.cpp +++ b/WebCore/workers/WorkerContext.cpp @@ -31,11 +31,14 @@ #include "WorkerContext.h" +#include "AbstractDatabase.h" #include "ActiveDOMObject.h" +#include "Database.h" +#include "DatabaseCallback.h" +#include "DatabaseSync.h" #include "DatabaseTracker.h" #include "DOMTimer.h" #include "DOMWindow.h" -#include "Database.h" #include "ErrorEvent.h" #include "Event.h" #include "EventException.h" @@ -271,7 +274,7 @@ NotificationCenter* WorkerContext::webkitNotifications() const #if ENABLE(DATABASE) PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec) { - if (!securityOrigin()->canAccessDatabase() || !Database::isAvailable()) { + if (!securityOrigin()->canAccessDatabase() || !AbstractDatabase::isAvailable()) { ec = SECURITY_ERR; return 0; } @@ -290,15 +293,11 @@ void WorkerContext::databaseExceededQuota(const String&) PassRefPtr<DatabaseSync> WorkerContext::openDatabaseSync(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec) { - if (!securityOrigin()->canAccessDatabase()) { + if (!securityOrigin()->canAccessDatabase() || !AbstractDatabase::isAvailable()) { ec = SECURITY_ERR; return 0; } - ASSERT(DatabaseSync::isAvailable()); - if (!DatabaseSync::isAvailable()) - return 0; - return DatabaseSync::openDatabaseSync(this, name, version, displayName, estimatedSize, creationCallback, ec); } #endif diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index d05329e..4091db1 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -30,9 +30,6 @@ #if ENABLE(WORKERS) #include "AtomicStringHash.h" -#include "Database.h" -#include "DatabaseSync.h" -#include "DatabaseCallback.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -47,6 +44,8 @@ namespace WebCore { class Database; + class DatabaseCallback; + class DatabaseSync; class NotificationCenter; class ScheduledAction; class WorkerLocation; diff --git a/WebCore/xml/DOMParser.cpp b/WebCore/xml/DOMParser.cpp index 448dcb1..7e04be7 100644 --- a/WebCore/xml/DOMParser.cpp +++ b/WebCore/xml/DOMParser.cpp @@ -29,7 +29,7 @@ PassRefPtr<Document> DOMParser::parseFromString(const String& str, const String& if (!DOMImplementation::isXMLMIMEType(contentType)) return 0; - RefPtr<Document> doc = DOMImplementation::createDocument(contentType, 0, false); + RefPtr<Document> doc = DOMImplementation::createDocument(contentType, 0, KURL(), false); doc->open(); doc->write(str); diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index 831ada9..da95d32 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -240,9 +240,8 @@ Document* XMLHttpRequest::responseXML() const // The W3C spec requires this. m_responseXML = 0; } else { - m_responseXML = Document::create(0); + m_responseXML = Document::create(0, m_url); m_responseXML->open(); - m_responseXML->setURL(m_url); // FIXME: Set Last-Modified. m_responseXML->write(String(m_responseText)); m_responseXML->finishParsing(); @@ -512,11 +511,11 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) // The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all. // Also, only async requests support upload progress events. - bool forcePreflight = false; + bool uploadEvents = false; if (m_async) { m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); if (m_requestEntityBody && m_upload) { - forcePreflight = m_upload->hasEventListeners(); + uploadEvents = m_upload->hasEventListeners(); m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); } } @@ -525,7 +524,7 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) // We also remember whether upload events should be allowed for this request in case the upload listeners are // added after the request is started. - m_uploadEventsAllowed = m_sameOriginRequest || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); + m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); ResourceRequest request(m_url); request.setHTTPMethod(m_method); @@ -542,7 +541,7 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) ThreadableLoaderOptions options; options.sendLoadCallbacks = true; options.sniffContent = false; - options.forcePreflight = forcePreflight; + options.forcePreflight = uploadEvents; options.allowCredentials = m_sameOriginRequest || m_includeCredentials; options.crossOriginRequestPolicy = UseAccessControl; @@ -900,7 +899,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier) #if ENABLE(INSPECTOR) if (InspectorController* inspector = scriptExecutionContext()->inspectorController()) - inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseText); + inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseText, m_url, m_lastSendURL, m_lastSendLineNumber); #endif bool hadLoader = m_loader; diff --git a/WebCore/xml/XSLTProcessor.cpp b/WebCore/xml/XSLTProcessor.cpp index 97b5466..61f414e 100644 --- a/WebCore/xml/XSLTProcessor.cpp +++ b/WebCore/xml/XSLTProcessor.cpp @@ -33,13 +33,12 @@ #include "FrameLoader.h" #include "FrameView.h" #include "HTMLDocument.h" -#include "HTMLDocumentParser.h" // for parseHTMLDocumentFragment #include "Page.h" #include "Text.h" #include "TextResourceDecoder.h" -#include "XMLDocumentParser.h" #include "loader.h" #include "markup.h" + #include <wtf/Assertions.h> #include <wtf/Vector.h> @@ -69,10 +68,10 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc RefPtr<Document> result; if (sourceMIMEType == "text/plain") { - result = Document::create(frame); + result = Document::create(frame, sourceIsDocument ? ownerDocument->url() : KURL()); transformTextStringToXHTMLDocumentString(documentSource); } else - result = DOMImplementation::createDocument(sourceMIMEType, frame, false); + result = DOMImplementation::createDocument(sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : KURL(), false); // Before parsing, we need to save & detach the old document and get the new document // in place. We have to do this only if we're rendering the result document. @@ -83,8 +82,6 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc frame->setDocument(result); } - if (sourceIsDocument) - result->setURL(ownerDocument->url()); result->open(); RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(sourceMIMEType); @@ -100,14 +97,14 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc static inline RefPtr<DocumentFragment> createFragmentFromSource(const String& sourceString, const String& sourceMIMEType, Document* outputDoc) { - RefPtr<DocumentFragment> fragment = DocumentFragment::create(outputDoc); + RefPtr<DocumentFragment> fragment = outputDoc->createDocumentFragment(); if (sourceMIMEType == "text/html") - parseHTMLDocumentFragment(sourceString, fragment.get()); + fragment->parseHTML(sourceString); else if (sourceMIMEType == "text/plain") fragment->addChild(Text::create(outputDoc, sourceString)); else { - bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), outputDoc->documentElement()); + bool successfulParse = fragment->parseXML(sourceString, outputDoc->documentElement()); if (!successfulParse) return 0; } diff --git a/WebCore/xml/XSLTProcessor.idl b/WebCore/xml/XSLTProcessor.idl index 28bd878..dac4b21 100644 --- a/WebCore/xml/XSLTProcessor.idl +++ b/WebCore/xml/XSLTProcessor.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,7 +34,9 @@ module xml { interface [ Conditional=XSLT, - CustomConstructor + CanBeConstructed, + CustomConstructFunction, + V8CustomConstructor ] XSLTProcessor { [Custom] void importStylesheet(in Node stylesheet); |